Pingbot - Micro RC Rechargable Musical Robot Pal

FeaturedContest WinnerContest Winner

Step 10: Programming

Picture of Programming
Programming Connector-01.png
Ping Bot 475.jpg
Ping Bot 474.jpg
The Pingbot is not much more than a remote controlled puppet. It doesn't have any sensors and it can't track its own movement. It only does what the remote tells it to do. Because of this the program is limited in its options and uses only a few basic commands and some semi-tricky dance moves. I am not very experienced with programming these chips and I'm certain there are functions that I am unaware of. What little programming I have learned was from the PixAxe manuals and their website.

PicAxe Programming Editor, the software used to program the 08M2, is available FREE from the PicAxe website.

Serial Programming
To program a PicAxe chip via a USB port an AXE027 programming cable is needed. While designing the circuit I was working under the assumption that the 08M2 could be programmed with a direct connection to the USB port's data+ and data- pins. I thought I could skip the 027,  and would need only the Micro-USB connector to program the chip. After a few failed attempts at uploading the program to the bot, I did some testing/research and found out that the AXE027 cable contains a serial converter. I don't know the exact details of how this converter works, but It is necessary to program the PicAxe over a USB port.

It was far too late to go back and fix this in the design, everything had already been put together! Besides, there wasn't room to add a stereo jack for the AXE027 onto the circuit board. To program the chip I needed to make an adapter that could receive the stereo jack from the AXE027 and connect it to the Micro-USB cable.

I rummaged through my box of computer stuff and found a PS2 -USB adapter that I was not emotionally attached to. I cut it apart, removed the female USB connector, and wired that to a 3.5 stereo jack that I had left over from a previous project. The accompanying image details how this adapter was wired.

What the Program Does
The robot is controlled by a standard universal tv remote that I got for $5. The remote is set to the Sony television code, which is what the 08M2 is able to decode. When a button is pressed on the remote it transmits a code from its infrared LED. Meanwhile the 08M2 has been waiting for its IR receiver to pick up this transmission, and when it does it stores the corresponding button number into a variable. The PicAxe  checks that variable and runs the code that is associated with the received number. The program then returns to its start and waits for another command.

The 08M2s tune command is awesome. There are thousands of free, old cell phone ringtones that were made to be played on peizo speakers and these can be downloaded and programmed onto the chip. Inserting these songs is as simple as using the PicAxe Programming Editor's ringtone wizard to import the songs into the code. Each note of the song is represented by a number and they can be copied, pasted, and re-arranged to edit the songs. The command also has options for blinking an LED (the eyes) with the music.

I programmed a few of the buttons with songs, and a few others with random beeps. The beeps give the robot some cut little expressions that are fun to use when it bumps into things and such. More info on the tune command can be found here. This page was also very useful, as it shows what code# is used for which remote control buttons.

When one of the Volume + - or Channel + buttons is pressed the program turns on the appropriate motor for 100 milliseconds, then turns it off again. If that button is held down that bit of code repeats, effectively turning the motor fully on. The LED eyes are tied to this same button so that they turn on in synch with the motor. The eyes do blink each time the code repeats, but the motors do not stop long enough to affect movement.

Dancing Robots Have More Fun
The Pingbot can be programmed with dance routines using a mix of the tune command and motor control . The program turns on a motor (or both), plays a few notes, and then turns the motor off. Next the opposite motor is turned on, the next set of notes in the song are played, and the motor is turned off. When these moves are executed together there is no hesitation between the commands and the song plays seamlessly while the robot whirls around in different directions. This can be seen in the video on this Instructable's intro page.
Remove these adsRemove these ads by Signing Up