Let's Make Robots!

Bajdupod 996R

Walk smoothly :)

Update 09-06-2013 I'm considering this project finished.Well maybe I reprogram it one day :p

Made a new video showing Bajdupod 996R doing some fitness outside in the sun :) It show some of the "moves" that I have preprogrammed. In the last bit of the video you can see me moving one leg. I can move each leg individually with my remote control. Took me a lot time to code everything and test it out. My code is over 1000 lines long and one big mess. Maybe I'll clean it up one day and try to improve it.

I've written some more code to let the hexapod walk autonomously. But it's a bit difficult to make a video of it. I still haven't received a new Lipo. The current Lipo lasts less then 7 minutes :p It can now track an IR light source using the WiiCamera or do some obstacle avoidance using the ultrasonic sensors.

This project was a very good programming lesson to learn how to multiple things with one mico controller. Controlling 21 servos, doing some wireless communication, controlling 18 leds and reading some sensors needs a lot of code :) One year ago I did not think I would be able to program a beast like this. But you can accomplish lots with dedication and hard work!

Update 17-05-2013

New video showing of the blue leds that I've added :)

My hexapod is now fitted with 21 servos, 18 leds (16 are controlled by 2 shift registers), 2 ultrasonic sensors and a Wiicam :p Now I need to code this beast. It can already walk pretty smooth. All the sensors are connected and work. At the moment I just take the readings and sent them to my remote control. Need to learn it some tricks now :)

During the many test sessions my big Lipo has gone poof :( Now waiting for a new one plus a decent charger. Thankfully I have some spare lipos. But they don't last very long, this is one power hungry beast :p

Some photos:


Update 29-04-2013

New video uploaded, let my hexapod loose outside :)

Finally designed a new chassis and had it laser cut by a local company. I had 3 plates made. Between the bottom and the middle plate the battery, UBECs and power servo PCB are fitted. Between the middle and bottom plate the Seeeduino Mega and my Bajduino Mega 3A sit. I chose to use 2 micro controllers just for fun. I have dozens of ATmega's so I might as well use them :) My Bajduino Mega 3A has an ATmega1284P micro controller. It has 2 serial ports which is very handy. One for the serial monitor and one to communicate with the Seeeduino Mega. The Bajduino only does the wireless communication at the moment, the PCB has a header for the nRF24L01 module. I have not fitted the top plate of the chassis yet.

To replace the chassis I had to take the hexapod apart. I put it back together and replaced all the plastic servo horns with metal ones. I then had to check all the servos again to see if they all line up. In the video you can see that it's not walking very straight. So I need to do some adjusting... I also mounted the legs on small bearings that sit inside the bottom acryl plate.

My code seems to run ok. It still has a bug that I can't seem to fix. When I switch between the walking mode and the "move the body" mode strange things happen :p Think I'll rewrite that function so it uses the same timer as my walking function. Still I'm happy with the progress so far :)

Update 23-03-2013

Added another video showing my last state of code. I've changed the way I move the servos. All my code is now based on timers. I have added speed control and "bodyshifting". I can select a mode on my remote with a button. So I can choose between walking or moving the body.

Now I have to tackle some mechanical problems. The legs need a lot more grip and I need to design a new bigger chassis. I have received my metal servo horns. Once I have the new chassis plates I'll replace all the horns. It's quite a big job, 72 screws :p

Update 12-03-2013

Uploaded third video. Snowed in today so had to stay at home and play with my hexapod. I have changed my massive moveServos function so it moves the servos in little steps. I can now control the speed of the servos. I do use a for loop and the delay function. I've added a second micro controller (ATmega328) with a wireless nRF24L01 module. All my bots have been controlled by these modules so it didn't take me long to program the communication. The ATmega328 receives a struct from my remote control via the wireless modules. The ATmega328 then sends these values via software serial to the Arduino Mega which receives these values over hardware serial. Sounds complex but it's actually very straight forward. In the video you can now see that you can make a hexapod with cheap Chinese servos that can walk smoothly :) Not as smooth as a lynxmotion of course but that has more to do with my code. And it cost me a lot less.

Update 10-03-2013

Added the second video, this time of Bajdupod 996R taking its first steps :) After blowing up a couple of expensive 8A UBECs I think I have found a solution to powering the 18 servos. I am now using 3 8A UBECs, each UBEC powers 2 legs / 6 servos. To give you an idea about how current this black monster needs, I had a 10A fuse between the Lipo and the 3 UBECs. It blew up when I tried out the real walking test. So I've replaced it with a 20A fuse.

I have written a basic walking gait to move the hexapod forward, backward, left and right. I'm using inverse kinematics to calculate the servo angles. The code still needs a lot of improvement, I want it to move a lot smoother. For this I'll need to move the servos in little steps. Writing that code for 18 servos is not so easy, certainly as I refuse to use the delay function. That's to easy :) I had a bit of trouble finding out how much I could move the legs and keep the hexapod stable. In the beginning I was moving the legs to far for/backward and that caused the hexapod to fall on it's ass :p Takes quite a bit of time figuring everything out...

Future plans:

  • Replace all the servo horns with metal horns (are on the way from China)
  • Replace the original base plates with self designed laser cut acryl plates, the chassis I use now is to small, I'll make it a little bigger so I can fit my Lipo and UBECs inside the chassis
  • Replace current servo PCB with new version (is on the way from China)
  • Replace Arduino Mega2560 with a Seeeduino Mega2560 (Seeeduino version is smaller)
  • Write some fancier code so the hexapod moves a lot smoother and I can control the speed of the servos (this will be very hard)
  • Fit a second micro controller with a nRF24L01 module so I can remote control it.
  • Add a shit load of LEDs and let it dance, Gangnam style :D

Update 22-02-2013

Added first video :) I've done some more testing. I've written a sketch were I move all 6 legs (18 servos) at the same time. Lifting 3 legs up and 3 legs down using inverse kinematics. I powered 3 legs from my lab power supply and the other 3 from an 8A UBEC. I'm afraid the servos will draw close to 20A when walking. So I've now ordered 3 more 8A UBECs. I will use 1 8A UBEC to power 2 legs, so 3 8A UBECs in total. I hope that will do it.

Update 18-02-2013:

I have spent the last weeks trying to figure out how inverse kinematics work. After a big struggle and a lot of head scratching I can now move every leg using inverse kinematics. That means that in my code I can do this: moveLeg1(X,Y,Z). The X,Y,Z is the position of the tip of the leg :) The code will then calculate the angle of each servo and move the leg to the X,Y,Z position. I borrowed a lot of code from this website: http://www.engineer-this.com/IK.shtml Converting the IK angles to servo angles was actually easier then I thought. Using a protractor I compared the calculated IK angles with my servo angles. I still have to do some fine tuning. But the biggest hurdle has been taken :) 

Of course I wanted to show of my successful coding and quickly wrote a simple sketch to move all 6 legs at the same time. So I could make a video. Bad luck struck of course and one of my UBEC's has given up. I was powering the 18 servos with 2 8A UBEC's. Each UBEC powers 3 legs. Now I'll be honest when I first tested the UBEC's I short circuited them. They have been working fine till today... Grrr. I then decided to use my lab power supply. I set it at 6V and moved all the legs, the servos were drawing almost 10A. And the servos are under no / a very small load. So I will redesign my power supply circuit. Suggestions are welcome. Current solutions are a 5A UBEC for each leg? I have also seen some 10A 12 to 5V automotive regulators on Ebay, maybe 2 of those will be strong enough? I'm going to put the hexapod away for a bit now till I have found a decent solution. I'm definately not giving up, it will walk :p But I have bought a lot of other toys the last months, I'll play with them for a while :)

Original post:

I've started building my second hexapod. This time I'm using a Chinese hexapod kit. I bought the kit on Ebay for 90$. It included the parts in the photo below:

I bought 30 Towardpro MG996R servos some time ago on Ebay. They are pretty cheap and have +10kg/cm of torque. I hope they are strong enough :)


I used a lot of M3 nuts and bolts to put everything together. I did some thinking about how I was going to power 18 servos. I decided a big strong lipo and some UBECs were a good solution. I bought 2 8A UBECs. I soldered a fuse and switch to some connectors so I could hook up the lipo to the UBECs. I designed a small PCB (and had it made by Seeedstudio) to distribute the power from the UBECs to the 18 servos. Each UBEC powers 3 legs / 9 servos of the robot. The Mega 2560 is powered by a separate 2S Lipo.


I've now mounted an Arduino Mega 2560 on the robot and hooked it up to my servo power board. I might change the Mega for one of my self designed boards and use a Torobot 32 channel servo controller that I have lying around.

At the moment I have only set up the 18 servos, checking if they work and adjusting the centre position. Takes some time with 18 servos. I hope to write a sketch using inverse kinematics for it. But that will probably take some time.

Another issue I have is that the chassis is a bit on the small side. I might design a bigger base plate for it and have it made from Acryl. So I can attach some more electronics.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Bajdi mentioned this project took him a while because he kept having troubles with his power supply.

IMO, your question would be better asked in the forum. Comments here should be about Bajdi's bot rather than general hexapod building questions. My suggestion is to move the content of your post (you can edit a post as long as no one as replied to it) to the forum and leave a link to the forum post instead of your questions. Hopefully no one will reply to your post until you have time to move it (though it's not really a big deal either way). Too late.

When/if you make a forum post make sure and add detail about the power supply. Both the batteries you're using and the regulator.

Here's a link to my hexapod project which was inspired by Bajdi's excellent robot. I have several suggestions to offer but I'll save them for the forum post.

Edit: I'm betting the problem has to do with either the batteries or the regulator.

Thank you very much Duane and my apologies to Bajdi for not posting correctly. I will inmediately post as suggested.

Congrats on this fantastic bot. I am currently doing something very similar, based on the same eBay kit (and servos), and then I want to control it via Arduino Mega 2560, in the meantime my tests are being done with Uno R3.

At the very end, I want to do some AI stuff thanks to ROS being executed in a Raspberry Pi also contained in the Hexapod.

But I am far from there...at the moment, I cannot even add a third servo because as soon as I do it, all three start to behave randomly, if not at first, then after a couple positioning orders (I programmed a very basic parser and control code in Arduino with the Servo library).

In the pictures at the bottom you can see the test environment. An inexpensive regulated (5-15V, up to 15A) power supply, connecting to the protoboard where the servos are connected through cables that I don't know if they are too long and causing the high frequency parasites and therefore jittering.

At the moment I am using this advice: http://letsmakerobots.com/node/12679#null

That is, 100nF ceramic multilayer cap at the servo signal header (in the protoboard), 100uF electrolitic at the Vcc servo to Gnd header, protoboard, and some electrolitics 220uF and 100uF in parallel close to the power connectors summing up to 960uF

But no success at all.

I wonder if you had the same problems, and if that custom PCB solved the problem, It looks a much more elegant solution (a couple of big electrolitic boys and just some 4 ceramics?) and I wonder if I could replicate that in an arduino protoshield connected then to the Mega.

Maybe I am having so much noise and jittering because of the so many cables of the test environment? Maybe it could be solved soldering caps inside the servos instead of the protoboard? But this one looks like a radical solution that you might have solved with just that PCB.



You are using a breadboard, not protoboard.


Breadboards are very much unsuitable for power draws in excess of an amp or so, which you've already hit. Solder up some proper PCBs or protoboard and your issues will likely be cleared.

I'll agree it's better to use a PCB but I bet he'll have the same problem with or without the breadboard.

My 32 servo demo was done off breadboard. I doubt the breadboard is causing the problem.

Congratulations on a job well done!  Those blue leds are very cool looking.  A lot of engineering into just how to power everything without melting something I imagine. 

I don't think I have ever done a software project I didn't wish I had done better. 

Amazing robot !

Nicely done Bajdi. The blue LEDs are really an eyecatcher.

You are really progressing nicely with your control of your bot.


That was my first plan :) I bought 10 of those boards on ebay, then I did some testing. I powered 3 MG996R servos from 1 LM2596 board and let the servos sweep. Half hour later the board started to melt. The LM2596 is a 3A regulator but it needs to be able to dissipate some heat. That little PCB is not up to the job.

For the last week I've been using 3 Turnigy 8A UBECs and it seems to be fine, fingers crossed. Those UBECs are sold as 8A continuous and 15A peak. But continuous for the Chinese means 5 sec, peak 5 microseconds :p