For a project, I need to use a Raspberry Pi 2 to control a 12V car window motor. To save space, I also need for them to use the same battery. The motor will need to work at a low speed but have a hight torque. From research, it seems I might need to use an h-bridge to slip the power and control the motor, and then a UBEC to lower the voltage for the Raspberry Pi. But I'm not sure if that is correct. What I also don't know is what type of battery to use and how to make sure I don't burn out any components. Would a low voltage and high current battery be best? And will an h-bridge be the correct component to handle a high current? And will all of this be able to connect together? I can give more information if needed.

enter image description here

  • 1
    \$\begingroup\$ Related: What should I use from given options to power a raspberry pi? \$\endgroup\$
    – Dave Tweed
    Mar 26, 2017 at 1:21
  • \$\begingroup\$ You should be able to get a car window motor with the associated drive electronics from a car scrapyard. That way you should be able to send it pulses (as if pressing the window up/down buttons in the car) to control the motor and not have to worry about making your own H-bridge or over-current protection. \$\endgroup\$ Nov 20, 2017 at 13:01

2 Answers 2


The car widow motor has a worm gear that makes it operate at a low speed and high torque as it is, supplied by 12 volts. You should determine what its speed is with a 12-vlot supply. Then determine if your project needs to operate at just one speed or over some range of speeds. Determine the maximum and minimum speeds that will ever be needed. If the maximum speed is less than the motor speed for 12 volts, it would be best to add some means like a belt an pulleys to to reduce the speed further mechanically. That will further increase the available torque. Reducing the speed mechanically to the maximum speed required will most efficiently use the motor. Electronic speed control should be used only to provide adjustable speed, not to reduce the maximum speed.

You can use a single 12-volt battery or power supply to power both the Raspberry Pi and the motor. You will need a voltage regulator to reduce the voltage to 5 V for the Raspberry Pi. You will need some noise filtering to prevent noise from the motor's commutator from interfering with the Raspberry Pi.

A PWM controlled H bridge can be used to control the motor speed by reducing the effective voltage from 12 volts.

The battery needs to be sized to supply the maximum total current that the motor and Raspberry Pi might need. The loads will only draw the current they need. There is no need to worry about excess supply.

  • \$\begingroup\$ Thanks for the response. I never new about the noise thing or that the parts will only draw the current they need. \$\endgroup\$ Mar 26, 2017 at 0:54
  • \$\begingroup\$ There is one risk about excess current capacity. If you make a mistake in design or wiring, the results might be more catastrophic. However the voltage regulator for the Raspberry Pi will probably provide some limit to any fault current. \$\endgroup\$
    – user80875
    Mar 26, 2017 at 1:01

The Raspberry Pi runs on 5V, and you say the motor runs on 12V. So you've got a few options, and your end decision will be best decided by what voltages you have available; if you're keeping this window motor in the car, you'll have 12V from the car and you can use a linear regulator or switching regulator to create a 5V supply line on which you can run your Raspberry Pi.

You mentioned battery though, is this going to be battery powered? If that's the case, yes you'll want relatively high current; depends on what the motor draws. Lithium-ion might be the way to go.

H-bridges are for driving motors, yeah. I can provide more details for whichever branch you need, I just didn't want to put details for every option if you didn't need every option.

  • \$\begingroup\$ Thanks for answering. I should have mentioned originally that I won't be keeping it in the car. Lithium-ion seems like it would work for the project. So with that, will I need to regulate or do something to the high current for the the linear/switching regulator and the h-bridge? \$\endgroup\$ Mar 26, 2017 at 0:34
  • \$\begingroup\$ The H-Bridge and motor should only draw as much current as they need, and as far as I know switching regulators will only supply as much current as requested (until current limits of components are reached). I'd do a little research if you pursue lithium ion though, there's a lot of consideration to be had in safe charging, overcurrent protection (from shorts and such), overdischarge protection, balance charging, etc; it's a whole topic of study in its own right! I know pre-built 12v lithium batteries exist though, that may be easier. \$\endgroup\$
    – Orotavia
    Mar 26, 2017 at 6:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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