Tag Archives: Robotic arm

The brain of the Automate-IT robot

I recently posted an article about the automate-it robotic arm. I promised to go into more detail on the brain of the Automate-IT robot so time to awake you inner geek because here is a write up about the controller hardware and software that brings the thing to life.

Controller Hardware

The hardware for the controller is an Arduino Yun microcontroller. In case you’re not familiar with Arduino according to the their website: “Arduino is an open-source electronics platform based on easy-to-use hardware and software. It’s intended for anyone making interactive projects”. There are different Arduino compatible boards available. The Yun is a special one because it combines an AVR ATmega 32u4 chip with a System on a Chip running Linux on the same board. Both are connected via a serial bus. A bridge library provides an API which enables a developers to integrate the Linux SoC into Arduino projects. The SoC part of the board provides WLAN, Ethernet, MicroSD card slot and USB Connectivity. The SoC is running an openWRT linux distribution which runs a webserver and some other services. The webserver can be manipulated from the Arduino code. This makes it very easy to build an http API on your Arduino powered device.

The board can provide about 50mA of power. All servo motors combined can draw up to 3Amps so I needed something a little bit more powerful. I choose the LM123K voltage regulator which gets its juice from a 12v brick type power supply. The voltage regulator magically converts it into 5v. I put the LM123K on a piece of perf board and added headers to connect the servos. Male headers on the bottom of the board turn it into a very simple Arduino shield. It doesn’t look pretty but it works fine.

Voltage regulator on top of Arduino Yun
Voltage regulator on top of Arduino Yun

Controller Software

The roboticArm library

The arm is programmed by recording the exact position of all the joints step by step. With each step the time it takes to execute the step is stored as well. Putting the arm to work is just a matter of playing back the recorded sequences. My roboticArm library implements this logic and presents it as a single class. The object instantiated from the class represents the robotic arm and stores a pointer to a recorded or empty sequence. The object can be in recording mode or in playback mode. When in recording mode the current position in the sequence can be selected and the positions of the servos can be set. It’s also possible to add or delete steps from the sequence.

In playback mode the step number will be automatically increased when the recorded duration for a step is expired. At the end of a sequence the playback will be stopped until the step counter is reset to 0.

My library uses the Arduino servo library so there is did not develop any servo control code. But since this isn’t a dedicated Arduino or development blog I won’t go into too much detail about the actual code. If you’re interested feel free to download the RoboticArm library.

Using the library

Below is an excerpt from my controller code. I did not actually test the code below and it is not very usefull since it doesn’t include any code to program a sequence. But at least the servos should come to life and go to the position configured in the defaults sequences.

The REST API

The controller presents a REST API via the linux part of the Yun. The beauty of the Yun is that you can actually code this API in the Arduino code. Unfortunately this also means there is no framework available that makes creating a REST API easier. And even if there was I doubt it would fit in the Atmega’s RAM or Flash. The first thing to tackle when creating a REST API is the routing. Routing basically means figuring out what we need to do when a certain URL is requested. You could read the request and use a huge switch case contruction to figure out where to go. but this uses up valuable program storage and ram in a microcontroller. On top of that I find it cumbersome to program in that way. So I used a slightly different approach. I use a URL structure that looks like this: http://RESThost/category/command/parameter. Based on that I wrote the code below:

To figure out which function to run my code uses 3 arrays. The first is an array of strings (or technically a two dimensional array of characters) which defines the categories we have. The second array is a three dimensional array of characters which defines the commands available for each category. The last array is a two dimensional array of function pointers. When a request comes in the code looks for the corresponding element in the first array. Then it know the index number of the category so it starts looking for the element matching the command in the second array. When the command is found the code knows both the index number for the category and the command and uses these index number to find the pointer to the right function in the third array and runs the function. If the function need any parameters the rest of the URL is read and used as parameter. For example: http://roboticarm/status/record will start the function statusRecordCommand() which toggles the recording mode flag of the roboticArm object.

Putting it all together

I made the whole project available for download. You can find it here: robotic_arm. Don’t forget to also download the RoboticArm library and put it somewhere the arduini IDE can find it. The download also includes the AJAX Gui to program the arm. This was my first time building such a gui so it doesn’t like very nice and the code can probably be optimized. So feel free to modify the code and send me the results :).

Disclaimer: The code was only tested on Arduino Yun. The library will run fine on any other Arduino as long as you configure the correct pin numbers. The REST API and Ajax Gui will not work on any other Arduino board currently available.

Meet the Automate-IT Robot

Time for a less serious friday afternoon post. Meet our new friend: The Automate-IT Robot a.k.a. r2vco2. It’s a robotic arm with a special feature: It can be controlled by vCenter Orchestrator.

Robotic Arm

When I was preparing for the yearly ITQ Technical update session I was thinking of a way to show vCenter Orchestrator can do much more then just automating vSphere tasks. What better way to show this that control something physical from a tool that’s usually used in the virtual world? So I decided to try and build a robotic arm.

The Bones

The bones of the arm are 3d printed using an Ultimaker Original. Of course the type of printer isn’t that interesting. But what is interesting are the 3d models I used. Thanks to thingiverse it only took me a few minutes to find a 3d printable robotic arm. I also foudn some modifications to the original design which I ended up using. Here a the links to the different projects I used:

I recommend using the openSCAD version of the design. I initially used parts of the original design but the gripper didn’t work for me. So I replaced the top arm and the gripper for the openSCAD parts. Also I needed stronger servos for rotation and the lower arm so I used the parts modified for MG995 servos. So the only part I used from the original thingiverse project is the middle part of the arm.

Gripper

The Muscles

The robot’s muscles consist of  5 hobby servos. Those are the same kind found in RC cars and airplanes. For the rotation and the lower arm I used the TowerPro MG995. You can find them on e-bay for a few bucks. The other servos are the very small 9g servos. This means that they weight only 9 grams which is a good thing considering they have to be lifted by the lower servos. Oh, and you;ll find them really cheap on e-bay as well.

All the servos can draw a considerable amount of power from the power. A little over 3 Amps if all motors are at full power. This cannot be supplied by a micro controller or a USB port so I build a simple power supply. It consists of just one voltage regultor  (LM123K) and two tiny capacitors. The LM123 converts 12 volts down to 5 volt and can deliver up two 3 Amps. It doesn’t need cooling to do this and the thing turned out to be fool proof. I hooked it up the wrong way a few time but it still lives.

Voltage regulator on top of Arduino Yun
Voltage regulator on top of Arduino Yun

The Brain

An Arduino Yun is the physical part of the robot’s brain. The Yun is a development board that has an AVR micro controller and an SoC running openWRT in one package. It is equiped with LAN, WiFi and an micro SD Card slot. The cool thing is that the Linux part of the board runs a webserver which can be used from the AVR part of the board. Arduino provides a bridge library to aid communication between Linux and AVR. Using this library it is relatively easy to build a web API on top of your micro controller code. And that is exactly what I did.

The software for the brain is a rather simple sequence recorder/playback device. So I can program positions into steps which are put into a sequence. Everything is controllable via a REST like API. I used the API to create a very simple AJAX web interface which is served by the linux part of the Yun as well. But I didn’t stop there. I created a few vCO workflows which are able to control the robot. The vCO REST Plug-in makes this very easy.

I’ll write more about the software and the vCO integration in a follow up blog.