Skip to main content

Crawly creepy

There's a reason why human beings don't ever stand up and walk, any time soon after they are born.  In fact, for a long while, we prefer to do everything but elegantly saunter across the floor using our feet; dribbling, vomiting, screaming at maximum volume - often simultaneously, and for no apparent reason - being some of the pastimes that we initially feel will get us further in life (unless, of course, measured literally in distance travelled).

And ultimately it's probably because walking is actually quite hard.  It involves us prevailing against a ferocious adversary of nature: gravity.  And the discovery of a phenomenon called balance.  Clearly, all this is much too much for a little you who has only just learnt that it's not ok to chew on your iPhone.  Or iPad. Or just about anything else that generally shouldn't reside in the pits of human stomachs.

It shouldn't surprise you: this is in fact, equally applicable to robots (the bit about walking that is, robots are generally free to chew on anything they want, including people).

But now that our beloved Rosie has graduated from being a plastic box on wheels, into a 3D-printed mechanical contraption peppered with random servos that should be put to good use, we do need to get her to do something vaguely interesting.

To this end, let's accelerate her transition from robot newborn to baby by (somehow!) getting Rosie to creepily crawl. Uncles and aunties - get your camcorders ready.  We're one recording away from (another) YouTube robot epic fail video.

You don't want to be the tool without the tooling:

  • A Raspberry Pi 3, running Raspbian OS
  • Yes, you will need your very own 3D-printed mechanical thing of wonder, armed to the hilt with servos, and a servo controller of some description.  Incidentally, we soon discover that our servos don't actually give us enough torque. Boo.

Chequered history:

Building Rosie 2.0 - naturally - assumes that there is a Rosie 1.0.  For that reason, casting your eyes over the organised chaos that was Rosie and Rosie Patrol is highly recommended.  Having said that, most of the material here is based on what was *accomplished* (to use the term loosely) using Mr. Ted-E U.  That's if by *accomplished*, we actually mean made a stuffed teddy bear rave to 160 bpm dance music.  Some accomplishment, that is.

Bit by byte:

  • Get Rosie 2.0 all ready.  And armoured up.  Have robot paramedics on standby.  This will not be pretty.
  • Modify Python code to mimic the sequential movement of each of the servos in all limbs to (vaguely) reproduce the art crawling... and try again when you notice that it doesn't work.  And again. And again. Before giving up.

You ain't seen nothing yet:

The optimist in us thinks perhaps this isn't going to be as hard as it first seems.

After all, we made what has become Rosie 2.0's body perform all sorts of weird dance moves during a previous outing.

Can crawling just be another one of those moves, only now, lying unceremoniously face down on the floor?  Surely, crawling too can simply be described in a series of servo positions that need to be actioned over time?

That's the theory, anyhow. And it all looks good on paper (of the electronic variety).

And in fact, the reality isn't too far off. Except with the robot now running riot on its feet (and arms, and just about every other body part required to keep it upright), the laws of physics - especially Torque - tries their hardest to spoil our little experiment.  Let's see how.


There's been a lot going on lately, so let's do a little recap:
*We do not.

Our setup performed adequately, when we were simply demonstrating the movements of her joints while the overall frame remained attached to a stand.  We witnessed, crisp, speedy robot limb movement that filled us with misleading great confidence; and that we could possibly leave the world of motion behind and start to focus on the code to make the thing more intelligent, and useful. The new Skynet, if you like.

How wrong we were.

You see - robots don't tend to be unceremoniously bolted onto a plank of wood permanently.  People expect them to move around, by themselves.  And moving robot limbs independently using cheap-ish "hobby" servos - it turns out - isn't very hard.  But when it comes to supporting and moving entire robot anatomies, our old nemesis - torque - makes a dramatic return with a vengeance - in a "you didn't forget about me, did you?" sort of way.

And in the very same way you can pretty much define your budding robotics hobby by the period before and after the arrival of your 3D printer, when the thought of torque (or the lack of) starts to keep you up at night, you know your hobby has morphed into something else.

Let's remind ourselves what it is: Torque (τ) is a measure of rotational force, calculated using distance (r) to where the force is being applied, and the force (F) itself. Until now, r have been the individual lengths of Rosie's limbs that need moving, with F the measly weights of those components. But now that Rosie has been assembled together, top to bottom, and will be free standing, one particular joint (servo) may now need to actuate the movement of a vast proportion of her body.  Often against external force, like the friction of that horrible hotel room carpet.  You can see how we are now faced with an almighty challenge.

By the way, the equation for torque (τ) remains:

τ (Torque) = r (Distance) × F (Force)

Throughout, we've been making substantial increases to the distance (r) and force (F) variables of our robots.

Incidentally, the official SI (international system of unit) for torque is actually N-m (or newton-metre). Apparently the prevalent use of kg-cm in servo specifications causes some consternation amongst those that like to keep it real.

Back to the point.  Rosie is not going anywhere equipped with the HiTEC HS-311 and HS-422 "hobby" servos capable of a stall torque at 4.8V of 3.0 kg-cm and 3.3kg-cm without some drastic action.  Let's entertain the possibility of doing something quickly (and desperately) to keep this show on the road.

But before we do, here's a silly graphic to demonstrate how - in principle - the larger or heavier the robot, greater the torque requirement of the servos in the joints. 

Here are some potential ways to physically tinker with various parts of this equation.

ParameterHelp, what can I do? Quick!
τ - Torque
  • Probably the most obvious way of "getting more" torque is to get your hands on servos with a far higher stall torque value.  But beware; they are going to cost more, likely to be larger in size, and consume more power.  You may start to venture away from using "hobby" servos designed for remote controlled cars and planes, and become besotted by dedicated robotics servos flaunting a lot more torque and features.  But you may quickly reconsider, when you see the total of your online checkout basket grow to exceed your bank balance.
  • Some servos accept higher voltages for more torque.  For example, we are currently using a 5V / 10A power supply to power the servos.  Supplying 6V to the servos gives us a slight improvement in torque according to HiTEC documentation.  Not a game changer, however.
r - Distance
  • Perhaps the robot parts can be shortened, and the overall height reduced?  This might be a disappointing outcome, if you were planning on creating a humanoid robot capable of defeating the season's NBA champions at basketball.
F - Force
  • More realistic, perhaps, is reducing the weight of your robot.  Is it possible to reduce the amount of PLA used for the printing of your individual parts?  Can you use lighter material?  Introduce more gaps and holes in the design, without compromising the overall strength, and you might be onto a winner.

There are probably other practical things that can be done.  And clearly, you might need to do more than one of these to make your robot mobile.

Over time, we are going to attempt to do two of these things; improve the design so that less material is used when it is 3D-printed, and also to procure some "meatier" servos that are better suited for the task.

But - clearly - these things will take time (and money).  And in the meantime, we have a robot that is looking rather sad at the prospect of being neglected for some more weeks.

And that's why after that rather long-winded (and depressing) explanation as to why we're setting ourselves up to fail big time, we've returned to the mission of making Rosie do something that should be less taxing mechanically, and more importantly, allows us to demonstrate coordinated movement of the servos... crawling.

Let's return to IPython, and remind ourselves how to manually move the servos into position.


Remember our Adafruit 16-channel PWM / Servo HAT, and its library?  It's time to use them once again.

import Adafruit_PCA9685
servo_controller_1 = Adafruit_PCA9685.PCA9685(0x40)

At this point, we can start to dish out our experimental servo positions to test out various postures. For example, presumably Rosie wants to roughly see where she's heading. This is what we set for her two neck servos which happen to be connected to the HAT at channels 14 and 15:

servo_controller_1.set_pwm(14, 0, 340)
servo_controller_1.set_pwm(15, 0, 430)

Same applies to all other servos that we need to control.  Trial and error is the name of the game here. Lots of it.  But let's pretend that we now know what servo positions we need; and return our attentions to the Python modules we developed before for Mr. Ted-E U and pretend that we can define the "crawl" in the form of a single move.

For example, if we create a move called "crawl" and define 16 sequential servo positions for all our servos, can we (sort) of make Rosie crawl?

            "description": "Gradually crawl forwards",
            "gradual": True,
            "left_arm_servo_1": [270, 270, 270, 270, 220, 220, 220, 220, 270, 270, 270, 270, 220, 220, 220, 220],
            "left_arm_servo_2": [180, 180, 180, 180, 180, 220, 260, 300, 180, 180, 180, 180, 180, 220, 260, 300],
            "left_arm_servo_3": [180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180],
            "left_leg_servo_1": [220, 220, 220, 220, 270, 270, 220, 220, 220, 220, 220, 220, 270, 270, 220, 220],
            "left_leg_servo_2": [180, 200, 220, 240, 180, 180, 180, 180, 180, 200, 220, 240, 180, 180, 180, 180],
            "left_leg_servo_3": [320, 280, 240, 200, 320, 320, 320, 320, 320, 280, 240, 200, 300, 320, 320, 320],
            "right_arm_servo_1": [390, 390, 390, 390, 340, 340, 340, 340, 390, 390, 390, 390, 340, 340, 340, 340],
            "right_arm_servo_2": [180, 220, 260, 300, 180, 180, 180, 180, 180, 220, 260, 300, 180, 180, 180, 180],
            "right_arm_servo_3": [180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180],
            "right_leg_servo_1": [340, 340, 390, 390, 390, 390, 390, 390, 340, 340, 390, 390, 390, 390, 390, 390],
            "right_leg_servo_2": [180, 180, 180, 180, 180, 200, 220, 240, 180, 180, 180, 180, 180, 200, 220, 240],
            "right_leg_servo_3": [320, 320, 320, 320, 320, 280, 240, 200, 320, 320, 320, 320, 320, 280, 240, 200],
            "neck_base": [350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350],
            "neck_top": [430, 420, 410, 420, 430, 420, 410, 420, 430, 420, 410, 420, 430, 420, 410, 420]

Fire the Python code up, and you'll probably find your poor robot desperately struggling to do something on the floor.  You could vaguely call it crawling... if you're prepared to wait half a century for your robot to make it across the room.

It certainly requires improvement in lots of different ways.  I mean, who designs claws for crawling robots that serve no purpose, other than to get stuck in carpet?

But what we are actually now seeing is the devastating effects of our servos having insufficient torque.  Rosie is unable to recover, for example, when her arm is totally collapsed underneath her body.  Not even that, she's struggling to raise her arms (and more relevantly, the claws) to her side to stop them getting in the way of her forward push... the main reason why she's not propelling forwards very fast.  Sometimes, even lifting her arms or legs against the friction of the horrendous (unnamed) hotel carpet is too much.  All in all, her chances of standing up upright, and walking, is close to 0 in this current configuration.

But we haven't given up hope.  As we stated earlier, there really is a lot of work to do in the coming weeks.  We're going to have to get our hands on some meatier servos.  We're also likely to need to revisit the 3D design to make our components lighter, and start to 3D print those replacement parts.  We might even need to investigate a way of using a 6V power supply to get better performance from the HiTEC servos, without upsetting current draw.

But - at least - Rosie is starting to look like a robot capable of doing something.  Even if that something for now is to crawl across the floor (badly) like a wounded robot extra from the Terminator 8.  All newborn robots have to start their journey somewhere though right?

Go and see the doc:

We're continuing to use the Adafruit 16-channel PWM / Servo HAT, for which the documentation is here:



LoRa-Wan Kenobi

In the regurgitated words of Michael Bublé: It's a new dawn .  It's a new day .  It's a new Star Wars film .  For me .  And I'm (George Lucas, and I'm) feeling good .  Unfortunately for Canadian Mike, the Grammy that year was won by the novelty disco classic with the famous refrain: We love IoT, even in Planet Tatooine * . *Not true. Clearly, the Star Wars producers didn't sincerely mean the last Jedi the previous time around.  Return of the Jedi, released during the decade that spearheaded cultural renaissance 2.0 with the mullet and hair-metal , was less economic with the truth.  Either way, we're going to take inspiration from the impressive longevity of the money-spinning space-opera and reboot our franchise with some Jedi mind tricks.  Except this particular flick doesn't require an ever-growing cast of unrecognisable characters, unless ASCII or UTF counts.  In place of an ensemble gathering of Hollywood stars and starlets, we will b

Battle of BLEtain

The trolling . The doxing . An army of perplexing emojis. And endless links to the same - supposedly funny - viral video of a cat confusing a reflection from a dangling key for a golden hamster, while taking part in the mice bucket challenge. Has social media really been this immense force for good? Has it actually contributed significantly to the continued enlightenment of the human (or feline) race? In order to answer these poignant existential questions about the role of prominent platforms such as Critter, StinkedIn and Binterest, employing exceptional scientific rigour equal to that demonstrated by Theranos , we're going to set up a ground-breaking experiment using the Bluetooth Low Energy feature of MicroPython v1.12, and two ESP32 development boards with inexplicable hatred for one another.  And let them hurl quintessentially British expressions (others call them abuse) at each other like two Wiltshire residents who have had their internet access curbed by the co

Hard grapht

You would all be forgiven for assuming that bar , pie and queue line are favourite pastimes of the British .  Yet, in fact – yes, we did learn this back in GCSE maths – they are also mechanisms through which meaningless, mundane data of suspect origin can be given a Gok Wan -grade makeover, with the prime objective of padding out biblical 187-page PowerPoint presentations and 871-page Word reports (*other Microsoft productivity tools are available).  In other words, documents that nobody has the intention of ever reading.  But it becomes apparent over the years; this is perhaps the one skill which serves you well for a lifetime in certain careers.  In sales.  Consultancy.  Politics.  Or any other profession in which the only known entry requirement is the ability to chat loudly over a whizzy graph of dubious quality and value, preferably while frantically waving your arms around. Nevertheless, we are acutely conscious of the fact that we have spent an inordinate amount