Dynamixel XL430-W250T Servo on Raspberry PI using Java

As I am recently building multiple robots at once (Hexapod, Rover and some other projects you can read on my blog) I was running out of Servo’s and wanted to buy a few more. At the end of 2017 Robotis has released a new series of Servos which I believe are intended to replace the trusted AX/MX series I have been using before.

I thought it was a good idea to acquire a few of the new servos to use in one of my new robot designs. In targeted the XL430-W250T servos which should be the equivalent of the AX12A servos from the previous generation. I bought in total 6 servos and tried to connect and control them using the same setup as I had before. In this post I want to detail out a few of the challenges I faced on controlling these servos.

Powering up

The first simple challenge I had was to simply connect the servos. With the AX12 servo’s I used a USB2AX stick to control the servos using the Dynamixel 1.0 protocol. This worked great on the old servos and I was hoping this was all backwards compatible also in terms of powering the servos. It turns out Robotis has made some changes that make it difficult to 1 on 1 swap the servos if you are upgrading from the AX12.

The main challenge is simply the connector, it’s still TTL based hardware but the connector has been swapped to a more universal JST plug. This does mean all my existing accessoires are useless like hubs, power supply etc. I am sure that once these servo’s become more mainstream this will change. I solved this by purchasing these converter cables that on one end have the old connectors and the other end use the new JST plugs.

After plugging in the servo’s to my old SMPS power board and the hubs, the servo’s came to life. I used the windows Robotis Servo Manager on first initialisation to set a unique Servo ID. It worked mostly like the old servo’s however some parameters have moved and have wider address spaces (4 vs 1 or 2 bytes on the old servos).

Dynamixel 2.0 Protocol

This brings me to the Dynamixel 2.0 protocol, this protocol is a newer iteration but based on the same principles as the old protocol. You send packages directed to either a specific servo (identified by the ID) or broadcast to all the servos. For each package you send you get a response package from that one servo, for example requesting the position, temperature and other properties.

Java on Raspberry PI

I have written a small library I can use to control the servos from my Raspberry PI in Java which also includes a dashboard for using and controlling the servos. For those that are interested it can be found on github here: https://github.com/renarj/robo-sdk

If you want to start the library please make sure you have maven and Java 8 or higher installed on your raspberry PI or other device (Mac is also tested and working, assume Windows works as well).

From the root of the git repository fire up the following command

mvn -f dynamixel-web/pom.xml spring-boot:run 
-Ddynamixel.port=/dev/tty.usbmodem1441 
-Ddynamixel.baudrate=57600 -Dprotocol.v2.enabled=true 

For the dynamixel.port please enter your com port connecting your USB2AX or other USB controller connected to your Dynamixels. In case you are using the new Dynamixel X series (or XL320) please set the protocol.v2.enabled startup flag to ‘true’ and set the approriate baudrate (default is 57600, but dynamixels out of the box are set to 1MBit, but the serial library I use cannot handle this on a Mac/Raspberry PI).

Once the software is started it should show the following line Robot construction finished

After starting you can acess the servo control dashboard on the following url:
http://localhost:8080

Note: Please replace localhost with the correct IP if running remotely

The Dashboard should show roughly the following:

Conclusion

I hope the above library will help people who want to use the new Dynamixel X servos in Java, it was a bit of exploring to get it to work, but all in all it is very familiar if you are already using the older Dynamixel Servos. As always I love using the Dynamixel servos and seeing this new series being available with some additional control parameters is really great news. Hope to use these in a lot more upcoming experiments going forward.

Feel free to use / share / fork / copy my Library for controlling these servos here: https://github.com/renarj/robo-sdk

Advertisements

Building a Hexapod robot part 1: Design & build

It has been a while since I have been writing and this coincides with me moving to a new house and my previous project simply was just done. I have been looking at a new challenge and have been dabbing and experimenting a bit. I had already been thinking for a while to make a hexapod robot and finally I pulled the trigger and decided to start building my own design Raspberry PI based Hexapod robot.

Based on past experience I wanted to simplify my design considerably and went to inspire my design based on some existing hexapods like the Phoenix hexapod form lynxmotion.

Let’s start with the basics what is the bill of materials for the base electronics components:

  • Hobbyking 20A SBEC (for powering the PI)
  • Raspberry PI 3
  • GrovePI+ board for sensor components
  • GrovePI Compass & Gyro
  • Turnigy Nano Lipo 3s 2200mAh
  • 18x Dynamixel 12A servos
  • USB2AX usb to serial adapter for Dynamixel TTL servos
  • SMPS2Dynamixel (provides power to servos)
  • 2* Dynamixel AX/MX Hub
  • 100 M2.5 Bolts of length 8mm + 100 M2.5 Nuts
  • 100 M3 Bolts of length 12mm + 100 Locking Nuts M3
  • 2 Spools of Filament (ABS)

Designing the Hexapod

Compared to the Rover robot I designed before I am now trying to keep things as simple as possible as overcomplicating things always made it a lot harder. Looking a lot at the Lynxmotion Phoenix Hexapod I inspired my design on this and am going to make a simple base frame where the legs are attached to and have legs with three degrees of freedom.

The frame will be a simply frame that allows me to connect all six of the legs of the Hexapod and nothing more. The frame will consist of 7 pieces which are the main beams that will connect the legs.

In order to give the frame some structure I will use the servo’s as the connecting piece so they are in essence part of the structure. For this I designed some brackets holding the servo which are also used to give the frame its shape. To finish the frame I designed two bottom plates holding the raspberry pi and power systems and on top of that two plates to close the robot up.

This is how the design looks in Fusion 360 for the baseframe:

Legs

For the Legs themselves I decided to stick to roughly the same design as some of the Robotis frame pieces for the AX12 servos as they worked well in the past. I replicated their design in Fusion 360 and modified it slightly so I can 3d print them and they will have enough strength once printed.

Each leg consists of the servo attached to the frame (coxa), which is then connected using two brackets to the middle servo (femur) and this connects with two small frame pieces to the servo controlling the feet (tibia). On the feet we have a special angled frame piece with a small nub on the bottom for grip.

This looks as following in Fusion 360:

This time I also made sure to fully assemble the robot prototype in fusion 360 before actually printing the robot, this makes it less likely to make mistakes causing a reprint, given the sheer amount of parts something that really will save me in the long run. After quite some tweaking the full design looks like this in Fusion 360:

Constructing the robot

My intention is to start sharing some building steps and share the STL files publicly so hopefully other people can repeat and also build this robot. Once I will do that I also want to share some building steps, so far I have not done that, hence all I can really share are some assembly pictures:

Body under construction:

Legs being assembled:

Robot completed:

Electronics

For the electronics I am sticking to some of the previous electronics work I have been doing in terms of powering the dynamixel servos and the raspberry pi. Here is a previous blogpost on how the electronics are wired together:
https://renzedevries.wordpress.com/2017/03/29/building-a-raspberry-pi-robot-car-part1/

What is next?

This was the first part of a series of posts on building some more simpler robots based on previous learnings. With the base design and build of the hexapod finished the next step is making it walk and I will write this up as soon as possible and hopefully share the design files as well.

From the design to the build version of this robot only took me 3-4 weeks, where previous robots took me many months to get them operational. I strongly believe keeping things simply has enabled me to do this, and will try to stick to this principle for future robots as well. I might in the future redo my previous Rover robot based on the same simpler frame design and keep things as simple as possible which might create more effective robots going forward.

I am planning to share the design of the 3D parts on Github soon, keep your eyes out for a link to the repository in the coming weeks.

Building a Raspberry PI Robot Car part 3: Wheel design

It’s been a while since my last post on the design of my robot car. The reason is that I have been moving to a new house and also have been quite stuck with the wheel design for my robot car, and it took many iterations to get the design right. This post is thus all about robot wheels and the design of creating an awesome drive system for the robot 🙂

Original Design

The first iteration I started out with a more traditional wheel design with a simple rubber wheel. This wheel has a suspension system with a spring based actuation based on a simple triangular geometry.

This looked as following:

There are quite some obvious challenges with this design, one being that if you have 4 motors/friction components meaning you can not really drive this setup without some form of active steering. My Design did not include this type and this was also not the intention, the wheel setup was to validate the suspension design. Altho the suspension was weak it was ok enough for such simple wheels and therefore I kept the basic design for the moment.

Wheel Design

The design goal was to create some Mecanum wheels that would allow omni directional drive system. I had looked into buying these wheels online, but seeing prices of 130-150 dollar for a set of 4 wheels I thought why not print them myself. Initially I looked through existing designs and settled with something that I found on a blog / thingiverse (http://pleasantsoftware.com/developer/3d/2010/04/23/its-printable/) and modified this to fit my Dynamixel Servo’s.

This resulted in the following wheel setup:

Altho it worked more or less, the main challenge here was that I never got the rollers to roll freely enough. This together with lack of friction made the drive quality quite poor and not reliable when driven in a ‘strafing’ mode for example as is visible in this movie:

Mecanum Wheel v2
Based on this I decided to take a fully different approach and start design my full wheel myself. I created a properly angled roller setup and used bearings for all the rollers. It took me many iterations and improvement cycles to get this right, there was always some challenge in terms of getting perfect frictionless setup. It took me as many as 20 prototypes before I settled on a final design.

Next to this the rollers where printed in a TPU based filament so they are more rubber like as you would have in real mecanum based wheels. This has significantly improved the wheel roller quality and resulted in the following single wheel setup:

Improved suspension

After having finished the mecanum wheels I found out the current suspension simply was to light for the more heavy wheels and there was to much flex in the system. Inspired by this Makeblock robot (http://openlab.makeblock.com/topic/567e4f409964feea3d37bbdb) I started a design and ended up with the following:

Driving the Rover

The result of this is quite good, the robot has a perfect strafe and axis rotation.

Hope this shows that it is possible to create a fully open source robot design with mecanum wheels that work quite well. If there is interest I can upload the 3D files to github in the coming period.

Building a Raspberry PI Robot Car part 2

In the last post we talked about the electronics, in this post I will talk a bit about the 3D design and printing of the components. I have recently acquired an Ultimaker 3D printer and after quite some experimenting has led me to be able to start designing my own components for the robotcar. In this blog I will try to walk through the design of the robotcar.

Designing the robot

The robot itself is going to consist of 4 main components:
* Casing containing the main electronics (Raspberry PI, power distribution, etc.
* Casing containing the LiPo battery that allows easy battery replacement
* Frame that supports both the battery and electronics casing
* Wheel / suspension mechanism to hold the wheels

Note: The printer has a maximum print size of roughly 20x20x20 cm, so this is the main reason that the casing for the power, electronics and frame are separated from each other.

The software
For the design of the software I started out with TinkerCad which is an online free based 3D editor. However I quickly ran into problems with dimensions which get quickly complex. I switched after this to Autodesk Fusion 360 which is a lot better if it comes to designing technical components, as a hobbyist it is possible to get a free year license.

Wheel / Suspension

The suspension design is a spring based design that will allow some form of flex in the wheel design. The wheel design actually needs to attach to a servo, the wheel itself is attached to the servo. For this I have designed a small bracket suited for my Dynamixel servo’s.

Next I have one beam that will have the spring attached to it and two static beams that connect to the servo holder. The static beams will ensure linear motion of the servo holder and the spring ensures there is dampening of the motions. This looks as following:

For the wheel design I will at some point dedicate a special post as they have caused me a lot of headache. For now I will use some standard wheels that fit onto the servo’s, but ultimately these will become mecanum based wheels.

Designing the frame

The beams used for the suspension are actually part of the base frame. There are going to be 4 wheels, meaning 4 beams that are part of the frame. In order to create sufficient surface for the battery and electronics casing I have connected the beams in a longer frame using connecting pieces. I have design an end piece for the end pieces of the frame and a middle piece to connect the beams all together. This looks as following:

Each of the beams has a length of 12cm, the middle piece is 4cm and the end pieces each 2cm. This gives a total length of 32cm for the robotcar, this is quite long but for the current suspension design it is needed as the suspension beams cannot really be shortened. In the future I might want to shorten the design by redesigning the suspension, however for now its good enough.

Battery & Electronics case

The main battery and electronics case has caused me a lot of problems and many iterations to get right. Every time you print it, there is something that is not entirely right. The tricks has been to measure, measure and measure again all the components you want to fit. I have in the end drawn out a sketch on paper roughly showing the placement of the components. Both the battery and electronics case have to fit in a fixed length of 16cm and 10 cm in width to fit the baseframe. The electronics case contains special accomodation for the Raspberry PI, UBEC power converter, two grove Sensors and the Dynamixel power board:

Note: The electronics casing will have a separate lid which will allow closing up the electronics compartment and allow easy access.

For the battery case its a lot simpler, we just need something to contain the battery. However one of the challenges is that I do not want a lid here, it just needs to be easily replaceable. For this to work there will be two covers on either end of the case that hide the wires but are far enough apart to remove the battery. A not here is that I used round edges instead of sharp 90 degree angles to allow for better printing without support. The round angles allow for a pretty decent print on my ultimaker, and its a lot better than having support material in the case. The case looks as following:

Assembling the robot

Here are a series of pictures of the various parts in stages of assembly

Conclusion

The process of getting to the above design and printed parts has not been easy. I have had for each component many, many iterations before getting to the above. Even now I am still seeing improvement areas, however for now I do think its close to being a functional robot car which was the goal. In the future posts I will start talking a bit about the software and the drive system with the mecanum wheels.

For those wanting to have a look at the 3D parts, I have uploaded them to Github, the idea is in the future to provide a proper manual on how to print and assemble with a bill of materials needed, for now just have a look:
https://github.com/renarj/robo-max/tree/master/3d-parts

Here is a last picture to close with of the first powerup of the robot car:

Building a Raspberry PI Robot Car part1

In the recent few months I have been very focussed on a few topics like humanoid robotics and robot interaction. Recently I have had some extra time and decided to take the next step and really design a robot from scratch. I thought for my first from scratch robot it would be handy to start simple and go for a relatively simple wheel based robot.

I will write a series of blog posts about the robot and how I am taking next steps to design and hopefully perfect the robot. In this first post I will discuss the basic concept and shows how I am going to power up the servo’s and control unit.

The robot concept

Let’s start of with setting the design goal of the robot:
Design an open source wheel based robot that has a holonomic drive solution capable of detecting obstacles and recognising objects it encounters

Given this goal let’s first start off with some basic requirements for the robot and what it needs to consist of. I will design this robot based on principles I have used in previous modifications of robots, this has lead me to these requirements:
* It will be based on a Raspberry PI based with Wifi
* Entire robot should be powered by a single LiPo battery for simplicity
* Distance based sensors for obstacle detection
* Rotatable vision camera
* Holonomic drive system where I can use four individual wheel servos for multi-vector driving
* Arm / Gripper for interaction

Servos

For the servos in this project I will for the moment re-use my trustworthy Dynamixel AX-12A servos which can be used in continuous rotation mode and therefore act as wheel servos. However given the desire to open source this project and the costs of these servos they will be replaced in the future, however for the first iteration it is best to stick to what I know.

Powering the solution

One of the important principles for this robot design will be that it needs to be powered by a single power source. In previous robots I always used the combination of the Robotis Lipo battery with a separate battery solution for the Raspberry PI. This has caused in multiple projects issues, like balancing issues or simply nowhere to leave the batteries.

LiPo Battery
In this robot I will use a single LiPo battery, I have picked a Turnigy NanoTech 3S battery with a 2200mAh capacity. This should be plenty to power the Raspberry PI and the Servos for a estimated 30-60 minutes, and easy enough to increase capacity in the future.

Power conversion
The Raspberry PI accepts 5 volt as input and needs roughly 1-2 Amps of current. In order to use a single LiPo battery I need a power converter as the 3S Lipo has an output voltage of minimum ~11.1 Volt and Maximum ~12.8 Volt. For this I will use a simple UBEC (Universal Battery Elimination Circuit) from HobbyKing. This Ubec can convert input voltages ranging from 6 volt to 23 volt into a stable output voltage of 5.1 volt with a maximum current of 3 amps, which is perfect for the Raspberry PI.

For the Dynamixel Servos I will use the Dynamixel official power converter a SMPS2Dynamixel . This can take input voltage up to 20 volts so can be directly connected to the 3S Lipo. All we need is a small 2.1/5.5MM DC power jack, I have managed to source one with a screw terminal but you can find different types.

Power wire harnass
In order to connect both the UBEC and SMPS2Dynamixel to a single servo I have to create a small power harnass that splits the power output from the 3S Lipo to both power converters. For this I have custom built a harnass using XT60 power plugs and some cables I have soldered together and put a screw-cap on the end to protect the wire ends. All is in the end topped off with some electric insulation tape, this looks as following:

Combining it all
Next step is connecting all the electronics. In order to control the Dynamixel servo’s I will use my trusted USB2AX which allows controlling the servo’s via a Dynamixel serial protocol. What remains is wiring up the power with a servo and the Raspberry PI. What better way then to show this with a picture:

In order to connect the entire solution I have had to hook the UBEC directly onto the 5v/Gnd header connectors of the Raspberry PI. Do this with extreme care, any wrong polarity will directly blow up your Raspberry PI. Make sure to check the pinning layout properly RED = 5v Black = GND and they need to go to the respected pin header on the Raspberry PI

Look at this slightly more zoomed in picture for the polarity / Raspberry PI Ubec connection and click on it for full zoom:

Next Steps

In this post I zoomed into the big project plan and in particular laid out the power setup. In the next post I will start with the 3D design of the robot and will show how I use Fusion 360 to create the design of the robot.