| DC motor control and H-Bridge | mortenbs.com Last updated Dec 2011. |
DC Motor ControlA digital motor control is able to turn the motor on/off, and maybe even reverse the motor.
An analog motor control is further able to regulate the speed of the motor.
Both types is used for many appliances.
Table of contents
H-Bridge
Analog H-Bridge of transistors
Digital H-Bridge of relays
Digital H-Bridge of four solid state relays
Digital H-Bridge with analog voltage regulator (Analog and digital combined, PNP version)
Analog (or PWM) voltage regulator separated
Controlling relays or 12 volt DC equipment by 5 volt DC signal
Combining 8 channels digital/analog switch
One direction motor control for Arduino 5v (PWM)
Example of a simple motor control for helicopterH-BridgeTo reverse a DC motor it is needed to swap the power
(+) and the ground
![[gnd]](http://www.mortenbs.com/images/symbols/gnd.gif)
, with an
H-Bridge.
An H-Bridge can also operate both digital and analog.
Below is one example of an analog bridge of
transistors,- and two examples of a digital H-Bridge of relays.
It's also possible to combine the digtal and analog features into a motor control. See further below...
Analog H-Bridge of transistorsAn analog H-Bridge can be used for small voltage, light motor loads, and for short periods of time.
It's not recommended to use a purely analog bridge for heavy loading, because of a number of problems.
These problems is to properly pull down
transistors, and also to eliminate power spikes and noise from the motor.
Instead look at the
Digital H-Bridge with analog voltage regulator section to find more info about that.
Rough theory of an analog
transistor H-Bridge without pull-down could look like this:
![[Image]](hbridge_transistor2_small.jpg)
In example above, PWM-signals from an
Arduino controls a ~12 volt motor.
Note that in the example, two analog (or PWM)-signals is required to drive the motor forwards and backwards.
In the picture, mosfet's was used, they could easily be replaced with smaller
transistors like the
BD135/
BD136 or even
BC547/
BC557.
But again - the purely analog H-Bridge is not recommended for heavy loading and so on...
Digital H-Bridge of relaysFour solid state relays can be used, but even better two latching relays
(bistable) of two relaxed states can be used.
Using latching relays, they only need to be pulled when reversing, unlike of using solid state relays, two of them needs-
to be pulled to even drive forwards. With four solid state relays it is easy to add braking feature. Using latching relays,
braking feature needs an extra solid state relay, to short
circuit the motor plus and minus.
Digital H-Bridge of four solid state relaysIllustration below shows how to use four relays for an H-Bridge. One or two power supplies can be used.
Use rectifier diodes to set the relays for
forward,
backward and
braking:
 |
| Terminal | Description | | Fwd, Brk, Bwd | Digital signals | | A1, B1 | Forward, for relay switch | | A2, B2 | Reverse, for relay switch | | A2, B1 | Brake (Motor short circuit) | | NONE | Free run (Nothing) |
|
![[Image]](hbridge_4relay_bottom_sml.jpg)
|
Digital H-Bridge with analog voltage regulator (Analog and digital combined, PNP version)For combining the digtal and analog features into a motor control, two latching relays can be used to do the bridging, -
and then a PNP
transistor is used to regulate the speed.
This way, one digital signal for reversing switch is needed, and one analog
(or PWM) signal is needed to regulate the speed.
 |
| Terminal | Description | | +12v | 12 volt DC, ex. battery | | +24v | 24 volt DC, motor power supply | | Gnd | Ground | | REV sw. | Reverse switch signal 5 volt DC | | AMT pwm | Analog (or PWM) signal (speed) | | OUT | Output for H-Bridge / motor | | A, B | Motor output |
|
1 x Double latching relay
(for reversing).
1 x PNP power
transistor (like
A1264n)
(for regulating speed), with
resistor R2 (47 ohm).
2 x
BD135 NPN
transistor (for relay + inverting PWM to ground signal), with
resistors R and
R3 (330 ohm).
2 x 1N4448 diode, 75V/0,1A
(to protect the two 5 volt input signals).
1 x Large diode
(to protect the output from motor spikes and noise).
Analog (or PWM) voltage regulator separated, for motor control
In example below, now three power transistors is combined to have more amp's available for the motor.
 |
| Terminal | Description | | +24v | 24 volt DC motor power supply | | Gnd | Ground | | REV sw. | Reverse switch signal 5 volt DC | | PWM signal | Analog (or PWM) signal (speed) | | OUT | Output for H-Bridge / motor |
|
The PNP power transistor's signal is ground, therefore a BD135 NPN transistor is used to invert the signal to ground, from 5 volt DC signal.
Each power transistor output is protected by a large diode to protect the transistor from motor spikes and noise.
Resistors
R (330 ohm) and resistors
R2 (47 ohm) is to define signal voltage on the transistors.
Controlling relays or 12 volt DC equipment by 5 volt DC signalIllustration below controls digital and analog equipment from 5 volt.
The 5 volt signal could be from
Arduino PWM or digital outputs.
 |
| Terminal | Description | | +12v | 12 volt DC, ex. battery | | Gnd | Ground | | A (Left) | Output | | A (Right) | Signal, 5 volt DC |
|
The signal input is protected by a diode, also output is protected from external spikes and noise.
Pull-down
resistor (R2) on small
transistors is to ensure turning off the switch when no signal.
The pull-down resistance
(R2) must be higher than the signal resistance
(R)...
Example of the switch above to control 12 volt DC equipmentTransistor (Small):
BC547 NPN with
resistor R (330 ohm), and pull-down
R2 (10 KOhm), protected input 1N4448 diode
(75V/0,1A).
Transistor (Large):
BD136 PNP with
resistor R3 (680 ohm), protected output 1N4007 diode
(1KV/1A).
Combining 8 channels digital/analog switchIt's easy to combine multiple switches. Below is an example of 8 channels together...
Like in the example above all signal and outputs is protected by diodes.
The ground and power inputs is put together into single terminals...
 |
![[Image]](/it/robotics/16ch_5v_to_12v_sw_sml.jpg)
| Terminal | Description | | +12v | 12 volt DC, ex. battery | | Gnd | Ground | | 1..8 inputs | Signals, 5 volt DC | | 1..8 outputs | Outputs, 12 volt DC |
|
One direction motor control for Arduino 5v (PWM), Forward direction only.
 |
| Terminal | Description | | +7v | 7 volt DC, battery | | Gnd | Ground | | A | Signal, 5 volt DC (analog, digital or PWM) |
|
This simple
circuit controls a motor with an
Arduino/PWM signal
(or any 5 volt input).
The
circuit can be used for airplane or helicopters
(when reversing the motor is not used).
Example (7-9 volt source power)BD135 NPN
transistors22-47 ohm
resistorExample of a simple motor control for helicopterBased on 2x "One direction motor control" as seen above
1:
Arduino GND
(1 pin)2:
Arduino PWM Input 5v
(4 pins)3: Motor output 7-9v
(4 pins)4: Battery input 7-9v
(2 pins)5: Servo 1 output
(3 pins) (powered from battery and controlled by PWM signal)
6: Servo 2 output
(3 pins) (powered from battery and controlled by PWM signal)
See also
Robots and robotics - Robots and robotics. Electronic circuits for robot, motor control and more…
Small circuits - Small electronic circuits. Delayed power on circuit, Delayed power off circuit, A simple...
Arduino - Arduino source code examples, Arduino projects and circuits, robotic projects and more....
Electronic components - Information about electronic components
Resistor - A resistor is used to lower the voltage in an electronic circuit. Resistor color values...
Transistor - A transistor is by it self a small power inverter. NPN-transistors reacts to positive and...
LPT relay board circuits - LPT relay board circuits. Information about LPT, videos, links etc. Before we had the...
IT - IT/Technology. Various projects and information about computer technology and electronic...
mortenbs.com