Take the 2-minute tour ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
    
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. –  Olin Lathrop Sep 3 at 13:23
    
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). –  dempap Sep 3 at 13:31
1  
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... –  magu_ Sep 4 at 6:13

2 Answers 2

up vote 6 down vote accepted

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.

share|improve this answer
    
You 're right. I corrected my post. –  dempap Sep 3 at 13:24

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)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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