We will use a sensor to sense any object in front of it. We will use an ultrasonic sensor (HC-SR04 preferred). The intensity of the sensor will be shown by our Blynk app. So, let's start with the connection.
Connect the D1 and D2 to the Tring and Echo pins respectively. Since the sensor needs a 5V power supply, we will use an external battery to power it up. We will also use the same battery to power the NodeMCU after uploading the code. The pinout is as follows:
HC-SR04 | NodeMCU |
Trig | D1 |
Echo | D2 |
GND | GND |
VCC | Vin |
Refer to the following circuit diagram for clarification:
Refer to the following ...