HC-SR04 Ultrasonic sensor
Hey all real electronics pros....
I am getting ready to setup my first HC-SR04 circuit on a breadboard.
- I will power the HC from my ESP board using 5V
- The ESP sends signals to the Trigger pin on the HC via code
- The echo pin on the HC sends a signal to the ESP and is read via code
- The echo pin output comes as 5V and I will need a voltage divider etc to lower the voltage to 3.3 or less volts so I don't hurt the ESP board.
Am I correct with these assumptions?
Code is readily available but I am not seeing what I would expect in the code.
Before I examined any code I envisioned getting the distance from the sensor in the setup. Then in the loop test the return and get the distance and compare the distance from the setup to the distance captured in the loop. If they varied greatly I would consider that the sensor was triggered. Is this approach not valid?
Note that if you use HC-SR04+ (with the plus), you can power it with 3.3V and skip the voltage divider.
I haven't used this particular sensor, but I am aware that ultrasonic devices can have a significant power surge while they are 'ranging'. I suggest a 330uf or larger capacitor across the 5v and ground leads at the HC-SR04.
My pulseIn is apparently timing out as the distance returned is always 0.
I have been over the circuit, testing the voltages and I am seeing values that would indicate the echo pin is high.
Could someone offer some additional testing to do. What to look for.
I could post my code and pic of the circuit if they think that would help.
I don't really know what to look for other than to see if voltages are present.
I see voltage at the Trig and echo pin.
I have 4 sensors and tried all of them with the same result.
I tried 2 code examples from github. Both gave same results.
I have built a circuit for the ESP8266 and ultrasonic sensor.
First thing I could use some advice on is I have to pull the ground from 3.3V in the circuit in order for the flash to be successful.
I am having a strange issue with my ESP8266 and ultrasonic sensor circuit.
The code uploads fine.
But I am getting this error if my circuit is live. (Just connect the ground)
I am running this via the 3.3V off the ESP8266 pro.
Fatal exception (0):
epc1=0x40100003, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000
This is such a simple circuit and I am using code from the internet and various samples all do the same thing so I feel very confident ruling out the code.
Can anyone offer some ideas on what I need to check.
We can't really say much without seeing the circuit and the code.
Ok I am trying to upload an image and getting message that the only allow file type is pdf