Autonomous Boat

Hi,

We are a group of Engineering majors working on designing and building an autonomous, robotic boat. Our design currently consists of:

Arduino Leonardo
A EM-406A GPS receiver with a GPS shield that attaches to the Leonardo
A compass
2 thrusters with corresponding motor drivers

We have a Pololu 755 Motor driver and a thruster. We are looking to interface the motor driver through an Arduino Leonardo to control the speed of the thruster. We want to use Matlab as a base programming language, although C is an option as well. We were wondering if anyone has any advice for us, or sample codes they would be willing to share. Our knowledge of these motor drivers is limited, although we have a good Matlab background. The idea is to give the boat a location in coordinates, and have it travel there.

Thoughts and advice are appreciates.

Thank you!

How does MATLAB fit into your project? The Leonardo can certainly do everything you've described so far.

Start by making your life easier and get yourself a RC model boat with twin props. You'll thank me later...

Then scrap the Pololu driver and use a couple of electric motor speed controllers (possibly even the same ones that came with the model).

There are several examples of how to interface a servo to a 'Duino, or just buy a shield for it.

Your GPS receiver will tell you where you are at. Do the (polar) math to figure out vector and distance to get from point A to point B. But floating point math on the Leonardo is going to be sllooowww.

Try to set your boat up with counter-rotating props to help cancel out the torque (error).

You don't necessarily need a compass (and I imagine that the update rate from the compass would be slower than your GPS update rate, but I can't say for sure), since once you start moving, you will know what direction you are headed in.

I've actually got some related experience to this. I have been building a custom RC transmitter for a ship model with dual engine control (and rudder). While the ship is not exactly robotic, it has a lot of robotic concepts. Let me explain.

In a normal RC transmitter / receiver, you collect the stick positions from the joysticks by reading the analog pots. You then encode the stick values, usually to PPM, and then this is transmitted by radio. The radio receiver decodes the PPM for each of the servo channels and converts this to PWM which is output to the servos. For engines, you would have an ESC (electronic speed controller) that converts the PWM to engine speed and direction for each engine.

Here's how my controller is different. What I did is hack an existing RC transmitter and removed the circuit board from the transmitter. I disconnected both the joysticks and set them aside since I'm not using them. Each joystick has 2 axis, and each axis is hooked up to a 10k pot. I bought a quad 10k digital potentiometer chip which is an i2c chip that allows you to vary the voltage between the low and the high via microcontroller. It does exactly what a potentiometer does, but is controlled by a microcontroller. So... in my transmitter, I replaced the joysticks with my own controls, but the controls are connected to the Arduino, not the transmitter. I use the Arduino to read the values and then manage the analog signal being sent to the transmitter. Why would I go to all this trouble? Because my transmitter simulates the actual engine orders and response times on a WW2 Fletcher class destroyer. My transmitter has 2 engine telegraphs instead of throttle. When you want full speed ahead, you move both telegraphs to "Ahead Full". There is a slight delay followed by an audio acknowledgement of the order. (I use a serial-controlled MP3 player to play the sound effects. You'll actually hear "All ahead full, aye! followed by Ding! Ding!" which represents the engine room acknowledging the engine order. The the engines are commanded to slowly come up to speed, representing the actual time it would take for the turbines to get to full speed. Then if you throw the engine telegraphs into reverse, the same kind of thing happens. There's a an acknowledgement of the order, then the engines have to be slowed to a stop first (so you don't damage the turbines!)... then the "reverse" turbines are engaged and the motors start spinning in reverse, slowly at first, until they come up to speed. For steering, I'm actually using a rotary encoder. To get full 30 degree rudder deflection, you have to rotate the wheel 4 full revolutions, just like you would on the real ship. And on the real ship you are just setting the rudder position desired. The rudder motor in real life takes time to get the rudder to the ordered position. My transmitter simulates that as well.

I have a video demo of this whole thing on breadboard here:

Of course this is an RC model ship, and we could get in real trouble real quick by having such slow responses. There's of course an emergency override where the engine telegraphs become linear throttles and the steering only takes 1/2 a turn for full rudder deflection.

Anyway... since the transmitter is being driven by the Arduino, I could have the ship execute automatic patterns. For example, I could have button press make the ship run a figure 8 pattern. Or a zig-zag pattern. Or whatever. Completely autonomously.

One could also put an Arduino in the ship and have it read the PWM on some of the channels of the receiver and make certain ranges of values execute different functions on the ship.

Also, it turns out the transmitter board itself is really just a programmed microcontroller (MA803SA from Megawin) that is not all that different from an Atmel chip. The microcontroller is programmed to read the analog inputs for each of the channels, encodes these values as PPM data, then sends the PPM data to a separate RF module. One could reasonably figure out the PPM encoding and program an Arduino to create the PPM signal going to the RF module itself.

Anyway, I digress. For your robotic boat, I'd recommend using ESC speed controllers for the motors. Make sure you get brushed or brushless depending on whether the motors are brushed or brushless. Use a BEC (battery eliminator circuit) to provide 5V to the Arduino from a LiPo battery. Use a servo controller shield or servo controller on the Arduino (I really like Adafruit's 16-channel controller which can be had for $14.95 US) to output your signals to your motors and servos. If you ALSO want to be able to manually take over control by radio...consider hacking a HobbyKing 4Ch or 6CH transmitter and receiver... they are only like $26 US together. Cheap as heck and easy to hack into. Yes, there are more expensive TX/RC gear designed for hackers that have serial interfaces... but why bother spending $$$ on that when you can hack something for a fraction of the cost? Anyway, good luck on your project.

There have been previous post on autonomous boat projects below that might have some info. Bottom is some info on the ardupilot which also might be of interest.

https://www.google.com/search?as_q=autonomous+boat&as_epq=&as_oq=&as_eq=&as_nlo=&as_nhi=&lr=&cr=&as_qdr=all&as_sitesearch=http%3A%2F%2Fforum.arduino.cc%2Findex&as_occt=any&safe=images&tbs=&as_filetype=&as_rights=

https://www.google.com/search?num=100&lr&as_qdr=all&q=ardupilot&spell=1&sa=X&ei=YPIYU_L7Bc6fkQesgIHgCw&ved=0CCUQvwUoAA&biw=1108&bih=628

the thrusters will go into the ardunio (loaded with the drivers/shields) and the ardunio will be powered by a battery and be connected to a laptop that will be running matlab and a loaded matlab code that will allow the thrusters to perform the tasks we need. The thing is, we're pretty rigid with the devices we were already given (although we have a tiny bit of room to purchase more things) -- meaning we just have the gps, gps shield, two thrusters, two motor drivers, and a leonardo.

what we're confused about is how to interface everything. we assume that the shields will allow a much simpler code for controlling the thrusters.

Thanks to all who have responded and will respond!!