0

I have a B+ connected to a H-bridge which is connected to 4 AA batteries and 4 motors, and they work fine, but now I want to add a distance sensor, which requires 5v, so do I need any extra batteries?

1 Answer 1

3

You can use the 5v output on the gpios of the Raspberry Pi. However be careful, you mustn't connect the echo pin directly to the gpio. Instead you can make a voltage divider on the wire connecting the echo pin because the b+ can't handle anything over 3.3v. Not using a voltage divider will damage your Raspberry Pi.

You can use a 470 Ohm and a 1K Ohm resistor with the 1K connecting echo and ground. Refer to the diagram below if you are unsure. enter image description here

3
  • My tutorial just uses just a 1 kilo ohm resistor, is that okay? Commented Oct 25, 2015 at 14:38
  • @Vedbot It is risky, I can't guarantee the voltage will be around 3.3v without a voltage divider. Maybe someone else can tell you. Commented Oct 25, 2015 at 14:46
  • The official line has always been that any current at a voltage greater than 3.3V will eventually kill the GPIO/Pi. I can't see the official line changing. A voltage divider is safest. If you can only use 1 resistor I suggest a value of 10k or more. Commented Oct 25, 2015 at 14:52

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.