Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By AhmedBahgat
#86951 Hello Everyone

I need to do a small project that will stop a motor based on a certain distance then activate it again if the distance changes

I will get the distance reading using Ultrasonic sensor HC-SR04 for which I need 5V, GRD, and 2 x GPIOs

Can I connect the HC-SR04 to the Sonoof Basic, I will provide external 5V to the sensor, so all I need is 2 X GPIOs on the Sonoff basic, can I use GPIO 1 and GPIO 3 if I flash the sonoff with ESPHome or I have to use other GPIOs because #1 and #3 are the TX / TR pins?, please bear in mind that I update the sonoff firmware over the air with ESPHome

And if so, how can the sensor's reading controls the Sonoff relay automatically On/Off and based on the changing distance?

Your help, directions, and insight will be very much appreciated as I am really new to this stuff

Cheers