How to use 2 power supplies in the scheme

gpiopower supplyraspberry pi

I am building a device to send a signal from Raspberry Pi GPIO to a vibration motor. Here is how it should work: the RPI outputs 0v or 3.3v, and when it outputs 3.3v, the vibration motor should vibrate. I figured out that RPi GPIO current is too small for this vibration motor, so I decided to use some external power supply (in my case, 9v battery), so 9v should be sent to vibration motor when GPIO outputs 3.3v. The problem is I don't understand how to connect it properly.

I guess I should use the transistor key with base connected to the RPi GPIO output and base and emitter connected to the 9v. But it somehow doesn't work the way I want it.

Can you help me with it? I'm completely lost.

Best Answer

The usual procedure I use for motors is through a H-Bridge. But since a vibration motor isn't bidirectional I believe we can use just one switch in the following configuration. (I'm assuming its a 3V motor).

enter image description here

Instead of the D3 pin used on the arduino you can use the GPIO pin from the RPi. Furthermore you can also use the 5V output from the Raspberry pi for testing, otherwise i usually like to use an external battery for this.

Source for further reading:

http://learningaboutelectronics.com/Articles/Vibration-motor-circuit.php