I have been a life-long fan of anything around robotics, but I was never able to get close to my dream of building a robot due to money, expensive kits or even knowledge.

But these days these things no longer have to be a blocking issue, there are kits out there that make it possible to build your own robot quite easily. So I set out to create my very own Robot based on readily available materials. My main goal was to hand create something myself without using a pre-scribed kit. A few months ago when I started the project I set out with a few ultimate criteria for the v1 version:

  1. I can write all the code myself easily in a JVM based language
  2. It is affordable and easily hackable
  3. It can run wirelessly without requiring network, usb or power cables but is still controllable (wifi)
  4. It provides an abstraction layer over complicated robotics principles (motion, sensors, etc.)
  5. Can take different forms (humanoid, spider, buggy, etc.)


I already had quite some experience with servo’s and remote controlled helicopters but this is just not the same. I needed a Servo that allowed me programmable control without having to hack to much :). These days there are quite some alternatives for this. In the end I settled on the Robotis Dynamixel AX-12A servo which has a serial bus that is controllable via a USB – Serial protocol. I bought it as part of a Robotis Bioloid Premium kit as it has also quite some other nice goodies which could be of use in the future. Ofcourse next to this there are also some other parts needed like a small form factor PC, obviously the Raspberry PI was a primary choice there 🙂

In the end I ended up with this materials list:

  • Raspberry PI 2 with Raspbian and JDK8 installed on a 16GB micro-SD card
  • Netgear USB Wifi-N stick
  • USB2AX Dynamixel usb-serial communication stick
  • 5000Mah powerpack to power the Raspberry (power output 2.1A)
  • 18x Dynamixel AX-12A servos from a Robotis Bioloid premium kit
  • Robotis SMPS2Dynamixel to power the servo’s
  • Frame from the Robotis Bioloid premium kit
  • 2S LIPO 1200Mah
  • LIPO connectors
  • DC connector to Lipo cable

Java Dynamixel Library

The first step I had to overcome was how to control the servo’s. The USB2AX stick combined with the Robotis SMPS2Dynamixel could allow me power and control. But there were no working Java libraries for this. Luckily there are quite some examples of the communication protocol. I ended up using a Java Serial driver library to talk via the USB stick to the Servo’s. It was quite some figuring out to the low-level where I had to build specific byte packages and I won’t bore you to much with the detail but the result is a working Java library to control the Dynamixel Servo’s. I have made this library available to people that would be interested on Github: https://github.com/renarj/dynamixel

The Spider

Now that I could control a servo it was time to create a Robot from the servos. Ultimately the Bioloid Premium kit comes with this very cool humanoid robot design, but this was way too challenging to control. Humanoid Bipedal motion is a very tough subject on its own. I just wanted to first validate my software concepts before diving into this. So I decided to build a spider robot from the Kit which I could learn to walk, stand and sit 🙂

This is the end result of the robot build, strapped with the Raspberry PI, powerpack, LIPO and all wiring done:



The next challenge I had to overcome is now that I can control one servo, can I also control all 18 at the same time? And to make it even more challenging can I get some useful motion out of it 🙂

The solution lay in the software that came with the Bioloid kit, the software itself was pretty useless but they did came with some prescribed motion files for the robots. These motion files described some animations if using 18 servos that I could read and convert into my Java code. So all I had to do was build a converter from these motion files to an in memory structure that I could replay on the Raspberry.

The end result is visible here:

Remote control

The last piece of the puzzle for this post was the building of a small webservice so I could remotely control the robot. In my job at SDL I have supervised a team where I have architected and build a opensource REST OData framework (https://github.com/sdl/odata). This framework allows you to create very quickly a resource driven REST webservice based on the OData specifications (http://www.odata.org/)

In a few hours I managed to create a OData Webservice in the same Java project to control the robot. Moving the robot is as simple as calling a URL as following:


The code for this WebService is available in the same Github repository as mentioned before: https://github.com/renarj/dynamixel


I have managed to create a Robot spider controller by my Raspberry PI in a relatively short timespan (2 months). There are still tons of things to do like integrate sensors, pi-cam and more.

It is a great fun project, and has inspired me to take things to the next level with a next great follow-up project. I will post a bit more on that in the coming few weeks. Hope you get inspired to do this yourself as well, don’t hesitate to drop me a line with questions on the robot or code.


3 thoughts on “Raspberry PI Hexabot Robot powered by Java

  1. Hi Renze. Just found your blog and having a blast reading it. I’m determined to make a robot using the Pi and Java too. Not at the servo stage yet and spacing out the cost for now so my wife doesn’t freak out. How much did the kit cost you? My end goal is to build a robot like AMIE from the movie Red Planet.


    1. Glad you are liking reading the blog posts 🙂 The kit is a Bioloid Premium kit, which i used for the frame and servo components. This kit on its own is relatively expensive, i think it costed me around ±900 British pounds. You might be better off buying separate servo’s, this is something that I would do with the knowledge of today, as the controller and sensors of that kit are a bit useless and the reason why I have built my own Java/PI version 🙂 Good luck, and let me know if you have more questions.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s