Okey Dokey,
What I Have here is a relatively simple way to control 2 low to mid current motors with no fancy integrated circuits. This is just a nothing special H-bridge design, but I haven't seen much on the subject here, hence the post!
Excuse the "Paint" schematic
This H-bridge I have coupled with a Parallax BS2 to interpret a PWM (Pulse Width Modulated) signal coming from a Radio Control Receiver ( Will post code tomorrow, on a floppy at my school :D ) and spit out a combination of four outputs to engage the relays in a certain combination, reversing the polarity on one side of the motor at a time. The output states are as follows:
DCBA
0000 - Stop
1001- Forward
1010 - Left
0101 - Right
For every One you see, the corresponding relay in engaged, providing contact to the Normally Open ( NO) contact point, therefore allowing current flow to the motor, putting it in one direction. Each motor is tied to two of the outputs (the Common pins on the relays) Motor One in tied to outA and outB, motor two is tied to outC and outD.
For simle operation of one motor you have 4 logic states:
AB
00
01
10
11 (not used, no need!)
When inA in low, outA is connected to ground, When inB is high, outB is connected to the positive, therefore the motor will turn in one direction. The same is true with motor 2.
Here is a picture of the finished board
^^Reverse emf protection diodes across the coil
Here is the Stamp I am using to interpret the PWM signal
I will post the exact code after the Holiday recess, but I can explain the operation!
Basically (hehe, its in pbasic, basically, get it? .......Crickets) The stamp is sampling the signal using the PULSIN command, it then stores the width valued in as a decimal value in a word variable. Then there are some conditional inequalites that say "if word var 1 is >700 then FWDsub". When the reciever is recieving a signal for a dead stick, it is receiving a pulse that has a value of ~750 microsec, it stays there as long as you don touch the stick, if you push one channel forward, the value decreases, and visa versa. So Four conditional statements control the program path, 2 per channel, one for fwd and reverse. GOT IT??? I know its not plug and play, but the satisfaction of doing it yourself is so much better than buying a motor controller... for me any way.
Code coming soon!
**Schematic fixed, thanks for catching!
Happy Holidays!
CODE:
'{$STAMP BS2}
input 10
input 12
output 0
output 1
output 2
output 3
x var word
Channel2 VAR word
Channel1 VAR word
Status:
pause 125
high 0
high 1
high 2
high 3
PULSIN 12,1, Channel1
PULSIN 10,1, Channel2
If Channel2 < 700 then Forward_direction
If Channel2 > 850 then Reverse_direction
If Channel1 < 700 then Left_turn
If Channel1 > 850 then Right_turn
GOTO Status
Forward_direction:
low 0
low 3
goto Status
Reverse_direction:
low 1
low 2
goto Status
Left_turn:
low 0
low 2
goto Status
Right_turn:
low 1
low 3
goto Status