Picaxe Rov

fizzit

Member
I have an ROV right now that uses 3 H-bridge relays to control two horizontal motors and a set of 2 vertical motors. My control box basically just has buttons to switch the relays on and off. What I want to do is switch the ROV to picaxe control, with a Picaxe on each end communicating serially. My problem is, I want to make it so I can have proportional PWM control on all the motors, forwards and backwards. This, I believe, requires 6 PWM outputs if I replace the relays with MOSFETs which is the only thing I can think of to do. Here are my questions:
1. How could I drive so many motors proportionally with so few PWM outputs?
2. Can I communicate through the Serout/serin pins while possibly operating a servo (for the camera) and operating the motors?
3. What would be the best picaxe project board to build this on (or will I have to make my own custom PCB)?
4. What picaxes would be best suited for each end?

Sorry if these questions have been answered, I thought I searched well. Thanks in advance!
 

kam

Member
Some possibilities

Hi,

Cool project. my thoughts and additions are:

1) Is it possible to PWM on Mux demux chips or shift registers? if so then you would be able to use 1 PICAXE pin and drive 3 or 4 motors at the same time or with some combination.

2) I think you can PWM or servo two pins at the same time, but I'm not sure if you can take input commands too, unless we have a serial interrupt coming in... i mean if we know that there's a motor being run at a paticular time then in the motor run subroutine we can enable a pin0 high interrupt. Pin0 being the serial In. Then on the transmitter side we send a high everytime. Suppose it could work. again a read of the parallel processes would be better

3) I'd go for a breadboard, its the cheapest and most flexible way.

4) I guess you're using a wireless link so on the transmitter side you only need a small chip depending on the inputs you have and the outputs I'd assume would be a serial out to the wireless section and maybe a few other for LED or something.

On the Receiver side you'd need a serial In and few PMW's and then you'd have a some inputs for sensors etc.

So, I'd go with the 14M or 18X on the transmitter (just in case)

& a 28X1 or 28X2 depending on the taste...

28x1 gives you 4 Hpwm and 1 normal pwm


Just a thought, have you considered using another PWM module? I know there are some with i2c inputs...

http://www.sparkfun.com/commerce/product_info.php?products_id=8897

http://www.mindsensors.com/index.php?module=pagemaster&PAGE_user_op=view_page&PAGE_id=42

that way you can give a command to the servo board on i2c and dont have to worry about delays in taking your next input.

or It'd be interesting to build one! :D

Hope it helps.
 

goom

Senior Member
What about using 3 Picaxes (-08m's would be adequate), each receiving an analog signal (0 to 5V) via potentiometers on your control box.
Each Picaxe would feed out a PWM signal depending on the analog input, and drive the motors via a MOSFET. Additionally, each Picaxe could activate or deactivate the existing H-bridge relays to provide forward an reverse depending on whether the voltage was above or below 2.5V.
The same relay activation logic could be used to branch the program to give a 0 to 100% duty cycle for the PWM with 2.5 to 0V (reverse motor operation) or 2.5V to 5V (forward operation).
This, of course, assumes that you are keeping a wired link between control box and ROV.
 

kam

Member
Interesting...

That could do. If you want to go wireless, you could always use another 08M on top of that and have that connected to the wireless module... then send a serial command that could be parsed and then each drive chip works accordingly...

But I think it be best if you get the wired system working first, get the basic idea going... wireless can always be added later on.
 

goom

Senior Member
Or do what was suggested by kam, but through wires. You would only need 2 wires between control box and ROV rather than 5 (5V, 0V and 3 analog signals) as with my suggested approach.
Digital communication may be more precise.
I suppose that if the sending Picaxe (in the control box) sent a different qualifier for the data pertaining to each motor, there would be no need for another Picaxe to parse the data since each would ignore all but data preceded by the correct qualifier.
 

kam

Member
Nice Goom!

Think you hit it!

Thanks for the input.... we certainly learn alot by discussion.

:)
 

fizzit

Member
I'm somewhat confused... are you suggesting that in the control box I have a single microcontroller with the serial out pin connected to multiple PICAXE's serin pins on the ROV, and these would drive the motors? If I use a set of 4 MOSFETs for reversible PWM on each motor, I would need two PWMs per motor, and if I use the H-Bridges, then I would need one PWM for one MOSFET and 2 outputs to control the relay.
 

D n T

Senior Member
Wireless comms

I have the same type of situation and have been trying to workout the problems with radio comms, although I want to send multiple variables in each packet, ie qualifier, b0, b1,b2...b10. I have started with one variable and am still ironing out issues, so be careful and patient, get your wired right before you go wireless.
The idea of a dedicated PICAXE chip for the transmitter and reciever is probably a good thing.
By dedicated I mean the "mother chip" sends all the data it wants sent, to the transmitter chip and when it has enough it transmits, it might only need one variable.
Same with the reciever, it doesn't process the signals until it gets a valid one, then it passes the data to the "onboard mother chip".

Thiswill also give you a lot more programming options, and perhaps less noise, I don't know, just a thought.
 

goom

Senior Member
fizzit,

Regarding the driving of each motor from its dedicated Picaxe:
If you retain the relay H-bridge, then you will only need 2 lines from the Picaxe:
1. Assuming one side of the relay coil connected to +5V (or whatever voltage it needs), connect it to 0V via a MOSFET, with the gate driven by the Picaxe output. A high output turns the relay coil on, and a low output turns it off. Don't forget the diode to dissipate reverse voltage spike. This gives your forward/reverse function.
2. A PWM signal feeding a MOSFET which modulates the power going to the motor (via the relay contacts). You may well need a driver between Picaxe and MOSFET depending on its characteristics and the current (search for other threads on this topic).
I you want to replace the relay with an electronic H-bridge (which basically consists of 4 MOSFETS or transistors), what you do will depend on the H-bridge that you use. If, for example, you used an LMD18200, you would need one line for the PWM and one digital output for direction control.
Another option would be to use a commercial speed controller. The Picaxe interface would depend on which one you chose. A Forum search on speed controllers should yield some useful information.
 

fizzit

Member
fizzit,

Regarding the driving of each motor from its dedicated Picaxe:
If you retain the relay H-bridge, then you will only need 2 lines from the Picaxe:
1. Assuming one side of the relay coil connected to +5V (or whatever voltage it needs), connect it to 0V via a MOSFET, with the gate driven by the Picaxe output. A high output turns the relay coil on, and a low output turns it off. Don't forget the diode to dissipate reverse voltage spike. This gives your forward/reverse function.
2. A PWM signal feeding a MOSFET which modulates the power going to the motor (via the relay contacts). You may well need a driver between Picaxe and MOSFET depending on its characteristics and the current (search for other threads on this topic).
I you want to replace the relay with an electronic H-bridge (which basically consists of 4 MOSFETS or transistors), what you do will depend on the H-bridge that you use. If, for example, you used an LMD18200, you would need one line for the PWM and one digital output for direction control.
Another option would be to use a commercial speed controller. The Picaxe interface would depend on which one you chose. A Forum search on speed controllers should yield some useful information.
My current H-Bridge relays have two coils... one for reverse, one for forward. I could do what you say and switch to DPDT relays and wire them as H-Bridge. That would probably be the easiest solution. Then, I believe I would need a single Picaxe 28X1 on the ROV to control all three motors, correct?
 

goom

Senior Member
Since you already have the relays, and are presumably proven, why not just use another Picaxe pin (and transistor driver) to activate the other coil. I would put a motor shutdown (0 duty PWM) and a pause (1/2 second?) when going from forward to reverse or vice-versa. This would eliminate the possibility of both coils being active at the same time, and prevent relay contact arcing since they would switch at zero current. Also easier on the drive train. Since the relays have 2 coils, are they the latching type? If so, you would just need to send a pulse to the coils rather than keeping them constantly energised (hence reducing power consumption).
I don't believe that any Picaxe can symultaneously output 3 PMW's at different duty cycles (but would love to be proven wrong). Hence my suggestion of 3 x -08M's.
 

Wrenow

Senior Member
Another, totally different, solution that would be terribly simple is to use standard hobby electronic speed controls (ESC's) for each motor. (Goom also mentioned commercial speed controllers).

Then you can control them fully proportionally, and, with the right ESC, in both directions. There are controlled with a standard old servo pulse signal.

Of course, price depends a lot on what type of current draw you are controlling - a large capacity ESC can be a bit pricy (50-100 quid or more), while one rated for a motor that draws only 1A at full stall can be had for under USD$10 (The Vex has both fwds and rev, and is pretty handy and small). Handy sources depend on where you are located - if you are in the UK, MTroniks makes a dandy range (we use them a lot in RC Model Warship Combat in the US and in Oz). They are waterproof and pretty darned reliable when set up properly.

If you decide to go this route, you might want to read the article "ESCs Lessons Learned" in the How To section of the http://www.ntxbg.org web site.

You will probably want a "car" type ESC if you are wanting both fwds and rev - many air types only go in one direction, of course.

It is pretty simple to send a servo signal out to control 3 different motors that way - in fact the fine people at Rev-Ed already have a board specifically designed to do this (or to control 3 servos) with an 08M.:) The http://194.201.138.187/epages/Store.storefront/?ObjectPath=/Shops/Store.TechSupplies/Products/AXE024 - and it works a treat!

Cheers,

Wreno
 

fizzit

Member
Wow! Thanks for all the opinions! I have a few questions/statements:
1. Unfortunately, my motors draw up to 4 amps (estimated) on average.
2. Wouldn't a breadboard be inable to carry such high currents?
3. I would like to use speed controllers, it would really make things a lot easier, but I'd rather not pay more than $40 because I can get 3 MOSFETs and 3 DPDT relays and another PICAXE for less than $15.
I am in the US, so unfortunately I can't get that speed controller :(

I can get new relays for crazy cheap so I'd rather just get three new DPDTs and wire them to be H-Bridge than use 3 more output pins for the two-coil relays.

Oh-one more thing-it was somewhat unclear to me. If a PWM pin is in use on PWM, can I still recieve serial inputs?
 

Wrenow

Senior Member
Wow! Thanks for all the opinions! I have a few questions/statements:
1. Unfortunately, my motors draw up to 4 amps (estimated) on average.
2. Wouldn't a breadboard be inable to carry such high currents?
3. I would like to use speed controllers, it would really make things a lot easier, but I'd rather not pay more than $40 because I can get 3 MOSFETs and 3 DPDT relays and another PICAXE for less than $15.
I am in the US, so unfortunately I can't get that speed controller :(
1) When getting an ESC, (and you other circuit considerations, for that matter), you really need to look at your stall draw (maximum draw), not estimated average draw. Sounds like you are using 550, Speed 600 or larger motors. A 550, which may only draw a couple of amps in free spinning, or even under light load, can draw closer to 90 amps on stall.

2) Not sure how many amps a breadboard can draw.

3) Of course you can get the MTroniks in the US (I bought mine here). However, the best price currently, if you are in the US, is from some of the Hong Kong dealers like RCMart.com. http://www.rcmart.com/catalog/motor-brushed-c-293_51.html

Now that I know you are in the US (you might want to update your profile to indicate generally where you are from - state at least), if going in reverse for long periods is not critical, I might recommend the Polks Hobbies house ESC. http://store.polkshobby.com/scripts/cgiip.exe/WService=takestock/itemdet.html?itemnum=PLK00100&conum=002
It is rated for a 100A load and is only $20. As I recall, it only gives you reverse for 10 seconds at a pop, but I am thinking that might not be critical for you. It is not waterproof, (probably not important to you , but is a requirement in RC Warship Combat) of course, but you can waterproof it by taking it apart and coating the circuit board.

Good luck,

Wreno
 

fizzit

Member
I am actually using modified Rule bilge pumps with propellers, which are rated for 2.5A normally but when modified they draw more, but I doubt they could survive drawing that much... I don't know, though.
 

papaof2

Senior Member
Brushed DC motors have a very high stall current. Even the battery powered children's ride-on toys that run for a couple of hours on an 8 AH battery have a 30Amp circuit breaker to protect the motors and wiring when a kid runs into a tree and keeps his foot on the "gas pedal".

I did some testing of current draw by substituting a smaller circuit breaker (12A instead of 30A). The car can carry two kids (~100lb) on level surfaces with no problems. However, the 12A breaker trips in a second or so when the same load starts up a 15 degree slope.

Assume that the stall current of your motors is a minumum of 20 times the running current (2.5A running, 50A stall) and may be much higher.

"I doubt they could survive drawing that much" - that's the reason for proper sizing of a fuse or circuit breaker ;-)

John
 

goom

Senior Member
I have used a cheap oriental ESC on a power boat with a fairly high performance 550 sized motor drawing perhaps 10A at 7.2V during normal running. No problems to date, and it is waterproof. An ebay link follows, but I have seen them for around $30 (including shipping) as a "buy now".
http://cgi.ebay.com/Marine-50A-Speed-Controller-ESC-RC-Boat-Waterproof-U_W0QQitemZ180361048436QQihZ008QQcategoryZ140972QQssPageNameZWD2VQQrdZ1QQcmdZViewItemQQ_trksidZp1638Q2em122
If you go the MOSFET/DPDT relay route, you will certainly need MOSFET drivers for the current level that you indicated. You will also need transistor drivers for the relay coils since Pixaxe pins can only supply 25mA.
Since PWMOUT/PWMDUTY runs in the background, I do not see any particular reason why serial inputs cannot be received at the same time.
 

Wrenow

Senior Member
Goom,

That particular ESC appears to be the Proboat or a knock-off. It is, indeed waterproof (a good thing), but if it is the Proboat, or an accurate clone, there are a couple of things to consider, which may or many not be important in a given application (they make it less suitable of RC Model Warship Combat, for instance).

1) The reverse range given is not the same as the forwards (something like 50% as I recall).
2) The endpoints have to be reset each time you power up (which is great for some uses, but when you have a limited speed under the rules, this means you really need a radio which can be set to full for setting and reduced range for actual running, and is a pain in the ankle).

Fizzit,

If your ROV is going to be using bilge pumps, it is then going to be underwater? You WILL want waterproof ESCs then. Or, once you build you own (harder than you might think at the power levels you are going to want) you will need to waterproof everything yourself thoroughly. Them kind of electronics do no lika da wet.

The MTroniks range, properly sized to your motor's stall current, would be a good choice, but are not excessively inexpensive. Expect to spend $40-$90 each even from RCMart. The Viper series is good.

A bonus, the MTroniks provide a BEC (only use one of the three - disable the other two by disconnecting the red wire - you have read the article on ESCs, right?), which will provide 5v for the Picaxe circuit.

Cheers,

Wreno
 

fizzit

Member
Yes, I read the article. That was pretty helpful :)
Yeah, I forgot to say, it's underwater. However, unless something goes catastrophically wrong, they won't get wet, seeing as they'll be attached near the top of a 4-inch ABS pipe. It would need to get a lot of water in it...
I'll wrap them in electrical tape or silicone seal them to keep errant drops of water from getting on them if it goes upside down.
 

goom

Senior Member
Wrenow,
Yes, it sure looks identical to the Proboat ESC.
The "instuctions" that I received did not mention anything about travel setup, so I have never tried it. Out of the box, it gave full forward and reverse. I actually used my transmitter (Spektrum DX6) to limit the reverse speed. I think that it might do quite well in one of your combat ships or in the subject ROV.
All I can say is that it worked for me with no problems in a small 1/12 scale raceboat (Miss Canada II) with a 27 turn Trinity P2K motor at 7.2V drawing perhaps 20A maximum.
That's more than I can say for a homebrew Picaxe controlled ESC that I built for a large (7ft length) model icebreaker. A "friend" did some soldering using a solder gun, and fried the MOSFET driver on all 3 ESC's with a voltage spike. This is a relatively low power application. I agree with your comment about homebrew high power ESC's. I would go with a commercial unit every time for 3A+ currents.
 

Wrenow

Senior Member
Yes, I read the article. That was pretty helpful :)
Yeah, I forgot to say, it's underwater. However, unless something goes catastrophically wrong, they won't get wet, seeing as they'll be attached near the top of a 4-inch ABS pipe. It would need to get a lot of water in it...
I'll wrap them in electrical tape or silicone seal them to keep errant drops of water from getting on them if it goes upside down.
Have you met Murphy? Or Sod? They would tell you that,
1, Your container WILL leak, no matter how you try to seal it.
2) Your container WILL invert if you put your circuit at the top to keep it dry.
3) It WILL do both only when it is most critical for you (a function of the criticality sensor built in to all projects).:eek:

Seriously (well, I was serious, just trying to do it humorously), electrical tape won't cut it if really accidentally immersed in an underwater situation. Especially at any depth at all. Liquid electrical tape will eventually delaminate and allow water in. Some silocone seals will work OK, depending on surface prep (but you need to get one that is compatible with electronics) 0 might be better of with a silicone conformal coating made for electronics - but make sure you do any required surface preparation (usually degreasing - get rid of finger oils, flux, and other contaminants),

The most reliable things we have found in RC Model Warship Combat are either to coat in 3M Scotchkote or to seal in a "drybox" filled with Corrosion-X or similar waterproofing mineral oil designed for electronic circuits.

Cheers,

Wreno
 

D n T

Senior Member
talking to your ROV

Off the track of ESCs and leakage for a minute.
How do you plan to talk to your ROV, I have used umbilicals before and they ARE worth it, if all else fails pull it up. Be careful with wireless and underwater, I have seem model subs with a wire to a float and Ive seen an ROV with an umbilical to a surface float with an aerial on it, although the tether created a lot of drag on the ROV.

The umbilical I used had cat6 cable running through the centre of 10mm abseiling rope ( I got the rope for free) although normal marine kernmantel rope would do the job. Kern mantel is the woven rope with a seperate core, I taped the cat 6 to the end of the core section and pulled it through the outer mantel, took a while but it was worth it, the cat6 was protected from damage and if the ROV failed we could just hoist it to the boat. You have to pull the other end out through the mantel about 600mm before the end. This will give you enough to attach it to your ROV.
 

Wrenow

Senior Member
Goom,

A clarification on the ESC. The Proboat goes from ful forward to full reverse out of the box as well, but requires you to throw the stick both ways to let it know your radio's limits. You can then set the endpoints to get the speed range you want at the TX.

HOWEVER: when you power down and power back up, it goes back to its initial state, and you have to throw the stick to tell it the ranges again, and if you have set the EPAs, then the set endpoints become max and min throttle. So what you need to do is use a DR or Mix to let you set it at full then switch to the limited range.

You are asying this one remembers its settings once set up? Then it would probably be good for Big Gun style Model Warship Combat.

I noticed from the specs that its rated reverse capacity is lower than its forwards. That is whate led me to believe that its reverse sped wazs also limited - but you are saying the speeds in both directions appear identical? If so, it might also be appropriate for Small/Fast Gun format (they battle in reverse a lot, Big Gun does not use battle reverse).

I may have to order one and try it out. By the way, there is a pretty active contingent of Warship Combat guys up in Canada - I seem to recall some in your area, in fact. Make some really nice fiberglass hulls for the hobby.

Cheers,

Wreno
 
Top