Tuesday 30 August 2011

Arduino RC Boat Speed Controller Part 1

Prompted somewhat by coincidence, we happened upon a small model boat exhibition this bank holiday weekend, in the grounds of Holdenby House alongside it's food festival. I took plenty of pictures of the boats (and birds of prey in their falconry centre), but neglected to take pictures of the food - whoops...

Though I probably don't need to completely upgrade the electronics for the RC Boat I snagged a few months back, I've been getting carried away with designing cool solutions nonetheless. The boat uses two motors for both thrust and turning, with the current electronics taking both Rx outputs (throttle/steering) and converting them into two throttle output values.

To be honest, I've not actually opened up the boat's electronics compartment - I just had a look inside the main shell, and decided to replace the Rx to 2.4Ghz and in turn the ESC to something compatible. For all I know, it's a separate little packaged ESC that does exactly what I want, and doesn't need replacing, then again, it's probably just one board, with all the Rx and ESC electronics. Both motors are wired direct from the electronics compartment, along with the battery supply cable.

Just three screws, and I'll have my answers, but my solution is better than anything that's likely to be in there already (let's just pretend that's the case for now). I'll check tonight, I promise!

So let's just plough ahead full steam anyway.

The Problem: An electronic speed controller that can control twin motors, and based upon steering input, correct/shift the power between the two motors to produce the appropriate turning.

The Solution: Arduino!

I've seen this boat modified with an outboard rudder (with a very nice aluminium structure), and with the motors presumably "Y" linked to the ESC (or two ESC's with a Y-link to the Rx). That's Stage X in my mind, I'm just looking at this early stage (ermm, Stage 1) to put my mark on the boat, without too much hacking or expensive modification (minus the over-the-top solution to follow).

The solution I've decided for at this stage, is to replace both the Rx and ESC with a new Rx (2.4Ghz) and with a pair of brushed ESC (TBC), combined with an Arduino to process the signals from the Rx and to convert into proportional control of the two ESC. The Arduino can then also do other interesting stuff in the future, courtesy of a 3rd channel on the Rx.

Initially, I'll prototype the solution with servos instead of the ESC (they have the same interface, so shouldn't have any problems), as I don't have any spare motors or even any spare ESC at the moment (on order still). The input will be from the Rx, using some custom made cables, and hopefully everything will be powered from a single bus or perhaps two buses to balance the ESC outputs.

I'll start with a single battery powering both ESC, as I don't have much space at the moment for extra batteries (well, whilst this is on the workbench I do but long term I don't). I may have to move to lithium to increase the runtime.

The Arduino will interface using a servo board, with both outputs of the Rx and both inputs of the ESC sitting on the bank of servo I/O - so no wiring or hacking required. The power supply for the Rx and Arduino will come from the ESC's regulated output - as mentioned, still to decide as whether both will come off one, or one each from either.

I've already written a draft script, that just passes the throttle through to the motors. The next draft will introduce a basic proportional control - the R&D comes at this point, where I need to play with three approaches to the proportional mathematics.

In Part 2, I'll show the prototype in more detail (including circuitry), and cover the results of the R&D. Hopefully, in Part 3, I'll be able to show it being installed in the boat, and some tests of it in the water. Between now and then, I also hope to do a post on the boat, and it's strip down, and perhaps a wet test in it's current state.