Radio Controller App

A project log for Retro Robot Restomod

Breathing new life into a 22 year old robot toy

scottscott 04/28/2014 at 15:310 Comments

Seeing as how we don't have any CPU cycles left in the arduino for a neural network, we figured we'd just have to make a remote control app, and leverage the human operator's biological neural network.

At the moment it's very bare-bones as you can see. Up till now I didn't know the servo assignment, so it's all generic, (which is nice for you, dear reader, if you'd like to use this app for your own nefarious purposes.)

Basically the connect button looks for the 'linvor' bluetooth module in your paired devices list, and connects. If 'linvor' isn't in your bluetooth device list then it just connects to the first one.

The sliders at the top set the servo PWM values, and the first row of buttons turns the PWM on and off. RC servos use PWM between 1 and 2ms for the position, but it turns out if you just cut the signal they basically turn off. This is quite handy for the continuous rotation walking drive servo, because you can never quite find the zero point. So now you can just set the direction with the slider and turn it on and off with the button.

The implementation uses a 200ms update timer to avoid overflowing the RX buffer on the arduino. To set the PWM it sends 'a' thru 'd' then 00 thru 64, then LF.

The LEDs row simply toggles IO's on and off, we've got the laser and some LEDs on here. This just sends 'A' thru 'D' for the channel then '0' or '1', then LF.

The next two rows send commands to play different wav files. (At the moment they're a bit NSFW). To do this it just sends 'p' then '0' thru '5', then LF.

Limitations a'Plenty:

At the moment the code does nothing to read from the device, Any returned text is placed in the status label.

What would be nice is a way to get a listing of the audio files on the SD card and allow you to map the audio buttons. It would be relatively easy to implement, just make the arduino code run a directory listing on command, and parse the result.

The state can also get out of sync. If you reset the arduino and some buttons are still toggled etc, they wont match up. Some sort of periodic sync message would be nice.

The UI sucks, I was imagining skinning all the controls with a nice retro looking chromed crusader theme, but unfortunately my GIMP skills aren't up to the task.

Anyways, here's the code for your enjoyment: