Interfacing HC-SR04 with ESP-01
Posted: Wed Mar 30, 2016 3:50 am
I'm attempting to interface HC-SR04 with ESP-01. I'm using Lua scripts to trigger and read echo pin.
Since HC-SR04 runs on 5V, I'm using a 1K+2K resistor combination to act as voltage divider and feed the ECHO input thru this into the ESP-01 GPIO0. But what happens is when module is turned ON, it thinks that GPIO0 is connected to GND and goes into flash mode.
If I connect the ECHO Pin output directly into ESP-01 GPIO0 (I know this is not correct), the distance readings start appearing fine. However I believe it can damage the ESP module.
Is there any way I can avoid getting my GPIO0 going into flash mode? I tried to switch the GPIO0 and GPIO2 roles, tried a level shifter, nothing worked. Either direct connection ECHO Pin-ESP GPIO0 worked ..or..I have to start the module and leave the GPIO0 pin floating and then connect to voltage divider after a few seconds. But both these options are not practical.
Anyone can suggest a workaround to this problem?
Since HC-SR04 runs on 5V, I'm using a 1K+2K resistor combination to act as voltage divider and feed the ECHO input thru this into the ESP-01 GPIO0. But what happens is when module is turned ON, it thinks that GPIO0 is connected to GND and goes into flash mode.
If I connect the ECHO Pin output directly into ESP-01 GPIO0 (I know this is not correct), the distance readings start appearing fine. However I believe it can damage the ESP module.
Is there any way I can avoid getting my GPIO0 going into flash mode? I tried to switch the GPIO0 and GPIO2 roles, tried a level shifter, nothing worked. Either direct connection ECHO Pin-ESP GPIO0 worked ..or..I have to start the module and leave the GPIO0 pin floating and then connect to voltage divider after a few seconds. But both these options are not practical.
Anyone can suggest a workaround to this problem?