Let's Make Robots!

Live soccer robots on LMR

Recently Gareth suggested to me that it would be good to have 2 teams of my bi-ped robots playing soccer. This was too good an idea to ignore.

After talking about this idea backstage this is where we are at:

On behalf of DAGU I will donate 6 Mini-Biped robots (plus spare parts) and an Arduino compatible IR transmitter to control them. Frits has volunteered to host the robot soccer match. Players would control the robots from their homes via the internet and the video would be streamed on LMR so the players can see what their robot is doing.

What we need is someone who can write some simple software to be loaded on the player and host computers.
The software for the the players will take keyboard commands (e.g. Cursor keys and spacebar) and send this information via the Internet to the host PC.
The software for the host computer (preferably mac compatible) will receive the data from the 6 player computers and send it to the Arduino compatible transmitter as serial data.
The data only needs to be a simple code such as the number 1-6 indicating which player has pressed a key followed by a letter A-E indicating which key was pressed.
A = forward       
B = backward
C = left
D = right
E = stop / kick
Thus the data stream would be something like 0D1A2A3E4D5C etc.
These robots are small, slow and clumsy so while the game will not be fast and furious I hope it will be fun to watch as well as to play.



Below is an explanation of how I will be programming the Arduino transmitter which will receive serial data from the host computer the same as it would using the serial monitor built into the Arduino enviroment. The Host computer will simply pass on the data it receives from the players computers.

Because the IR receiver needs to receive at least 14 pulses at 38KHz to recognise a 1, the Sony protocol uses 600uS as the width of a data bit and 1200uS as the width of the start bit. These times could be shortened but that could reduce reliability so for now I will stick with them. Beyond that I am ditching the Sony protocol which has 7 data bits and 5 device bits for a shorter, faster protocol.

I will write the Arduino code to send out 1 start bit, 3 player ID bits and 3 command bits. This will allow a maximum of 8 player and 8 commands. For now we will only have 6 players and 5 commands.

The Arduino will poll the player IDs thus the first 3 ID bits will count 0-5 repeatedly. The command sent out will be the last command received for that robot.

Each robot will be programmed with it's own ID so for example when the code 1A is sent out, all robots will receive the code but only robot 1 will respond and walk forward.

Because the slow IR transmission presents a bottle neck to the flow of data it would probably be best if the program running on the players computers limited the rate it sent command to 10 commands per seccond. This is fast enough to ensure a reasonable response time but will prevent the Arduino serial buffer from overflowing.

7 lovely red robot brains sitting on my desk. The main PCB is a simple little Arduino compatible board. The smaller PCB at the back is his "backpack" with speaker and IR comms hardware. An IR compound eye plugs into the front. I should have 7 little robots on their way to Frit's house next week. The seventh is a spare, just in case.

I've dubbed them the 7 dwarfs.
Here are some links to video of the prototype so you can get an idea what their soccer skill are like :P

RC chasing a ball: http://v.youku.com/v_show/id_XMTg0NDMxNTY4.html

Autonomous goal keeper: http://v.youku.com/v_show/id_XMTk5NDY1MTcy.html

Update: 20-09-2010

I have upgraded the Game Transmitter hardware and software to allow the pan/tilt assemblies to fire lasers (or other weapons) at the players. Lets be honest, no robot competition is complete without laser fire!

I have attached the code for both the game transmitter and the soccerbots. Currently the soccerbots will accept commands from both the game transmitter and a TV remote. The TV remote allows the host (Frits) to calibrate and test the players without a computer. The players ID can also be entered by TV remote so that if a player dies during a match Frits can quicky replace it with the spare robot just by changing the spare robots player ID to that of the dead robot.

Calibration settings and player ID are stored in the robots EEPROM so that the data isn't lost when the robot is turned off.

Update: 22-09-2010

As the famous saying goes, the devil is in the details! The seven dwarfs are not accepting commands from the game transmitter. As they work fine from the TV remote I have to assume the problem is with the transmitter. On the oscilloscope the transmitter seems to work fine with a nice modulated 38KHz signal.

Until I can sort this problem out the Dwarfs are staying in China :(



Update: 22-01-2011

Well they are finally in Frits's workshop. If nothing else Frits will learn a bit about Arduino. I did a lot of last minute stuff before I sent it all out and forgot the ball in the process. Now I need to get some instructions together for Frits.

I've taken some of Frits's photos and labelled them so every one knows what all the thingys are.

The Mini-Bipeds are normally sold pre-programmed for use by younger robot enthusiest. Therefore a programming cable was not produced. As Frits's will probably need to update the code a few times I quickly made up a cable. Experienced users can make a serial cable quite easily or use the ISP socket.


Soccerbot_transmitter_V2.zip2.35 KB
Soccerbot_V1.zip3.7 KB

Comment viewing options


Originally I developed the hardware to trigger an interrupt when an IR signal was received. This didn't work as well as expected.

The main loop at that time used delay() to control the walking speed allowing time for the servos to acheive their new position. Most of the processor time was actually spent doing nothing!

I realised I could use the pulsin() command in place of the delays and use the timeout value to control the speed. Now the processor spends most of it's time monitoring the IR receiver instead of doing nothing.

This worked out better than expected as the robots timing is not noticably affected by receiving IR commands even when you send a continuous stream from the remote.

I have now upgraded the game transmitter for laser fire!!!
New code for the transmitter and code for the soccerbots now attached.

It is another late night in the office so I'll have to wait till tomorrow to test the boys out on the field. If all goes well then they're of to Denmark.

OMG, the videos are awesomely funny. I can't wait to see these things in action.

My reaction to the first video: Gooooooooaaaaaaaalllllll!!!!!!!

My reaction to the second video: At least the goalie will cover more ground while lying down!

I've attached the software used for the transmitter Arduino clone.

You will see a Constants.h file and IO_pins.h file as well as the main program. I've tried to make the program fairly flexible for future events so the Constants tab allows you to change things like the number of players and cameras etc. The IO_pins tab makes it easy to transfer this software to a different board or change the pin configuration on the existing board.

I have only tested this software by sending commands to the serial monitor e.g. 0A tells player 0 to walk forward and the IR LEDs pulse, 6AAAA made the servos for camera 0 move to their limits.

I still need to modify the robots code to work with the new command system. That will be tomorrows job.


Hopefully this will help GroG with his code. The program simply looks for a valid player ID, then depending if the ID is a player or a camera it either reads a command and sends it via the IR LEDs or it reads four bytes of pan/tilt data to update a cameras servos.

Would you mind posting the Player's code too?  I was wondering because, if you don't consider it propriatary, in the future I'd like to possibly augment it.   So that it's not just Fowards Backwards, TurnLeft, TurnRight ...

If I turn them into slaves of the computer, we might be able to store & send more complicated moves - like "Kick Guy in the Groin and Do Karate Chop" and "Laser Dood in the Eyes" or "Make Player center in Camera" or "Pansy Ass Wounded Mode" or "Steroids Mode".  These could be presented to GUI as a variety of options/buttons

Hell, rik and I might create a Genetic Service - where the goal is breeding the Super Player ! (well ... that might be in a couple iterations ;)

Once I have modified the code to work with the transmitter I will attach it. As we are using ATmega8A's there is not much memory to work with. After getting RobotFreak and Brett Hagman to help me fix the tone() command to use in these robots I then found I didn't have the memory available for it :(

Soccer bots breeding... This just popped to my mind: "Oh my goodness. Shut me down! Machines making machines. Hmm. How perverse." - C-3PO


This is all looking pretty amazing guys!
I've been out of town every week for the past 9 weeks now... and next week I'll be heading to Aussie for at least two weeks solid... but I'll be trying to check in as much as I can =)

Let the games begin - 

After a click, if you can see a re-sizeable console with 3 tabs your almost there .... if not you got to go get some Java from here http://www.java.com/en/download/index.jsp


I have dropped my drawers and draw-bridges.  Added some firewall rules, P and Q's and can start a "Host" up on my machina..   I guess I could get a uStream account, or is there an official LMR one?  What else should I hook to the Arduino? 
Soon, you'll have a chance to pan & tilt around in my horrible basement .... maybe stick a mirror up again Frits?  Or hook the laser up, and try out the other crap I've attached to the little platform.. what else, what else?

How should I give out usernames & passwords ? - I only got a cameraman no Player - what can I hook them up to? Arrrgh .. so much to do .. so little time !
What do you say?


Just confirming it loads and runs on my computer. Tech info: Windows Vista Home Premium 64bit SP2, Firefox 3.6.9, Java Plug-in 1.6.0_20 Using JRE version 1.6.0_20-b02 Java HotSpot(TM) Client VM

I got a couple of exceptions and I've put them here (small webspace provided by my Internet operator) in case you want to take a look. The first InstantiationException is thrown right at startup. I think second one comes when pressing "refresh services". I think AccessControlException is easy: no writing to local HD without correct permissions ("dump cfg" click). ERRORs got printed when "connect" is clicked (I guess is a todo 'cause there's a TODO :-).

I noticed that then your applet is running closing the applet window or java console causes my computer to freeze for couple of seconds. Some kind of network or other timeout related perhaps (just a guess)? I haven't noticed this with other applets.