There was an error in this gadget


There was an error in this gadget


Recent Posts

Tuesday, February 23, 2010

Robobob: Life of the party

Dancing robots have been around for some time now, I'll give you that. Generally they are simply scripted lists of moves which are synchronized (or not) to a particular song. It took some hard work, but I've managed to take a different approach:

This dance isn't scripted! It's being generated based on the music being played, which means that Robobob will dance in time with any music you care to play to him!

Well, most music. The tempo is detected using a Fast Fourier Transform, which can separate beats and bass-lines from the rest of the music. This works great for songs with a strong bass component, but doesn't work so well on music composed of higher frequencies or vocals.

Simply place your robobuilder on the nearest sub woofer though, and you should be in business!

Watch in amazement as your robotic buddy dances along (almost) in time to the beat!

Impress your friends with his funky dancing styles consisting of over TWO distinct moves!

Saturday, February 13, 2010

Computers 103

The gnome is back! This time, he has a very important message for you about registers. Please give him your undivided attention, or there may be consequences. 0_o

I hope you are enjoying these comics. I will be making more of them, but I am also working on upgrading Robobob. I think you will be pleasantly surprised, so check back soon!

Wednesday, February 10, 2010

Computers 102

For your amenity, the next installment of "inside your CPU" is avaliable below. If your screen is big enough, you shouldn't even need to scroll. The previous issue can be even be found here. Convenience!!

(If you don't get the joke in the last panel, it is because the "take one down" action will eventually set the zero flag in the status register, but the "pass it around" line will never set the zero flag. The branch instruction can only know about the results of the operation immediately before it, so the gnome will eventually die of alcohol poisoning. THINK OF THE GNOMES!)

In other exciting news, the source code I used to make this video is now avaliable. You can find it here. There are a few improvements and bug fixes.

Tuesday, February 9, 2010

Computers 101

I'm taking a little hiatus from the epic how to build your own robot series for a few reasons.

Firstly, there is a LOT to cover. I'm writing this as a sort of trial run for how I might explain it to first year university students, and as we all know - firsties are only marginally more intelligent than the rats they experiment on. With so many topics to cover, I'm faced with either giving 10 second "just take my word for it" style advice, or deviating from the topic every paragraph to explain the reasoning behind the statements I've just made.

The other problem is that it isn't fun to read. It's very technically dense and wordy, and I feel that if I can't hold the reader's interest then there isn't much point in me spending all this time explaining it. After writing the how to choose servos article, I really felt that I should have introduced it with an earlier article about exactly how they worked and what they were used for.

So to remedy this, I've decided to take a different approach to the rest of the series. Before I start spouting off about software and microcontrollers and interrupts, I'm going to give you some background on the subject in general – just so that everyone is up to speed when I use terms like instruction set, word size or stack overflow.

What's more, to keep things interesting the lessons will take place in funky 8-bit comic style! Enjoy!

Build your own humanoid - Part 2

Last time, I started going over a basic outline of how you might go about designing your own humanoid robot.

After I finished writing part 1, I realized that there is a lot more to cover on each topic than I am able to explain in a single post. All I am covering here is a design methodology - one of many possible procedures. This means that if I skim over a topic or don't go into sufficient detail, you will need to do a bit of research on your own to fill in the blanks.

After deciding upon the number of degrees of articulation you intend to build into your robot, I suggested that the next step should be to draft up some approximate measurements for the arms, legs and body.

Some people find this difficult. Coming up with a number for a length or a weight almost without any input information seems pointless and arbitrary, since there are so many variables which affect and are affected by your decision. This is why I emphasize the inexact nature of these dimensions at this stage. We will come back and refine them once we have more details.

If you have the time, the tools and the expertise required to draw up an exact model of all the designable variables and how they correlate to each other, then this is a perfectly acceptable method. I personally find the iterative method is easier and less prone to mistakes.

At this stage, you would do well to open up a spreadsheet and enter all the values you have chosen so far. You can quickly sum up all the masses and lengths (warning: trigonometry), and it will help you quickly calculate your servo requirements.


Servos are not the only type of actuators you can use, but they are certainly the most commonly used. I'm going to assume most people will choose to use servo or stepper motors, but don't feel limited by this. You might want to use a combination.

There are two main alternatives to electric motors. The first is pneumatic actuators, like the ones used here:

The other option is shape-memory alloy, known as muscle-wire or nitinol:

Both of these have niche uses, but you will find that servo motors are more general purpose.

Unlike normal DC motors, servos are motors which can be commanded to move to a specific rotational angle. To achieve this, they contain a feedback loop which will keep turning the motor in the right direction until it reaches it's destination.

I could go on for pages about the specific inner workings of a servo (and I probably will someday), but right now we need to concentrate on three technical specifications:

Torque. When searching for servos, they should all report a stall torque in kilogram-centimeters or ounce-inches. These numbers represent how much weight they will be able to lift (on planet earth) at a distance of one centimeter or one inch away from the axis of rotation. More is generally better, but will come at a higher price.

How much do you need? This is why it is so important to have a rough idea of the proportions of your robot. I forgot to mention it before, but now would be a good time to also estimate the weight of your batteries and other heavy components.

Lets assume you want to choose an appropriate servo for your knee. The knee servo will be required to lift the entire weight of the robot from a crouched position to standing.

To calculate the torque, you multiply the weight by the horizontal distance between the axis and the center of mass.

 T = Fxd

In the above example, the robot's body weight is centered over it's hips, which is 5cm from the knee. His upper body is about 750g, so 0.75kg*5.0cm = 3.75kgcm is required to get the robot stand up.

He also has two knees which can work together, so really each servo only needs to have 1.9kgcm to stand up. However, when he walks we can assume each leg will need to work independently, so we should stick with the original value.

So use your estimated lengths and masses to come up with some numbers for the torque on each joint. You will have to imagine the most difficult movement your robot will be required to perform in order to find the necessary values.

  • If you aren't sure how much your robot will weigh, remember that we are trying to build an under 1kg robot. If you know it can move 1kg, it will be enough.
  • Similarly, the time your robot will be required to deliver the most torque is when it has fallen over. If you are unsure, use half of the robot's height as the distance, since this is representative of the single servo being used to stand up.
There are much more complex methods of calculating the required torque, but there isn't much point in going to the trouble since you mostly just estimated values anyway. If you're having trouble, here is everything you ever needed to know about everything.

Now you should have an estimate for the value of each joint. This is the minimum torque you will need to move the joint. Since your estimates were pretty sketchy to begin with, you should add a factor of safety to ensure you've got enough. I would suggest increasing all your estimates by 50%, or even more if you don't feel confident about your calculations.

Mass. Servos which deliver more torque are generally larger due to the fact that they contain more gears and heavy duty parts to withstand the extra forces.

Heavier servos will increase your requirements for torque. Sometimes, this will be unavoidable, but it's effects can be alleviated by making your robot shorter.

You can also reposition heavier parts so that they are closer to the axis you are rotating around. This will reduce the power of the servos you need and make your robot lighter overall.

Speed. The price of a servo is usually determined by it's torque and it's speed. Fast, strong servos will be particularly expensive, so it's important to only get what you need.

Rotational speeds are measured in seconds per 60 degrees. This is the time it takes to complete one sixth of a full revolution - lower means faster.

Not all of your servos will need to be lightning fast - only walking and balancing will require a lot of agility. The proportions of your robot will multiply how fast the limb will move. If you've designed longer legs, you won't need such speedy servos to walk at a reasonable pace.

In particular, the ankle joints usually only need to move through about 10 degrees in a step, which means they can be much slower than the rest of the servos in the legs without impacting the performance.

Now that you know what properties each servo needs, you will have to search around to find one which matches.

It's pretty unlikely you will find exactly what you are looking for, but thats fine. Near enough is good enough - up until now everything has been pretty approximate, so no reason to stop here. Remember that the point of this exercise is not optimization - just getting a robot with two legs on the ground is all we want for now. Here are a few more things to consider when choosing servos:

  • Metal gears will save you a lot of trouble.
  • A lot of robots simply get one type of servo for every joint. The advantage of this is that it's easier to repair and easier to build since you only use one set of parts. However, your robot will be heavier and more expensive than it needs to be.
  • There is more than one way to control a servo. Digital and analog servos require 50Hz PWM control, but some robotics servos use RS232 or RS485 protocols. Right now it doesn't matter which you choose, but make sure all of them use the same method.
  • Many servos offer extra features like adjustable PID parameters, overload protection and position feedback. These are valuable additions, and you would be wise to take advantage of them.
  • Most servos have a limited range of rotation. Often, this is around 270 degrees, but can be as little as 90. For most joints, 270 will give you a sufficient amount of freedom, but check you have enough.
Here comes the important bit. Having chosen a servo for every joint on your robot, go back and do the torque calculations again. This shouldn't be hard if you've put everything in a spreadsheet - just use the new torque and mass of every servo you've chosen, and make sure that your requirements are still met.

Chances are, you will find that most of your initial estimates were reasonable. If you find that one servo doesn't have enough power to move the robot anymore, you will either have to upgrade that one, downgrade one of your heavier ones, or adjust the dimensions of your robot. This may cause a cascade of other things to change, but that's just the catch 22 of design. Keep adjusting and recalculating until everything fits.

Wasn't that fun? No, it wasn't really. But at least now you know that the money you are spending on parts won't be wasted.

    Thursday, February 4, 2010

    Build your own humanoid - Part 1

    Not long ago, I spoke about the advantages of humanoid robo-one style combat over battlebots/robot wars matches.

    I started thinking about how difficult it might be to start up a competition at my university. Would people be interested? Would it be too expensive? Too complex? Perhaps I would be wrong about people appreciating the tactics and design over brute force destruction.

    So I thought I'd walk myself through the process of designing and building a small (under 1kg) humanoid robot, to see how it might play out. Keep in mind that while I do know a lot about humanoid robots, and I also own one; I have never build one from scratch before. I do have experience building other robots, but not walking ones.


    First of all, lets have a look at how other people have gone about it. This is often a very good first step when you are uncertain about a project.

    One of the first things I notice about these robots is that they are humanoid, not human. When it comes to designing robots, people often get very caught up in biomimicry, without stopping to think about why they are imitating nature's design. In the case of both these robots, the proportions have been modified to make it easier for the robot to balance and walk.

    As a general rule, shorter and squatter will make your life easier later on down the track. Keeping the robot's center of mass low will also make him harder to knock over.

    At this stage, you will also need to decide how many degrees of freedom you want your robot to have. To robotologists, a degree of freedom is a controllable aspect of the robot. In this case, it refers to the number of joints your robot will have and therefore how complex his actions can be.

    Bottom line is, more degrees of freedom means more versatile actions, but at the additional cost of more servos/actuators.

    Now, since we are trying to build a humanoid robot, the most attention needs to go to the legs. Robobob has 5 degrees of freedom in each leg. He has two ankle servos, one knee servo, one thigh servo and one hip servo.

    I would consider this a pretty good number, but you could get away with removing either the hip or one of the ankle servos and manage.

    So that's 10 controllable degrees of freedom just for the legs.

    The torso doesn't need to move at all, but giving it the ability to rotate will help allow your robot to shift it's weight quickly to maintain it's balance. Adding one additional servo won't break the bank, and it will contribute a lot to the moves you can perform.

    Arms can be as simple or as complex as you like. They do contribute to balance and walking a little, but far less than the torso or the legs. If you are building a robot to fight or wrestle, you will need arms to achieve this. However, if you have a torso which can rotate, all you will need to do with the arms is to raise and lower them in a flapping motion and rotate. If you take this approach, you can get away with as little as 13 servos.

    Of course, the exact implementation is up to you. It will depend on your budget and your requirements.

    Robobob has 16 degrees of freedom. 5 for each leg and 3 on each arm. This has worked out so far for me, and 16 is actually on the low end of kits available.

    If you want to have more than this, I would definiately consider adding them to the legs. A lot of robo-one robots use the double-knee joint, which allows them to stand up and walk twice as fast. The ankles also have a very big impact on how your robot will be able to walk, so if you can get x, y and z rotation on the ankles you will appreciate the advantages.

    The next stage is figuring out the approximate dimensions of your robot. I say approximate, because there is every chance that a design decision you make a little further on down the track will will require you to rethink his shape (eg, servo, battery size and weight).

    Draw up a skeletal model of your robot and come up with some trial values for the distances between joints. Here are a few things to consider:
    • Taller Robots are easier to knock down because of their higher center of gravity
    • Longer legs mean faster movement.
    • Shorter distances between joints will require less powerful servos.
    • Longer distances between joints will move the limb much more quickly.
    • Leave room for your batteries and circuitry.
    • Make it look cool! It's not all about optimizing numbers.
    At this stage, keep it simple. These dimensions will help you select appropriate servos for your needs. If you aren't sure, have a look at existing humanoids and see what works. I will go over a more detailed design in the future.

    Next time, I'll talk about choosing the right servos. As you can tell, there is a bit of a catch-22 about design, since your choice of servos depends on your dimensions, which in turn will depend on your servo choice.

    Tuesday, February 2, 2010


    Ladies and gentlemen, I give you: Robobob!

    You may recall that awhile back I opened my inbox to email suggestions for a good name. I actually intended to draw the name randomly or put up a poll, but once I started calling him Robobob the name sort of just stuck.

    So here he is, in all his 16DOF glory standing up to a withering barrage of socks from all directions.

    Once again, he has no gyroscope or accelerometer - he is simply using kinematic feedback from his servos to keep himself stable. The algorithm is almost identical to the one I used way back in this post - but he can now withstand attacks from all directions.

    You may notice that he always moves with the force that he is being subjected to. This is the same way that humans usually react - recoiling from a blow or a source of pain. I think it gives him a bit of a personality.

    Monday, February 1, 2010

    Tremble before DISHZOR!

    People are often surprised them when I tell them that my favourite robot is the dishwasher. Not Megatron or ASIMO or the roomba - just your ordinary, garden variety dishwasher.

    You see, there isn't much of a consensus regarding what defines a robot as a robot. Some people think they need to be humanoid. Others feel that robots should include sensors and actuators. Computers and software are often mentioned.

    One of the broader, but generally well received definitions is that a robot is a machine of some sort, capable of performing tasks on it's own. Begrudgingly, most people will admit that this would include dishwashers. And washing machines, printers and even modern cooking appliances.

    Thats right - robots have already invaded your home and you didn't even realise! Insidious!

    I think one of the reasons that these everyday robots have slipped under our radar is that we don't have such high expectations of them. We assume robots should be smart, since they are capable of performing the same tasks which humans can - but we tend to assume that tasks which are difficult for us are difficult for everyone.

    Sci-Fi has led us to bestow a level of expectation on a robot which is based on their appearance. For example, dog shaped robots tend to be about as smart as actual dogs, despite the fact that their positronic brains could make them just as smart as a human. Robotic bugs will behave exactly like real bugs would, even though they have no reason to seek dark places or put on threatening displays.

    In the case of dishwashers, we tend to assume that machines shaped like large bricks will have an equivalent IQ. That's probably why I find this so much less impressive than it actually is.

    It's no small feat, but it just seems that a multi robot system like that should be capable of so much more.

    This phenomenon also means that as soon as you give your robot a humanoid form, people suddenly have much higher expectations. I think this is why modern demonstration robots are given infant-like designs - if the robot reminds people of a five year old, then they will be that much more impressed when it walks without falling over or grasping objects.

    So if you are ever trying to demonstrate how smart your robot artificial intelligence is, remember to make it look stupid so that people will be extra impressed. It also helps to avoid the uncanny valley.