Stackable H-bridge for Arduino makes it possible to drive several brushed DC motors with your Arduino Uno or Mega.
There circuit is shown below:
Here is the truth table for the H-bridge. The circuit prevents illegal states that might blow up your H-bridge, but that does not still protect you against illegal transitions. When setting pin values in your Arduino code make sure your code does not allow illegal transitions, if necessary add intermediate steps where en is temporarily set high to ensure illegal transitions are avoided.
Note that enable pin is inverted and it's the only one intended to be driven by PWM signal. Driving rev or fwd signals with PWM can and will destroy the MOSFET-s.
|0||0||0||all closed||free run||none|
|0||0||1||all closed||free run||none|
|0||1||0||Q1, Q4 open||forward||Q2, Q3 going to open|
|0||1||1||Q1 open||free run||Q2 going to open|
|1||0||0||Q3, Q2 open||reverse||Q1, Q4 going to open|
|1||0||1||Q3 open||free run||Q4 going to open|
|1||1||0||Q2, Q4 open||brake||Q1, Q3 going to open|
|1||1||1||all closed||free run||none|
When enable pin is kept low at all times, the H-bridge can be used in a simplified mode where PWM is not supported. Note that free run is not possible since there is no legal way to get into that state without setting en temporarily high.
|0||0||all closed||free run||none|
|0||1||Q1, Q4 open||forward||reverse|
|1||0||Q3, Q2 open||reverse||forward|
This is how the shield would look like once soldered:
Jumper block near Arduino pins 2-11 is intended to be configured in one of three ways:
Shield#1 Shield#2 Shield#3 Arduino pin number Enable pin [o o] o o o o 11 (PWM) o o [o o] o o 10 o o o o [o o] 9 Forward pin [o o] o o o o 7 o o [o o] o o 6 o o o o [o o] 5 Reverse pin [o o] o o o o 4 o o [o o] o o 3 o o o o [o o] 2
Open Standard Firmata code example from Arduino IDE and upload it to your Arduino:
Install Pymata and run the test script from the Git repository:
pip install pymata python bridge.py
We are aware of following issues:
- Even though circuit prevents illegal states that might blow up half bridge by opening P-channel and N-channel MOSFET simultaneously changing the direction in your Arduino program without turning off the enable pin for that moment will blow half of the bridge.
- Once soldered carefully clean the soldering flux with detergent (eg. handsoap and toothbrush) and afterwards rinse it with alcohol. Once dried cover the tracks leading to MOSFET-s with insulation lacquer. This will prevent motor induced breakdown voltage from damaging the circuit.
- Socket strip connecting shield to Arduino might not be very durable. Use Super Attak to attach socket strips and terminal block to the shield PCB.