1

Sorry for the confusing title, but here's my problem:

I'm trying to test out a 2N2222 transistor as a switch for a higher current (for a 4WD motor) with the Raspberry Pi B+, and I'm trying to use one of the GPIO pins to do so.

When I run the GPIO output high, nothing happens however. Yet, when I plug in the rail 3.3 V, it switches the transistor and runs the motor. I tested the GPIO pin with a multimeter, and sure enough it was outputting 3.3 V when high. My external power source is a 9 V battery, and I'm following a similar circuit design to HOWTO – Switching on/off a DC motor with a Raspberry Pi. I've tested the motors, transistor, and resistors just to be sure, and they work as expected. Is it because the amperage from the GPIO pin isn't enough for the transistor?

Extra info: the motors are supplied from the Tamiya dual motor gearbox and, combined, pull 2/3 of an Amp (if I remember correctly), which is why I use an external supply. I also have tried it with a 5 W external power supply too, with the same result.

Sorry if this may sound silly, I'm still learning as I go! Any help is appreciated.

Greenonline
  • 2,969
  • 5
  • 27
  • 38
John Does
  • 13
  • 2

1 Answers1

1

Make sure you have connected the ground output from the pi to the motor and ground connection of the external supply.

Measure voltage across the base/emitter junction. Should be 0.7 voltage when pin 7 is high. Also measure the voltage across the motor.

You should check the voltage at pin 7 is changing 3.3 to 0.

Base current should be 2.6V/1000 so 2.6mA. You should be able to measure this with a multimeter. If you have current flow but it's not switching, try a smaller resistor on the pin 7 to base connection maybe 500 ohms to double the current. If you have two 1K resistors, put them in parallel.

Alan Jones
  • 26
  • 2