I had an idea tonight that is either inspired... or stupid. Please help me determine which. ; j
I was thinking about using one of my new Picaxe-08 processors for a project. They only have 5 I/O ports, three of which can be either an input or an output. However, for my project, I wanted to be able to control two motors and two sensors. Since traditional dual H-Bridge designs would require four processor outputs to control two motors with forward and reverse, that would leave only one I/O port left. Boo hoo.
I began to wonder if there was a way to control two motors in forward and reverse with only three outputs. I first thought of a simple Y-shaped circuit, which would have the motors sharing a common connector. After monkeying with the idea and reviewing some H-Bridge designs, here is what I came up with:
I did not bother with flyback diodes for the back EMF for now. I just want to see if the circuit would work conceptually. If so, I'll look at practical matters like that.
The logic table for this circuit is below. Note that the output at the top-right of the diagram is an inverted copy of Output 3.
If I haven't overlooked something, this circuit would allow a robot with two motors to drive forward, reverse, spin left, spin right, or reverse to one side. The bottom two logic input settings would result in a condition where two or more transistors in the same leg of the circuit would short out power to ground, and should be avoided.
OK, folks. Fire away! What did I miss?
Based on Telefox's modification, I have updated the circuit diagram. I have also added base bias resistors and protection diodes.
Here's the logic table for the circuit.
I decided to call this circuit a "dual Y-Bridge". One "Y" is turned on when you enable the "Reverse" line. The other "Y" is turned on when you turn on "Forward_1" and "Forward_2".
In practical application, I'd like to add some logic to make sure the dangerous states are never applied and make this a "smoke-proof" bridge. I'd also have some noise supression capacitors on the motors.
After testing my own and Telefox's "smoke-proof" circuits, we came to the conclusion that they were not working. The good news is that the 2n2222A transistors seemed capable of surviving the short condition I was trying to protect against. Therefore I will just leave the protection circuit out.
Here are some current results for the circuit, using 4xAAA batteries as the supply.
- One motor forward: ~130mA
- Two motors forward: ~240mA
- Two motors reverse: ~220mA
- Reverse + one motor forward: ~610mA (transistor short condition)
- Reverse + two motors forward: ~850mA (transistor short condition)
The 2n2222A transistors I used are the high current version of the 2n2222. They seem to withstand the abuse of being shorted.
Here's the Y-Bridge implemented on a Picaxe-08 Protoboard.
- Six (6) pn2222A npn transistors
- Six (6) 1n4454 diodes
- Two (2) 1n4006diodes
- Six (6) 1k ohm 1/8 watt resistors
- Assembled Picaxe-08 Protoboard
- Assorted wires, header pins, etc.
Although the initial layout went very well, I ended up having to get creative to provide all the contacts I needed for the motor output pins. I used cut off pieces of component lead to fit into the same contact hole as the Q1 and Q5 emitter leads. This was a pretty ugly hack, but it worked.
You can see the Y-Bridge implemented on Blind Lemon.