Tuesday 7 August 2012

RC Dual-Motor Control

The mission; to develop an Arduino based PWM mixer that can control dual-motor powered vehicles.

Having bought two RC vehicles that rely upon dual-motor control, in the process of stripping out their original low-spec electronics, I was in desperate need for a mixer to take the steering and throttle channel inputs and mix them into left and right motor outputs.

Having searched for a solution, the closest I could find was a ludicrously expensive RC tank ESC, circa £300. So, with an Arduino to hand and a couple of servos, I started developing a simple mixing routine.

The input signals were PWM, or Pulse Width Modulated - a simple way of transmitting an analogue signal using digital pulses - supplied by the steering and throttle channels of the receiver. The corresponding outputs would also had to be PWM, in order to drive the ESC that the left and right motors are driven by.

The outputs are the easy part with help from the Arduino servo library. Most people have driven a servo from their Arduino, it's a nice simple piece of coding, no circuitry, just plug-in and go. But reading PWM turned out to be a bigger problem to tackle then I initially thought. The big mistake was assuming I could read PWM signals easily with the Arduino.

A couple of solutions are floating round, I think I found some on StackOverflow and others on robotics forums, where people were trying to integrate RC receivers with Arduino as a simple alternative to ZigBee.

I even hoped to use that same approach on other projects myself, so was set on getting it to work. In fact, it all sort of started coming together nicely - the RX is even powered off the Arduino's 5V bus, so it keeps things quite nice and simple.

But the code just keeps getting more complex.

In short, it's possible, but a lot of code is needed, and the Arduino can't do much else. From all accounts from others working on similar code, it struggles to read and write two PWM signals. Bugger. I might come back to it sometime, but it's not a nice reliable design at present.

So back to the drawing board.

The final breakthrough came in the form of a £4 electronic mixer. Better known as a V-Tail Mixer, these are designed for simple fixed wing aircraft, that utilise a pair of servos to operate bother rudder and aileron - the mixer takes the values of both and mixes them proportionally. Bingo. Perhaps this is the RC communities biggest secret. Perhaps I've found a genius alternative use of the mixer. Perhaps everybody does this. Who knows? I found jack shit on my travels, so I've come to the conclusion that I made a ground-breaking discovery.

The mixer is perfect - it takes the input values and passes them through mixed. It doesn't do anything else to the signal, so the resulting output seems to work with everything including uni- and bi-directional ESC. And they're £4. Tiny bit cheaper than an Arduino. And less effort.

Perfect. Let's rewind this. The perfect solution, that would fit virtually every use of dual-motor powered vehicles, whether they be boats, tanks, hovercraft - whatever. It costs £4. And yet, it's being sold and advertised solely for people with a V-Tail whose radio transmitter lacks an onboard V-Tail mixer setting. Great.

But all is not lost... In my struggle to find a solution I found the OpenServo project. Quite genius really. Simply, the project's main hardware development is an I2C based controller board, with virtually the same footprint as the regular PWM controllers found in servos. There's a lot in such a small package - including temperature monitoring, advanced programming, braking and a massive voltage range.

Coupled to the I2C bus on the Arduino, I have high hopes of advanced control for robotics (and anything else I can wedge it into). The I2C bus seems to be more and more popular, with it being used for a wide range of applications these days. So, not really of use in driving speed controllers for this mini-project, but definitely of interest for the future...

No comments:

Post a Comment