Simple Motor controller and R/C signal interpreter

1218091212.jpg

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

1218091212.jpg

^^Reverse emf protection diodes across the coil

Here is the Stamp I am using to interpret the PWM signal

1218091212a.jpg

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

Schematic
Take another look at your schematic…it wouldn’t work as drawn. The transistor would conduct when turned on and basically shunt your VCC to ground. VCC needs to connect to the top of the relay, (no connection to transistor there), and the collector needs to connect to the bottom of the relay in order to take the relay to ground through the transistor. You’ll also find out your transistors will last longer if you put “snubber diodes” accross the relay coils.

If the transistors can take
If the transistors can take the short circuit current of the supply then technically the circuit would work - the relays are ‘on’ when the transistor is off, and when the transistor is turned on the relays are deprived of current, so they turn off again…
So, like I said, the circuit would technically work, but it’s going to be hell on those batteries and transistors, if they can even withstand the current loading.
Salvage’s recommendations will ensure the driver lasts much longer and wastes far, far less power.

Its actually wired like the
Its actually wired like the revised schematic I just posted, I dont know why I drew the schematic the way I did. Ich bin ein dumbkopf!

Ah, much better =)Although,
Ah, much better =)
Although, if you have enough space, the snubber diodes Salvage mentioned are still a good addition.

Theyre actually there ;P,
Theyre actually there ;P, this is the same board I used in a previous project, Ill pull the picture from that to show the back of the board, Theyre there

Schematic

You shouldn’t need the 100 ohm resistors between the relays and VCC. You’ll end up dropping more voltage accross the resistor than accross the lower resistance relay coil and could cause the relay to not pull in completely.

I’m not trying to be picky, just want instructional information to be correct…otherwise, “newbies” end up getting frustrated when something they build doesn’t work even though they “followed the directions”.

code posted
code posted

Well its funny you should

/