Building a Smart Dustbin with IoT using Blynk 2.0 and ESP32/NodeMCU ESP8266 - Method 2
ฝัง
- เผยแพร่เมื่อ 1 มี.ค. 2023
- Step-by-Step Guide: Building a Smart Dustbin with Blynk 2.0 IoT App, Web Dashboard, ESP32 and NodeMCU ESP8266". This title is descriptive, straightforward, and highlights the key components of your video.
Key Moments:
1:18 List of the Required Components
1:44 ESP32 Circuit Diagram
1:49 NodeMCU ESP8266 Circuit Diagram
1:53 Configure the New Blynk Dashboard
1:58 login to blynk.cloud website
3:13 How to Create virtual pin in new blynk cloud
4:49 How to add widgets in the Web Dashboard
5:56 How to Create Blynk Credentials for new templates
6:49 Link to download the Programming code
7:33 Programming Code Explanation
8:06 How to replace blynk credentials in the Arduino Programming Code
8:21 How to Install the New Blynk Library
9:16 How to install Servo Motor Library for ESP32
14:17 Connect your board and Upload the programming code
14:35 Link to Install ESP32 or ESP8266 Board to Arduino IDE
15:02 How to install Comp Port Driver for your board
15:21 Interfacing of Hardware
15:51 Download and configure the New Blynk IoT App
16:17 How to add and Configure the Widgets in the New Blynk IoT App
17:32 Live Demo
Important Links:
Code for ESP32 Board: raw.githubusercontent.com/its...
Code for NodeMCU ESP8266: raw.githubusercontent.com/its...
Circuit Diagram (Fore ESP32): raw.githubusercontent.com/its...
Circuit Diagram (For ESP8266): raw.githubusercontent.com/its...
How to install blynk in Arduino IDE: • Step-by-Step Guide: In...
How to install com port: • How to Install, Troubl...
Factory Reset your ESP32 Board: • ESP32 Troubleshooting:...
Factory Reset Your NodeMCU ESP8266 board: • NodeMCU ESP8266 Factor...
Blynk cloud server: blynk.cloud/
Link to download winzip: www.winzip.com/en/download/wi...
Link to download WinRAR: www.win-rar.com/download.html...
How to install ESP32 board in Arduino IDE: www.nuttyengineer.com/knowled...
How to install NodeMCU ESP8266 board in Arduino IDE: www.nuttyengineer.com/knowled...
Home Automation with new Blynk using BlynkEdgent Method: • Home Automation using ...
Arduino IDE Software: www.arduino.cc/en/software
NuttyFi Wifi Development board: www.nuttyengineer.com/product...
Find Our Other Videos on TH-cam: / @smedehradun
How Automation with New Blynk2.0 Latest method:
• Smart Home Automation ...
How to send DHT11 Sensor Data to Thingspeak server:
• Real-time Monitoring o...
How to Decode any RFID Card:
• How to Decode RFID Car...
Humidity & Temperature DHT11 with Raspberry Pi:
• Raspberry Pi with DHT1...
DHT11 Sensor with Raspberry pi using New Blynk2.0 IoT
• Humidity and Temperatu...
Multiple Servo Motor Control using New Blynk2.0
• Control Multiple Servo...
Gmail Alert & Notification with New Blynk2.0 IoT
• Gmail Notifications an...
ESP32 Factory Reset
• ESP32 Troubleshooting:...
NodeMCU ESP8266 Factory Reset
• NodeMCU ESP8266 Factor...
PH Sensor interfacing with New Blynk2.0
• PH Sensor interfacing ...
Distance measurement using Ultrasonic Sensor with New Blynk2.0
• Distance measurement u...
IoT Monitored Smart Plant with Water Pump Automation
• IoT Monitored Smart Pl...
Servo Motor Control using New Blynk2.0
• Servo Motor Control us...
Smart Dustbin with New Blynk2.0 IoT App
• Smart Dustbin with New...
TDS sensor based Safe Water Quality Meter with Mew Blynk2.0
• TDS sensor based Safe ...
DHT11 Sensor Data to New Blynk2.0
• DHT11 Sensor Data to N...
Home Automation using New Blynk 2.0
• Home Automation using ...
IoT Home Automation with Manual Switch Control Through New Blynk2.0 (Online & Offline Mode)
• IoT Home Automation wi...
LoRa Ra01 & Ra02 Interfacing with Customized Atmega328 Board
• How to Interface LoRa ...
LoRa Module Testing with Atmega328 Customized Board- SX1278 Long Range with Arduino Uno
• LoRa Module Testing wi...
LED Control with Arduino IoT Cloud
• How to Start with Ardu...
Contact link for Nutty Engineer Company: www.nuttyengineer.com/contact...
Contact link for SME: www.smedehradun.com/contact/
Join us at Social Platform: Github: github.com/itsbhupendrasingh
Twitter: / itsbhupendra
LinkedIn: / smedehradun
Facebook: / schematicslab
Instagram: / itsbhupendrasingh
#arduino #smartdustbin #iot #smedehradun #blynk #internetofthings - วิทยาศาสตร์และเทคโนโลยี
If we use power supply module, is the connection common to Vin of nodemcu and vcc of other components.
If not explain it in summer please
You can provide power through mobile adaptor.
can I replace IR sensor with the ultrasonic sensor? what are the changes to be made for that?
Yes. You need to remote the code for IR sensor and add the code for ultrasonic.
I'm using 5v external supply. Did I have to remove USB connection as I'm given supply to vin.
If you are using external
Power supply then remove the usb cable. And remove the external power supply while uploading the program.
sir may i ask? is the IR sensor for detect the object near the dustbin and //the ultrasonic for monitor the level in dustbin? confused between both sensor's function
IR sensor is used to open the flap while sense the hand & ultrasonic sensor is used to measure the garbage level in the bin.
If you see the each step do the video then you will get complete information about the project.
@@SMEDehradun thanks sir. It really helpful and glad that you reply fast. Tq so much
@@mariahhafizah5208 most welcome
hi hello, whats that yellow/golden thing you connected the components in 15:40? what should i use for esp8266? please reply asap, thank you!
That is 12V to 5V step down power supply module. I have used that because I am using external power supply adapter to provide the power to the project.
@@SMEDehradun will i need that for esp 8266 too? since i am also using external power supply. also are the jumping wires male and female?
Not required. But if you found power issue in your project then you need external power for this. But in that case, you can connect the power through the usb mobile charger to provide power to ESP826) board.
@@SMEDehradun can you please provide the circuit diagram with power supply module and name of that module
Sir will there be any difference in the functionality of the servo motor if I use 3 pins ir sensor instead of 4pins ir sensor because I am using 3 pins ir sensor and the servo is not responding to it . Please guide me sir
There is no issue of 3 pin or 4 pin ir sensor. Check the connection properly and try.
Can u give the sensor names to identify the metalllic and non metallic objects
Search metal sensor.
i am using esp8266 board and i am getting an error on servo library which is not supported, i tried changing to esp8266servo but still not working
Servo library is different for both esp8266 & ESP32.
Install the library as per your board and check the library example and make changes as per the library.
when i have give servo angle 90 degres it rotating only 45 degrees, and when 180 is given it rotating 90. and i have external power supply. what to do.
You need to manually calibrate the servo motor as per your project requirement. Actually it’s pwm works on 3.3V that’s why.
How have you provided power to the circuit? What are the battery connections?
You can provide the power through the mobile power bank directly through the usb cable or you can connect 5V DC to Vin and GND pin to GND.
@@SMEDehradun Thanks a lot
🙏
In code when I mentioned servo angle 90 degrees it's only rotating 45 degrees. What should I do
Check the 0 and 90 degree working of servo in the bin then place it accordingly.
Sir what changes should I make in the code if I am only using nodemcu esp8266 and ultrasonic sensor?
For what? Explain.
@@SMEDehradun All I will be doing is measuring the level of waste and displaying the reslut in the blynk app.So, what changes should I make in the code?
Then remove the code of ir sensor and servo motor.
Which board can be used preferably ESP32 or Nodemcu 8266?
You can use any board. Both will work same.
Sir is it safe to use IR sensor as it output is highly affected in the presence of loght . How to manage this issue?
Yes. It can provide you false output on the light. So you need to prevent the IR sensor from direct light.
I have connected the circuit as per the video, and its working but when ir sensor detect the object the servo is rotating after 5 or 6 seconds. And some time not rotating. I've checked the sensors seperately and its working. But when connected as per this circuit it rotating with some delay.
Check that your IR is working opposite or not. It may due to active high or low sensitivity issue.
How to check that can you please tell that@@SMEDehradun
@@SMEDehradunplease reply
You have to your IR sensor, not mine.
I followed your smart trash bin tutorial video, but when I power it up, the infrared sensor works, but the servo does not. I am a beginner and don't know where I went wrong. I hope you can provide guidance. I am using the diagram and code for the esp8266
This project require good power source to work. So It may power issue in your project.
So what you did now? The problem solved? If yes how did you solved? Please do comment!!
I help us
Provide external power and check all the sensor works separately with board.
Can we run project by removing the connection from laptop, after uploading the code.
Yes. You can power it up with adaptor.
if we connect as per the circuit without the power supply ,then what will be the power supply for the system?
5V, 2A will do
5V, 2A will do
5V, 10watt will do
@@SMEDehradun is there any circuit diagram available...if yes then can share it
Just google and you will get power supply circuit.
If we not connected a 12v to 5 v supply then it works properly or not ?
It will work.
Sir which components we replace with 12v to 5v step down power supply
Step down power supply module
We want to add the sim module to get the sms when dust bin is full . How can add the sim module
Add GSM AT commands to the code to send the SMS. It’s just simple. I have already posted a code on GSM.
Circuit diagram for nodemcu is confusing while using power supply, can you provide it please im unable to find the circuit google
I have used external power supply designed by us.
You can use mobile adaptor as pier supply.
can you please provide the link or phot, for the power supply module for buying
You can use 12V to 5V dc step down module for it. Below module may help you.
zbotic.in/product/dc-dc-12v-to-3-3v-5v-12v-power-module-multi-output-voltage-conversion/?gad_source=1&gclid=CjwKCAiAloavBhBOEiwAbtAJO6gxJYe6vNJSEEJ2H9lzpOXm0RijhxZ1S6IM_JZFRCB0kLHZqqmUJxoCiRUQAvD_BwE
Since there is only one Vin pin in nodemcu , how to connect motor's and sensor's pin in that?
You can use breadboard or you can solder pin in the general size PCB for multiple Vcc & GND
@@SMEDehradun okay , thankyou
I made connection as per the circuit diagram but the servo not rotating with ir sensor, and also blynk not connecting to board that is not getting online. It is not working even i have used 5v external supply
You need to check your hardware connection properly and also check the IR sensor is active high or low. Make the proper changes according that.
sir i am just using node mcu and ultrasonic sensor to send live data on blynk app
what changes need to be done in code?
can u please tell i am trying from a long time but only my device is getting online on blynk app but the distance data is not showing on the blynk dashboard what to do?
You need to edit the code for ultrasonic sensor.
Below video link guide you how to do it, but you need to remove the dht sensor code and add the code of ultrasonic.
th-cam.com/video/c5u6-Th1sI4/w-d-xo.html
@@SMEDehradun ok sir I tried again and connected my mobile hotspot to my laptop and in the code as well now it's working fine touchwood 🙏
Hope it doesn't screw up like last time during my presentation 🤞
Congratulations. Don’t change your hotspot credentials or your Blynk template.
@@SMEDehradun sir I had a query when I am connecting only the nodeMcu and distance sensor the sensor is working fine but when I am connecting my whole circuit with LEDS and buzzer it is not showing distance properly after a few seconds it shows 0
Any idea why is this happening is it because of less power as power is being utilised by leds and buzzer?
I am connecting my nodeMcu to laptop and taking power like that
@robo4827 I think this is not due to power issue. It may be due to connectivity issue.
we connected the circuit properly and in blynk also its showing connected code also uploaded but bin is not sensing anything any solutin.. We need it as fast as possible.
You need to check the sensor separately to ensure that they are working or not. Watch each steps, change the blynk credentials, add wifi hotspot name in code and then try again.
I want to do the same but I do not want to automatically open it.... So basically I don't need servo and all... So what should I change in the coding
Also when I include servo angle and all.. And go to upload it in my esp wroom 32 it says.. Compilation error and library servo claims to run on avr and all
What should I do
Remove the code for servo and ir sensor then try to upload.
which board we need to select for esp8266. like tools->boards->esp8266->then what?
Select the NodeMCU 1.0(ESP12E module)
@@SMEDehradun ok thanks
Welcome
Sir if i want to seperate the dry and wet waste, code and required component how should be changed? Reply pls.
There are lots of methods for waste segregation but for student project, you can use moisture sensor or IR sensor to monitor the wave length.
You need to mortify the code for this.
@@SMEDehradunSir what will be the diagram and code after using moisture sensor.
Try it by yourself first. And if you find difficulties then drop the comment.
@@SMEDehradunok sir.
👍
I AM getting no matching function for call to 'Servo::write(int)'
Select the proper board as shown in video and install the servo library for your board.
For ESP8266 how and where have you given the power supply? Also what power supply have you given?
I have used 12V to 5V external power supply for the ESP8266.
I used Vin pin for power input.
You can use it without external power supply as per the circuit diagram.
@@SMEDehradun if we connect as per the circuit without the power supply ,then what will be the power supply for the system?
5V 2A can work. You can provide the power from the computer’s USB port.
Can this project work on 2 ultrasonic sensors? instead of using Ir sensor for opening and closing the dustbin, is it possible to use ultrasonic sensor? Thank you in advance sir!
Yes you can.
You can replace the the ir sensor. And you need to change little bit coding.
Sir could you please you provide those changes @@SMEDehradun
You can try it by yourself. If there is issue you can write it then.
Can we use com2 or com1 as ports
You need to select the com port of your board. Check it in device manager.
@@SMEDehradun thank you
🙏
in blynk mobile app , it is asking for an upgrade(to pay) for labeled value , please tell me , what should i do?
You can use other widget to dispaly it.
Which one i can use instead of labeled value?
@@vidhigarg7895 You Can use Gauge or Value Display Widget.
Sir please make one vedios fall detection system using node mcu esp 8266
Use MPU6050 sensor for fall detection.
Sir i also want to adjust camera module how should i
If you want to do it with Blynk, then you need to upgrade Blynk version to premium.
Circuit diagram for nodemcu is confusing while using power supply, can you provide it please im unable to find the circuit google, it is urgent please
There is not confusion of circuit diagram. I think, you need to study it properly.
Can you provide the circuit diagram with 12v to 5v stepdown power supply
You can google for this circuit. All circuits are similar.
can you please provide, i'm unable to find it. @@SMEDehradun
Sir will this work properly without the external power supply
It can be. But prefer external power supply.
I want to get mobile notifications when it gets full how to do that can you please help me, its urgent
You can create notifications and alert with gmail update.
Below video can help you
th-cam.com/video/T8vPXUrAfco/w-d-xo.html
Sir, can we also add a alert notification when dustbin become full..
Please sir, help me.
Sir kindly tell me
Join & Write your query to the our telegram channel
t.me/+vJcqQmRQLKYwZWQ1
When i am completing my connection then blynk app template is not online
Check your blynk credentials and wifi name and password. Also Check the issue in the serial monitor.
can you provide a video for Building a Smart Dustbin with IoT using Thingspeak and NodeMCU ESP8266. that is doing everything same as done in video but using thingspeak or you can just provide the code for this everything else like circuit and all remain same.
I will try for this.
@@SMEDehradun Yes Please
This code is right or have any error and monitoring the level of 3 dustbin is possible by this project
This code is correct and working fine. And can configure it in any No of dustbin by adding sensors.
Thankyou Sir
In place of smart dustbin in blynk dustbin 1,dustbin 2,dustbin 3 inside smart dustbin or separate template is needed that is we need separate templates or can make altogether in one template
You can adjust it in single dashboard. And if you want to create separate template then it can also works.
Thankyou Sir
🙏
How to use nodemcu esp32 in this same project
You can use through serial communication or SPI or I2C method. Even you can communicate through wifi.
link is not opening@@SMEDehradun
Which link?
First two row.github
hello, are you sure there are no errors in the code for esp8266?
code is error free & verified with hardware.
yes sir , i checked everything , every component is in working condition , but , still this project is not working , i dont know whats wrong with it , i think u r circuit diagram for esp8266 and the code doesn't match because the d values are different , please check once sir and please help me
The circuitry and programming codes have been thoroughly reviewed, and the content presented in the video is entirely accurate.
Individuals who refuse to acknowledge their own mistakes and instead shift blame onto others, never got the helps from others.
sir the moment i am uploading code for esp32, it is showing me error for servo library that This library only supports boards with an AVR, SAM, SAMD, NRF52 or STM32F4 processor... please guide me sir
Use servo library for ESP32.
@@SMEDehradun I'm using that only but still the same error comes, please help!!
Select the proper board, change wifi and blynk credentials, servo library for your board can help you only. All the information already shown in the video. Plz watch carefully. Note that servo library for esp8266 and ESP32 are different. Read the compilation error while compiling.
bro the ultrasonic sensor is not responding!! i got light on ir sensor and servo is at angle 90degree!!! in my dashboard the distance is showing 0 , bin level 100 and servo angle 90 degree!!! what shpuld i do now bro please help me out tomorrow i have my science exhibition !!! i am using esp2866
Hi,
Check that ultrasonic sensor is working or not? try to read the ultrasonic sensor separately first. If that working then try.
Hello sir,
Code is working,
But during the first time the IR sensor detects fastly and servo motor is opened and during the next time when i place hand infront of IR it is not detecting, it is taking more time
Hi,
Make sure that IR sensor would not get any direct light from any where.
Also check that there is no any power issue in your board.
Also check, your IR sensor is working properly or any connection issue.
In Blynk mobile app , in the template , it is showing offline , how to connect it with wifi?
Plz watch the complete video. And you will get your answer.
I already watched the complete video
I have shown all the steps to connect the baord to the blynk server. And after watching the complete video, you are not getting that in the video ????
🤔
brother , ur circuit diagram is very confusing , in the video u have connected to 5v step down , but in the circuit diagram there is no stepdown , and i am not understanding how have u given power to the circuit , please help me as fast as possible , because we have to submit this project in few days
I think you have not seen the video properly. I have attached the adapter and also designed the step down power supply that provides power to the complete project.
You can also provide power through the USB
Good day! If I were to use GSM as the connection type, would there be changes in the code?
Yes. If you want to use gsm network to connect with blynk, then code will be different.
I tried this project im unable to detect my device in blynk app on mobile
Follow all the instructions as directed in the video, change the blynk credentials, add the wifi credentials, connect the hardware as per the circuit diagram and that’s it.
sir I have no। Ir sensor and I don't want to measure bin level just only smart dustbin so how to do ?
Please tell sir quickly I have project in school
I am not getting your point. Can you explain more project if you don’t want to measure level?
I telling you that I have uploaded code but it cannot connect wifi and another proplem is I have no lr module only I have ultrasonic sensor,my project is just automatic dustbin I don't want to check bin level how to do this please tell
@@SMEDehradunI telling you that I have uploaded code but it cannot connect wifi and another proplem is I have no lr module only I have ultrasonic sensor,my project is just automatic dustbin I don't want to check bin level how to do this please tell
For the wifi, check your wifi and blynk credentials. If you don’t want to use ultrasonic sensor to on off the dustbin flap then you need to edit the code, remove the ir sensor code and level code. And add the code of ultrasonic as per your requirement.
Sir, i want all this that you did in this project and also want to send a alert email or notification on the app , that Dustbin is full
Sir kindly tell me how we add an alert message that Dustbin is full???????
Hi,
To add mail alert and notification, below video li k may help you
th-cam.com/video/T8vPXUrAfco/w-d-xo.html
@@SMEDehradun sir , how we set limit in dustbin project that when it's full when it sends an alert message only .
Because in fire alarm it's quite different.
Please help me ..
You need to set the timing for the alert to the blynk dashboard and call that function in the function
Actually i want to ask that, how we set that Dustbin only send e mail when it is 90% full or above...
Because in blynk dashboard it doesn't shown any condition like when it will send e-mail in alert section.
why my blynk always OFFLINE? do you have any solution?
While you add credentials in the programming code, it will automatically come online. all connections and code must be right configured.
where will we get the circuit diagram using esp8266?
I will update it to the video description soon.
@@SMEDehradun It will be really helpful if you do it in a day or two. Please help it's urgent.
@@asthakulshrestha9250 I have updated the circuit diagram link in the video description. you can find it there.
@@SMEDehradun Thanks a lot. It's really a nice project.
Thanks. Plz subscribe & share my channel to your friends & colleagues.
i tried doing everything sir , i connected it to 5v usb cable with 1A , i followed your tutorial step by step , code has also been uploaded but its not working , the sensors are not detecting anything , the servo motor is not rotating , i dont know what to do sir , please help me , there is a competition in few days and iam worried a lot , u r my last hope sir 🙏🙏🙏
Try to operate your all the hardware first like servo motor, IR sensor, ultrasonic sensor.
Do the separate coding for these and check all aare working separately fine or not. Once all done well, then again try the complete code.
Hello sir... Can you please provide proper code for esp32. I have tried everything but code isn't working it showing error.
Hi,
Both codes are well tested. So I think you are not following all instruction as shown in the video.
WARNING: library Servo claims to run on avr, megaavr, sam, samd, nrf52, stm32f4, mbed, mbed_nano, mbed_portenta,
In file included from C:\Users\admin\Downloads\smartbin123\smartbin123.ino:20:
mbed_rp2040 architecture(s) and may be inco
C:\Users\admin\AppData\Local\Arduino15\libraries\Servo\src/Servo.h:77:2: error: #error "This library only supports boards with an AVR, SAM, SAMD, NRF52 or S #error "This library only supports boards with an AVR, SAM, SAMD, NRF52 or STM32F4 processor."
exit status 1
Compilation error: exit status 1
Sir i followed each and every step carefully but still above error occurred
@@BhagyashreeDGade there are different servo library for ESP32 and ESP8266 board. if you are using esp32 board, then install the esp32 servo library for it.
Uv sensor is not detecting the percentage and when I disconnect the ground of UV sensor it is showing the percentage but ir sensor and servo motor is not working
Any solution?
UV Sensor?
Sorry *ultrasonic sensor
Check the connecting wires if you are not getting data from ultrasonic sensor.
Wires are connected correctly the thing is when I disconnect the ground of ultrasonic sensor it is working but then ir sensor won't work
Check whether you missed any connection of ultrasonic as well as IR or you have plugged some connection wrong.
Sir,4 links are not opening
Hello Suvam,
All links are working perfectly. I have just checked.
Check once again.
I cant open the code for 8266 please bro add google drive link for easy
Link is available in the video description for the code. That is the github link.
But the link is not opening bro 😞
It’s working here. It may be due to network issue there. try once again.
Not working bro 😷
@@No_copy_music it's may network or browser issue. you have to look on it.
Sir ur code is showing compiling error for esp 32 dev module sir do one vid plzz
Hi,
Code is working good with ESP32 Wrover board.
Install the updated blynk library and select the proper board.
@@SMEDehradun sir whn i am gonna blynk in board manager ntg is showing
Board manager????
Link is available in the video description to guide you how to install the blynk library.
First install it then go ahead
Whn i am searching blynk in board manager ntg is showing sir
And wht quary means
Sir plz reply fast bez we have to submit it in 5 days neither we will be fail 😢
What’s the query?
@@SMEDehradun i didn't understand
What reply you want?
i can't able to download code
Link is working perfectly here. check it again. it may be github issue sometimes.
Sir,link not opening.taking too long time to open
Hi,
I have just checked. All links are working. Plz check once again.
Sir, it's showing safari could not open the page because the server stopped responding.
In android it's showing this site taking too long time to respond
It’s working here.
@@SMEDehradun now it's showing.sometimes unreachable.
anyways i collected it.thanks sir
Welcome 🙏
Whre is code
Hi,
It’s in the video description. Plz check properly.
sorry my coding is error l , i already to download library servo esp32 but still error like this
WARNING: library Servo claims to run on avr, megaavr, sam, samd, nrf52, stm32f4, mbed, mbed_nano, mbed_portenta, mbed_rp2040, renesas architecture(s) and may be incompatible with your current board which runs on esp32 architecture(s).
In file included from C:\Users\User\Music\teseps32\teseps32.ino:19:
c:\Users\User\Documents\Arduino\libraries\Servo\src/Servo.h:79:2: error: #error "This library only supports boards with an AVR, SAM, SAMD, NRF52 or STM32F4 processor."
#error "This library only supports boards with an AVR, SAM, SAMD, NRF52 or STM32F4 processor."
^~~~~
exit status 1
Compilation error: exit status 1
Servo library for ESP32 & ESP8265 are different. So install as per your board.
@@SMEDehradun I've installed it according to the esp32 servo library same like in video
Hi,
Select the ESP32 board, then install all the libraries one by one then try to compile the program.
@@SMEDehradun fixed #include sir
@@SMEDehradun but the another trouble is my servo is not working proper sir the servo rotating delay so long
I modified the code of IR sensor since sometimes it detects , sometimes it wont. I also not include the wifi.h and client since it will appear error on my IDE. Instead of servo.h, I replaced with #include . I dont know why it appears error when I just include servo.h......OVerall thank you for the tutorial. It helps alot
this is what I have done in my code to make it work.
#define BLYNK_TEMPLATE_ID " fill this up "
#define BLYNK_TEMPLATE_NAME " fill this up "
#define BLYNK_AUTH_TOKEN " fill this up "
#define BLYNK_PRINT Serial
#include
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = " ";
char pass[] = " ";
BlynkTimer timer;
#define echoPin 32
#define trigPin 33
#include // downloaded esp32 servo in the manage libraries
Servo servo;
long duration;
int distance;
int binLevel=0;
int IRpin=34;
void SMESensor(){
int IRsensor=digitalRead(IRpin);
if(IRsensor==0){
servo.write(90);
Blynk.virtualWrite(V2, 90);
delay(1000); // adjust time for opening
}
else{
servo.write(0);
Blynk.virtualWrite(V2, 0);
}
ultrasonic();
delay(100);
}
void ultrasonic()
{
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration * 0.034 / 2; //formula to calculate the distance for ultrasonic sensor
binLevel=map(distance, 21, 0, 0,100); // ADJUST BIN HEIGHT HERE (21, 0, 0,100) means 0-21cm=distance converted to 0-100%
Blynk.virtualWrite(V0, distance);
Blynk.virtualWrite(V1, binLevel);
}
void setup()
{
Serial.begin(9600);
servo.attach(13);
pinMode(IRpin, INPUT);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
Blynk.begin(auth, ssid, pass);
delay(2000);
timer.setInterval(1000L, SMESensor);
}
void loop()
{
Blynk.run();
timer.run();
SMESensor();
Serial.print("Distance: ");
Serial.print(distance);
Serial.print(" cm");
Serial.print(" | ");
Serial.print("Bin level: ");
Serial.print(binLevel);
Serial.println(" %");
}
what error you are getting? is it servo library error?
@@SMEDehradun error in servo library. Wifi.h and wifi.client. Also, the IR sensor is sensing only at start. This was fixed already by adding library of the esp32 servo and uncomment the wifi.h and wificlient.h. Made a modification of your code in the void SMESensor(); This is the modification I made:
void SMESensor()
{
IRsensor=digitalRead(IRpin);
if( IRsensor==0){
servo.write(90);
delay(5000);
Blynk.virtualWrite(V2, 90);
}
else{
servo.write(0);
Blynk.virtualWrite(V2, 0);
}
ultrasonic();
delay(5);
}
and include that SMESensor in the void loop
And its working.
Or this two for loops ....it also works.....
int IRsensor=digitalRead(IRpin);
if(IRsensor==0){
for(i=0; i0; i--)
servo.write(0);
Blynk.virtualWrite(V2, 0);
}
ultrasonic();
delay(200);
}
}
Library of servo motor is different for both esp8265 and ESP32 board. After installation, see the example of servo motor and make changes in servo motor commands in the program.
Sir how to contact u
Write your query in the comment box below