Monday, May 28, 2012

Meet OSCar

"Hello World!"
Allow me to introduce O.S.C.A.R. - Open Sound Control Advanced Recon Robot. Oscar is a differential drive robot running on dc motors- providing fast speed capabilities and tight maneuvering. The control system has been built around the OSC protocol. This allows custom / flexible control interfaces that can also display live sensor data sent from the bot.
-


And me, the creator.



Quick background: I got my first Arduino (Uno) a few months back in December of 2012. I've been in the IT field for about 6 years now- my degree is in Computer Network Systems, but my work covers a pretty broad field. While I have a decent amount of programming experience I'm definitely not a programmer. Now- my background and knowledge of electronics and circuitry was.. well nothing. So, I spent the first few months learning what I could- flashing leds, pushing buttons, breadboards, sensors, resistors,  nothing too exciting. Then one day I remembered this cheap little sunt-racer-type RC car my mother in law gave me. 



It was called a Thunder Tumbler is available Wallgreens for about $15. So I decided to take it apart...

The Hardware

It had a pretty good frame that can be re-configured and modded in lots of ways. I played with various layouts for several months. In the end I stripped it down to just the 'engine' which consists of 2x DC motors in a differential drive gearbox, and two tires. The battery pack is also conveniently connected to this section. 


I found a few long brackets that I think went to a closet door. Using a pair of heavy plyers I managed to widen one of the holes enough to fit a little rotating wheel. I then sort of bent the corners up around the hole in order to hold the wheel in at a straight angle. Its not the prettiest thing in the world, and took alot of tweaking to get the wheel to sit at the right level; but its heavy duty and really makes the frame really solid.


From a spair piece of hard plastic I cut a simple base plate and mounted it to the bottom of the motor assembly.  Eventually I will re-cut this plate a little nicer, but for now this works. Because its mounted in between the motor assembly and the metal wheel bracket, its held to the frame nice and tight.


I soldered new connections to the DC motors using a 4 pin power connector from a desktop PSU, I then have the corresponding female adapter connected in to my motor driver.  The built in battery supply holds 4xAA batteries so to power the Arduino I soldered a compatible plug to it. I then use a seperate external battery pack to power the motors. This gives me more flexibility in changing the power supply to the motors, while always having a solid supply for the 3 boards. Also, its really easy to pull the Arduino off the frame if I need to- without having a mess of wires to unhook. 

The three boards Im using are the Arduino Mega R3, a SparkFun Xbee Shield, and an Arduino Motor Shield R3.

So nothing overly complicated on the electronics/hardware side. I did actually build my own motor shield from an Arduino Proto Shield, but I got tired of troubleshooting it and wanted something a little more stable/reliable. 

The code is where the magic happens...


Oscar is controlled using OSC messages sent from an iPhone (or other device). These messages travel via an ad-hoc WiFi network to the laptop where they are read by a Processing sketch which processes these and transmits a six character command over the XBee radio to Oscar.

If your not familiar with OSC, well I wasnt either until I started searching for a control systems. OSC stands for Open Sound Control. As its name implies it is a communication protocol developed  for DJ and digital sound equipment. It was intended to track and communicate the values of knobs, sliders, buttons, labels, etc. The perfect system for controlling a bot!

I wont go much into it in this post but there are some really cool possibilites like having sensor data sent from the bot represented back to the controller. Because it uses broadcast messages you can also use multiple controllers and changes from one will be dynamically shown on the other- In other words if you move 'slider1' up on iPhone1 it will also slide up on iPhone2; or anywhere else that 'slider1 exists'.


So far I have 2 control schemes set up. I had one that allowed you to control it by tilting and rolling the iphone, but I need to re-write the code to support it in my Arduino sketch.



Currently I'm almost primarily using the paid version of TouchOSC on my iPhone. Again I wont go into the details right now but there are a few other free apps. A really cool and exciting one is Control OSC. Once I get my basic controls finalized and all the bugs worked out in my code I will be swtiching over to it, but TouchOSC has an easy to use program for PC/MAC to create your own control schemes, with Control you must write them in JSON format. Both are available for Droid and iOS.

So yeah- thats where I'm at right now. I have a pretty long mental list of things to do, my next step is to get Oscar sending data back to the controller, the Motor shield allows you to poll the output current to the motors, so I'd like to get that represented back on the controller. Also a lot of structural upgrades to come.

So stay tuned, I will continue to update as Oscar advances. Also Ill update this post with a video real soon, you gotta see this thing run.

Arduino Sketch







1 comment: