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?

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

  • My tutorial just uses just a 1 kilo ohm resistor, is that okay? – Vedbot Oct 25 '15 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. – Linus Oct 25 '15 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. – joan Oct 25 '15 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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