9
\$\begingroup\$

I connected HC-SR04 ultrasonic sensor, to single-board computer BeagleBoard-xM. Trigger pin requires 5 V DC. However, control pins of BeagleBoard-xM can provide only 1.8 V DC.

What is the best way to convert voltage to 5 V? Is there anything else I should pay attention to?

\$\endgroup\$
3
  • \$\begingroup\$ I originally understood you only have 1.8 V power available, and that you need 3.3 V. Now it seems you simply want a level converter, with 3.3 V power being available. Which is true? If the latter, then my answer doesn't apply. \$\endgroup\$ Sep 3, 2014 at 13:23
  • \$\begingroup\$ I 'm sorry for not being clear enough. I want a level converter from 1.8 V to 5 V (not 3.3 V that I wrote by mistake). \$\endgroup\$
    – dempap
    Sep 3, 2014 at 13:31
  • 1
    \$\begingroup\$ I was actually using that exact same setup. The HC-SR04 already triggers at 3.3V so you should be fine there. Take care tough to not feed back 5V echo signal. You can also check out teknoman117.wordpress.com/2013/04/30/…. I followed this board layout and it worked. I used the PRU differently though... \$\endgroup\$
    – magu_
    Sep 4, 2014 at 6:13

2 Answers 2

7
\$\begingroup\$

First of all, according to the datasheet for the HC-SR04 that you linked to, it appears to run on 5v, not 3.3v.

What you need is a level shifter, to convert the I/O signals on the BeagleBoard-xM expansion header from 1.8v to the 5v levels (and back again) as required by the sensor.

A device that will perform this function is the Logic Level Converter from SparkFun. It has 4 channels, which is more than you need. You could build your own with just two channels, but for the price ($3) its not worth it.

\$\endgroup\$
1
  • \$\begingroup\$ You 're right. I corrected my post. \$\endgroup\$
    – dempap
    Sep 3, 2014 at 13:24
14
\$\begingroup\$

There are other ways of interfacing the BeagleBoard-xM to that HC-SR04 without using a 'level shifter'.

The pins on the HC-SR04 are not bi-directional, they are either input, or output only, and so don't need a level-shifter.

The Echo pulse pin, provides an input to the BeagleBoard-xM, and is the easiest to interface, you just need two resistors in a voltage divider, in close to 1.8:5 (total=1.8+3.3 which is pretty close) ratio:

schematic

simulate this circuit – Schematic created using CircuitLab

(The resistors could be other values, e.g. 3.3K and 6.8K would likely work)

The Trigger pin requires close to 5V for on, and close to 0V for off. Use an ordinary, cheap, easy to get NPN BJT to actively pull the signal to 0V, and a pull-up resistor to reach 5V.

schematic

simulate this circuit

Almost any general purpose NPN BJT will do, and the resistor values can be varied too, though there isn't much point in significantly smaller resistor values. You might use the same values as the voltage divider to remove the hassle of getting other value resistors.

NB: The sense of the beagleboard output pin is inverted, LOW for triggering, and HIGH for off.

You might even have a local electronics store which has the parts, otherwise postage & packing will likely cost more than the parts (I guess well under 50¢ if you can buy them one off)

\$\endgroup\$
2
  • \$\begingroup\$ Can you please tell me where is that 5V at the top of your second circuit diagram coming from? Why do we need it when we already have a 5V output from the trigger pin? \$\endgroup\$ Sep 3, 2015 at 3:04
  • 1
    \$\begingroup\$ @CrakC - IIRC the HC-SR04 pin is an input pin, so we do not "already have a 5V output from the trigger pin". \$\endgroup\$
    – gbulmer
    Sep 3, 2015 at 3:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.