0

I'm looking to make a toy car using the raspberry pi. I've figured I can power the pi using 6 AA's and a voltage regulator, and connect to the 5V and a GND pin (pins 2 and 6 I think).

Then power the motors using another 4 (6 with regulator) AA's and use a relay circuit from the pi to power them. Can I just connect a pin to the relay, and the relay to ground on the Pi. Then the other side of the relay sits into a motor power circuit like a switch.

I hope this diagram clears some of that up.

circuit diagram http://www.seriousbrew.co.uk/public/raspberrypi-simple-motor-circuit.PNG

I figured this might be easier than a separate board and stops "noise" from the motor and can be used to operate multiple motors.

I'm a still new to electronics and such and don't want to fry my pi, so basically .. 1st) will this setup work ? 2nd) I'm not sure exactly what parts to get, I linked two but don't know if the pi will trigger the relay ? 3rd) is there a way to change the circuit to allow the motor to reverse direction (reverse polarity, adding another relay and diodes ?)

PARTS : relay, alternate relay, Motor - Maplin - Code:HA83E, Voltage Regulator - Maplin - Code:YY74R

Drawn using Circuit Lab

3

The broad approach is OK, but as drawn won't work.

  1. The pi can only supply ~15mA and you are unlikely to find a relay which will work reliably.
  2. Any inductive circuit connected to electronics should have a flywheel diode to prevent damage from voltage spikes.
  3. Using a 6v source and regulator to supply 5v is unlikely to work. Most regulators need a voltage drop of ~1v to work. A switch mode regulator would be a better solution.
  4. You don't need to regulate the motor supply.

You would be better to use a transistor to drive the relay, or better use an open collector driver to directly power the motor. You will find lots of examples on the web, many specific to the Pi. Try the MagPi magazine.

Provided you use a diode from the relay to the +3.3V rail to prevent voltage spikes you won't do any damage, even if it doesn't work.

  • 6 x AA would be 9V. I recommend getting a few LM2596 regulators off ebay to keep in the junk box. These work well for powering the RPi and are very inexpensive. – John La Rooy Sep 28 '13 at 9:49
  • If it's a big motor, then using a transistor to switch the relay might be a good option too. – John La Rooy Sep 28 '13 at 9:50
  • so a circuit more like this – Rudiger Kidd Sep 29 '13 at 20:33
  • @RudigerKidd, exactly, but I'd recommend 10k resistor (assuming the small signal transistor has current gain of ~100 and relay coil needs < 50mA ) – John La Rooy Sep 30 '13 at 3:27

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.