Home Page

Using Thrusters With Props Controlled by a Joystick

The problem with bilge pumps is they are less efficient than props, each pump can only push in one direction, and they have gotten expensive.  If you use motors with props you can build an ROV with just three thrusters, one on each side and one for up and down movement.  The down side is that you will have to do considerably more work in order to mount a prop onto the thrusters and mount the thrusters onto the ROV.   Turning the thrusters on and off and reversing their direction is not complicated if you use 4 relays and 4 buttons, but controlling the thrusters from a 4-switch joystick like the old Atari Joystick is a real nightmare if you only plan to use relays.  It can be done but its was going to require 28, DPDT (Double Pole Double Throw) relays.  You would be able to improve on the relay circuit design, especially using relays with more Throws, but its still going to be a bulky mess of switches and wires.

The answer is to use 6 relays and a hand full of digital logic chips to interface the Joystick to the relays.  Provided 2 of the thrusters are each mounted on the sides of the ROV, and both thrusting front to back with the third thruster mounted in the center and facing up and down to control altitude, the following should work well for controlling the two forward and reverse thrusters.    From the diagram below you can see that when the joystick is pushed forward switch A will be on and  both the left and right thrusters should be turned on and pushing forward, but when the stick is moved a bit to the right, both switch A and switch B will be on.  In that event we want the left thruster to push forward and the right thruster to be turned off.  This will allow for forward movement but with a turn to the right.

Key:  LeftMotor-RightMotor
         Rv = Reverse
         Fw = Forward
         A,B,C and D = Switches on the Joystick
 
             Fw-Fw
      Off-Fw   A   Fw-Off
   Rv-Fw   D       B   Fw-Rv
      Rv-Off   C   Off-Rv
             Rv-Rv
 

The first step is to create a Truth Table that shows all possible combinations of the 4 Joystick switches. We'll ignore the up and down switches because they are triggered buy 2 independent switches on the joystick.  Both the left and right thruster will each be controlled by two relays.  One relay will run the thruster forward and the other will run it in reverse.  So the Truth Table has 4 switch inputs labeled A-D and 4 outputs labeled Left Forward, Left Reverse, Right Forward, and Right Reverse.  A 0 or 1 indicates the the input or output is either off or on.

Input from Joystick switch Output to Relay
A B C D   Left Forward Left Reverse Right Forward Right Reverse
0 0 0 1     1 1  
0 0 1 0     1   1
0 0 1 1     1    
0 1 0 0   1     1
0 1 1 0         1
1 0 0 0   1   1  
1 0 0 1       1  
1 1 0 0   1      

The next step is to convert the outputs in the Truth Table to Boolean Equations.  For example for equation for the the Left Motor would read like this: The Left Forward Relay is on when the switch B is on and A, C, and D are off, or when switch A is on and B, C, and D are off, or when switch A and B are on and C and D are off.   The shorter and standard way of writing this is to use the asterisk  for the word "and", a plus sign for the word "or" and a line above the variable for the word "not", but we will use a slash "/" before the variable instead.   The formula would then be:
Left Forward = /A*B*/C*/D + A*/B*/C*/D +A*B*/C*/D  
Using a few of the rules of Boolean Algebra, this would then reduce to:
Left Forward = /C * ( A*/B*/D + /A*B)

Remember your 8th grade Algebra teacher when she told you that you would use algebra every day for the rest of your life?  Bunk! Just download a free program to do this work for you. kmap12.exe from www.puz.com/sw/karnaugh uses K-maps to resolve truth tables and is very easy to use, or better yet, you can get Karnaugh Minimizer from http://karnaugh.shuriksoft.com and it will even generate the schematic as seen below.

Using "Karnaugh Minimizer" program we simply fill out the Truth Table for the Left Forward Relay

Click Ok and the program will fill in the K-map.  Then click "Go" and it generates the formula.

Finally select Tools, "Formula => Schematic", and select the type of logic gates you want to use.  We have the choice of using "AND and OR" gates which will require us using both types of chips, but we have the choice of using only "NAND" gates.  You should know that it is possible to build any digital circuit out from NAND gates only which means you don't have use but one type of chip.  However most of the time you'll need more gates and connecting wires.  The schematic for the Left Forward Relay is displayed using each method, and it's clear that we are better off using just NAND gates for this circuit.  It might me nice to sit in a class for a few months to learn how to do this by hand.... Wait! No it won't, I did that and I could kick myself now.  Just use the software!

AND and OR gates

The lines above the letters C and D indicate a "not" gate. If you send voltage, or 1 or an "on" to a "not" gate the other side of the gate will be "off" or no voltage, or 0.   And likewise a 0 will be flipped or inverted to a 1.  So after the switches go through the appropriate "not" gates they enter the "and" gates. The "and" gate will output a 1 only if all of the inputs are 1.  Finally the output from each of the "and" gates goes into an "or" gate.  The "or" gate outputs a 1 if any of the inputs are 1.
NAND gates only

This circuit does the same thing as the "AND and OR" circuit, it just uses "nand" gates.  The "nand" gate is the same as an "and" gate that will output a 1 only if all of the inputs are 1, except a "nand" gate then flips the output.  So if all 3 inputs to a "nand" gate are 0, then the output will be 1.

So here are the schematics for each of the 4 relays using NAND gates.  Remember there is 1 Left and 1 Right thrusters, 2 relays per thruster, 1 for forward and 1 for reverse.  There is also an Up/Down thruster, but that is a separate and easy problem that does not need a digital circuit.

Left Forward = A*/C*/D + B*/C*/D

Left Reverse  = /A*/B*C + /A*/B*D
Right Forward = /B*/C*D + A*/B*/C
Right Reverse = /A*C*/D + /A*B*/D

 

Basically the circuits for each of the 4 relays are the same.  The only thing that changes is the inputs and whether they are are inverted or not. The "not" is actually a gate itself.   If you send voltage, or 1 or an "on" to a "not" gate the other side of the gate will be "off" or no voltage, or 0.   And likewise a 0 will be flipped to a 1.  So after the switches go through the appropriate "not" gates they enter the "nand" gates. The "nand" gate is the same as an "and" gate that will output a 1 only if all of the inputs are 1, except a "nand" gate then flips the output.  Finally the output from each of the "and" gates goes into an "or" gate.  The "or" gate outputs a 1 if any of the inputs are 1.

The next step is to make sure it works as expected.  You could skip this step, but it's a lot of fun! Okay, not a lot of fun; but it is cool.  You can download a small freeware program called "Digital Works" written by D. J. Barker at the University of Teesside. And Bob Brown of Southern Polytechnic State University has written a quick tutorial:  www.spsu.edu/cs/faculty/bbrown/circuits/howto.html.

The schematic below models the relay control circuit.  You can download the relay_schematic.dwm file, open it with Digital Works and test the circuit.  You just have to remember that the combinations of switches A and C, and the D and E are not possible with the Joystick.  I am also still ignoring the Up and Down thruster part of the schematic.

It's time to go shopping!  There are lots of suppliers for electronic parts, like Circuit Specialists from my old stomping grounds in Mesa, Arizona. http://store.yahoo.com/webtronics/index.html  Check www.allelectronics.com for the more unusual and sometimes very cheap items, like boxes and relays.  But the parts below are all selected from Mouser www.mouser.com, but Jameco is another good source www.jameco.com

14 pin CMOS Chip with DIP Pins on .1 inch centers

The first time I order my parts I got the wrong type so here are some things to look for.  Get CMOS (Complimentary Metal Oxide Silicon) chips and not TTL (Transistor / Transistor Logic) chips.  TTL use more power and must have 5 volts where as CMOS chips and work directly off a 9 volt battery.  The only down side is CMOS chips are more easily damaged by static electricity.   There are two flavors of CMOS chips.  Chips numbered like "CD40XX" use metal gates, and work with 2 to 15 volts.  Try to avoid chips like "74CXX"  which use silicon gates and work with 2 to 6 volts. For more details see this site: www.solarbotics.net/bftgu/starting_elect_ic.html  The chips also come with either SOIC, SOP or DIP type pins, and you want DIP.  DIP pins will stick through the prototype board and get soldered on from the bottom side.  The other types are for surface mounting.  The pins should also be .1 inch on center which is the default for most chips but important when buying the prototype board.  Most chip cost about 25 cents, but you can pay up to 1 or 2 dollars and get a chip designed to work with more "noise" or static on the line.  I think its a worth while investment since I am an amateur builder and because this circuit is going to be driving relays with much more power.

 

The "NOT" gate is also call an "Inverter" and this one is a Hex Inverter because it has 6 NOT gates.  We only need to use 4, so it will do just fine.  At 25 cents each we can afford to not use 2 of the gates.

Qty: 1  CD4069U
Mouser Part Number: 512-CD4069UBCN Fairchild CD4K CMOS Logic DIP--14 Inverter Circuits
or 512-MM74C04N with high noise immunity.

Triple Input NAND with 3 gates.  We need a total of 8, triple input gates so we need 3 of these, giving us one spare gate, which we could use as a 2 input NAND gate by simply wiring two of the three inputs together.

Qty: 3  CD4023BCN
Mouser Part Number: 512-CD4023BCN Fairchild CD4K CMOS Logic DIP-14 Trp 3-Inp NAND

We need a total of 4 NAND gates with 2 inputs.  This is has three, but we have one unused triple input gate not that we can convert to a 2 input gate by just wiring 2 of the 3 inputs together. So we only need one of these.

Qty: 1  CD4011BCN
Mouser Part Number: 512-CD4011BCN  Fairchild CD4K CMOS Logic DIP-14 Qd 2-Input NAND or 512-MM74C00N with high noise immunity.   Note that these ic's use different input and output pins, so be sure you use the right diagram for the one you buy.

CD4011BCN

 

 

 

 

 

MM74C00N

Octal Buffer Line Driver Line Receiver 3-State

The NOT and NAND gates provide the output signal of 1 or 0 for each relay that we need to turn on and off, but the amperage required to make the coil on the relay work is higher than the 7 mA ( 7 Milliamp = .007 Amp) that will flow through the digital logic circuit.  A Line Driver is needed, which actually works the same as a relay.  When power is applied to the input, the corresponding output turns on, but it outputs a higher current of 35 mA and voltage up to 7 volts DC  and connects that Output pin to the ground.  So the coil on the relays will already be powered from the battery and the drain from the coil will be connected to the output pin of the line driver where it will be connected on to the ground when the input is "on" in order to complete the circuit from the relay's coil.  The energized coil on the relay will then close the 3 - 30 amp switch inside the relay which will complete the circuit to the thruster.  So the digital logic, triggers the line driver, which triggers the relay, which turn the thruster on.  If the reverse relay is triggered the thruster runs in reverse, and if the forward relay is triggered it runs forward, of course.

Qty: 1  MC74HC244N
Mouser Part Number:  511-M74HC244 Fairchild High Speed CMOS (HC/HCT) Logic
DIP-20 Octal 3-STATE Buffer

 


Resistors -- It will be necessary to add a hand full of resistors to the circuit in order to pull-up the gates.  "pulling-up" is simply providing a very small voltage to a gate in order to get it to flip on.  When a switch in triggered on the Joystick the voltage is more than enough to override the pull-up voltage.  It's easiest to just buy an assortment of resistors, but at least get a dozen 500 ohm.
 

Unless you are very confident in your skills, you will want to have a bread board so you can test assemble all of the parts and make sure it all works.   A breadboard has friction fit holes on .1 inch center which allows you to easily test and correct the connections.  The photo shows a test of the Inverter gates.

 

A proto board with holes on .1 inch centers will allow us to mount the IC's and help us make the needed wiring connections.  A 3.75" square board should have more than enough room for the IC's and can be housed in a box beneath the bottom of the Joystick.

Qty: 1
Circuit Specialists: PC462903

You can optionally get sockets for the ic chips and solder these onto the proto board.  Doing so will prevent accidentally damaging the chips from excess heat and will make replacing a chip very easy.

Qty: 5 - 14 pin, 1 - 20 pin
Mouser Part Number: 14-3518-10 and 20-3518-10

Qty: 6 DPDT Relays, 4 for the left and right thrusters and 2 for the up and down thruster.  The Relays will be housed in a water proof container down on the ROV, and only a small 6 conductors computer network cable will deliver the single to the relays.  The amperage of the relays will depend on the size of the motors they control, but the coil needs to be triggered with only 9 volts but 12 volts will do if you power it from a couple of 9 volt batteries. The important thing is to make sure it will carry enough amps without burning up.  A small bilge pump motor will pull just over 2 Amps, and possible more if it is converted to a prop thruster and the prop is too big.  If that is the case the you are likely going to burn up the motor. Check www.allelectronics.com and www.alltronics.com for these.  They will cost about $1.50 each.

Other items needed:
1) wire
2) a prototype breadboard and some led's for testing
3) a prototype solder board
4) solder and soldering iron
5) solder wick (braded copper wire used to soak up excess solder)
6) a box of some sort to house the completed board
7) 9 volt Batteries and clips with leads
8) Non-conductive Epoxy Potting to coat and water proof the board (Optional)
9) Lots of patience

Note:  It's a good idea to order 2 of everything if you have the budget for it.  This allows you to build your solder board without disassembling your breadboard and you'll have spare parts should one get damaged.
 

 


Circuit Wiring Diagram

Drawing up a wiring diagram can be done while waiting for the parts to arrive.  The diagram shows where each wire connects to each chip.  In addition to the wires shown, each chip also will have a connection to the power supply which is a 9 volt battery.  The positive will connect at the pin marked VCC and the negative to the pin marked "Ground". Pull-up resistors are also not show.  I'll work out where those are needed when putting it together on the breadboard.

It took 3 tries to get it working on the proto board.  I did not notice that the two different 2-Input NAND gates I found and purchased actually have different pin assignments.  I also added a 500 ohm pull down resistor to each of the 4 inputs to the NOT gate.  In the photo, I have one of the test LED's being powered through a 10 amp DPDT relay that uses a 6 volt coil.

The next step to to move all of this to a solder board.  Here is where it pays off to have purchases 2 sets of the parts so you can build and troubleshoot the real board by comparing it to your bread board.  Sockets for the ic chips will help too, but they are also optional.  After several hours I finally had the board finished.  It's powered directly from the 9 volt battery which also supplies the power for the relays.  There are 2 sets of leads; one set goes to the joystick switches and the other to the relays.  There is 1 wire for each switch or relay and one ground wire in each set.  

Water Proofing

The next step will be to pot the entire board in epoxy in order to make it waterproof and then attach it to the base of the joystick.  You can buy non-conductive epoxy that is intended to water proof and also hide your circuit design from others.  It actually does the former very well and the latter hardly at all as all epoxies can be chemically removed with epoxy stripper.  It's not like we've invented a cruise missile guidance system here anyway.    I used off-the-shelf 5 minute epoxy for plastic from the hardware store.  But be sure and test a dry sample of your epoxy with an ohm meter, just to make sure it really is non-conductive.  After covering my board I waited 24 hours and tested to board only to find that nothing worked.  I nearly cursed God and died, but fortunately tested it again after 48 hours and everything was working perfectly.  God be Praised!

Connecting Circuit to the Relays

There is not much magic required with the relays.  The wiring diagram below shows a pair of relays for one of the motors, with the Forward Relay switched on.   Most of the time when you see 2 relays used to run a motor in forward or reverse. One relay will be used to turn the power on and then it feeds through the second relay than has the ability to crisscross the wires in order to reverse the motor.  Because the logic circuit has one output for forward and another for reverses and because both should never be on at the same time, we can have each relay power the motor on its own.  This will actually help conserve the 9 volt battery because we only power a maximum of 3 relay coils at any one time.  DPDT or Double Pole, Double Throw relays like the one in the photo have terminals that are normally on.  In the photo there is a small black wire attached to the "normally on" or "normally closed" terminal.  Since the "normally closed" connection will not be used for this design we could use SPDT or Single Pole, Double Throw relays if desired but the DPDT were on sale.

 

Now that the electronics are ready to go it time to get BOB some new thrusters built so the circuit can be wired up and tried out at the lake.