O'Reilly logo

Building Smart Drones with ESP8266 and Arduino by Syed Omar Faruk Towaha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Avoiding obstacles using ESP8266

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required