The HC-SR04 sensors are simple to use. Let's take a look!
- Vcc - Power pin - this sensor requires 5V power for best results.
- Trig - Signal can be 3V or 5V. Setting the Trig pin to high for 10µs causes the sensor to initiate an ultrasonic burst.
- Echo - "Return" signal is 5V logic - the sensor comes with two 10k resistors to use as a divider to convert the 5V logic level to a safe 2.5V that you can read with your 3V device. The Echo pin goes high when the ultrasonic burst is transmitted (in response to Trig) and stays high until the sensor receives an echo of its burst, at which point it goes low. By measuring the time the Echo pin is high, the distance can be computed.
- Gnd - Ground pin.
The US100 is nearly the same except it is capable of UART.
- Vcc - Power pin - this sensor can run at 3V or 5V.
- Trig/TX - Signal can be 3V or 5V in HC-SR04 compatibility mode.. Works as TX in UART mode. Setting the Trig pin to high for 10µs causes the sensor to initiate an ultrasonic burst.
- Echo/RX - Signal can be 3V or 5V in HC-SR04 compatibility mode. Works as RX in UART mode. The Echo pin goes high when the ultrasonic burst is transmitted (in response to Trig) and stays high until the sensor receives an echo of its burst, at which point it goes low. By measuring the time the Echo pin is high, the distance can be computed.
- Gnd - Ground pin.
- Gnd - Ground pin.
Text editor powered by tinymce.