Creepy Crawlies

Arjen Lentz

Issue 2, August 2017

Meet a cool open source, walking caterpillar that uses 3D printing and Arduino, to teach kids about robotics!

Arjen from OpenSTEM in Queensland (Australia) has created a series of educational resources, but one that really stood out to us was his autonomous robot caterpillar. There’s something really awe-inspiring about machines that move without wheels or tracks, so we caught up with Arjen to find out how it was all done.

Thanks for taking us through your robotic caterpillar, Arjen; it’s so interesting. How did you first embark on this project?

We work with schools, and we were approached by the Parents and Citizens Association (P&C) for a distance education school, to be involved in their Enrichment Weekend for parents, where they would learn about specific topics and share experiences. At a previous event we’d explored 3D printers, which proved really popular. There, we talked about the RepRap project, which made all the cheap, modern 3D printing possible. We explained how it all works, from the engineering to the maths, to the chemistry. At this upcoming event, there was going to be a demonstration by the school using LEGO Robotics.

LEGO is great, but I remain unimpressed with its robotics. It’s expensive and limited in a very restrictive environment. Some may see those restrictions as an advantage, but the cost factor is a serious hindrance that prevents many schools from adopting it; and then, I do question how much students can actually learn using these kits. Now, our caterpillar does not directly address all of this, but it does reinforce the point that robotics does not have to be expensive.

So I promised the P&C person that I’d bring along a cheap robot - probably a caterpillar - that was, at the time, yet to be designed/built. It had been something I’d been meaning to get into for a while, so this was the ideal opportunity to get it done. I chose a caterpillar because they’re quite different; and its key feature would be that it has no wheels - wheels are so “done”! Most common robots use wheels (or similar) for their locomotion, but what happens is that many just end up being glorified remote controlled toys! Consider “Sphero” - nifty mechanics, but in the end it’s essentially a remote controlled ball!

I wanted to try something different, and had noticed that caterpillars were rare - there was very little information to be found online. I did locate one caterpillar online, from years ago, and it used polymorph frame segments, a PICAXE for brain, and distributed AA batteries. I wanted to make our caterpillar autonomous so that it would most definitely not be “remote controlled”. Clearly, it would have a “little brain” and this, along with its locomotion, would make for some excellent discussions with the kids.

The exoskeleton is a combination of 3D printed materials and servo motors.
The exoskeleton is a combination of 3D printed materials and servo motors.

We’re seeing so many great solutions for getting kids into robotics, and yours is an excellent example. Creating something that moves, which doesn’t have wheels is a fantastic challenge - how much trial and error was involved?

Ah yes, the “no wheels” is precisely what makes it interesting! Indeed, I had to figure out how a caterpillar moves. For lack of reliably trained caterpillars in my garden, I reverted to YouTube and watched videos from people who had gone through the effort of recording a decent stretch of caterpillar movement. It was great and, as it turns out, caterpillars move by something called “reverse peristaltic motion”; and this peristaltic motion is actually what moves food through our digestive system.

I used to do low-level C programming, so playing with Arduino and directly talking to hardware is right up my alley. The robotic caterpillar uses servos. I set them up to initialise to a position that seemed reasonable, and created functions to cycle them through their motion. They were wrapped in a function that would initiate “one full cycle” in one direction. This actually worked pretty well. I think that early on I had to adjust the starting positions once. I have to say, getting this part mostly right from the beginning was a really pleasant surprise!

Timing is also important, because we’re interacting with a physical environment. If you move too fast, you won’t have any grip. So the timing depends on what kind of feet the caterpillar has (mine are rubber), the surface it moves on, and its weight. Another advantage of building a caterpillar rather than something with wheels, is that no one tends to ask “how fast can it go?” or suggest we race it! It’s clear that caterpillars are not built for speed!

That’s so true! You’ve used ultrasonics for obstacle detection. What’s the range and the physical response to obstacles, and how fast does it work?

The ultrasound ping operates at the point of the movement cycle where the head is pretty much facing straight ahead. The code acts when it detects an object within 10cm straight ahead.

From experiments, I’ve found that the range of these sensors is quite fabulous. You can easily do pings across a room and get a fairly reasonable reading on distance. Given sufficient memory, you could use it to create a rough map of an area, which is refined from different positions and angles - but for that, you’ll also need a sufficiently accurate positioning system. This can be tricky to achieve indoors. There are neat projects (like “SubPos” by Blair Wyatt - an Australian), that achieve this by doing measurements from cheap WiFi modules across the room; however, it still requires more setup and cost, which I didn’t consider worthwhile for this particular project.

So the caterpillar doesn’t really know its position in space; it merely tries to avoid bumping into things. When it gets close to an obstacle, it stops, reverses three cycles, and then turns its head to the left and right to take another measurement. It will then move in the direction that has the most space (i.e. the farthest distance to an obstacle). The caterpillar turns by rearing its front legs into the air, then turning the left/right servos (that are in between the up/down servos along the body), then lowering the front, straightening out, and returning to normal motion. It’s a bit rough, but it works.

Arduino Nano works as the brain.
Arduino Nano works as the brain.

Straight forward obstacle avoidance is a great start to autonomy. The body is entirely 3D printed - is what we see the first design or did it take a few revisions to get right?

It took a few iterations to get. I had a mental image of what I was aiming for, but when translating that into the real world, things always need adjusting.

I used OpenSCAD to create the designs, as its programmatic spatial approach suits the way my brain works. I actually really like OpenSCAD, it’s a marvellous open source tool. I also downloaded the datasheet for the microservos to find out the basic dimensions and positioning of screws and the like. Initially I also looked at some examples of what others had done with similar servos (through Thingiverse and GitHub).

We’re fans of OpenSCAD too - there’s definitely little point in repeating the same thing someone’s already done, if it satisfies your purpose - this really is the true benefit of open source. You’ve started to implement a Gyro/Accelerator module. What are your plans for this?

Well, the system would be able to detect the slope, as well as the sideways angle. The slope information could be used to adjust the movement to to deal with steeper slopes up and down. It’s currently untested territory, but the code can work out the sideways angle, and thus figure out if the caterpillar has fallen over. Then, in principle, it would be able to initiate a wriggly manoeuvre to get itself upright again. This should be doable; however, at the moment the caterpillar is somewhat top-heavy because of the battery pack on its back.

It would take some work to get an auto-righting feature for sure, but wouldn’t that be amazing to see? No wheels usually means more power required - using the current setup, how long will it run for?

One should never use, say, a 9V alkaline battery - they really are quite useless. Distributing a number of AA batteries along the body is possible and I considered this, but it makes the engineering more complex and doesn’t necessarily provide a lot of runtime. After some “dry” tests (running poor caterpillar in thin air), and briefly borrowing a high capacity (1500mAh) LiPo from a friend, I opted for a LiPo battery pack. At the moment it’s a 7.4V 850mAh 2S LiPo, which is probably still overkill - I had to choose something so I went for a reasonable capacity with a fairly small size.

It will last for many hours. I use the caterpillar for demonstrations and robotics incursions at schools, and I always bring a charged spare with me but I rarely need it. I connect the LiPo via a UBEC (Universal Battery Elimination Circuit), which again is overkill but it provides me with a sane voltage (5V), plus a buzzer to warn me when the LiPo is running low. Arduino will run on 3.3V (so a 3.7V 1S LiPo would work for that), but the servos need a bit more, so that’s why I went for a 2S that provides 7.4V and then regulated it downward. I’ve played with booster circuits for other projects, but they often tend to be inefficient.

A few LiPo cells are also much lower in overall weight than many AA batteries - at least when comparing capacity per gram or similar! Of course, distributing 18650 cells (for instance) may prove useful if you need to extend battery life beyond what you have! What unexpected challenges did you face with this project?

I initially used TowerPro SG90 microservos - the really small blue ones that weigh a mere 9g each. They are cheap as chips because they get used a lot in model airplanes. But, the servo used for the caterpillar to “raise its neck” when turning, got really hot; so much so it actually softened and warped the PLA of the frame! I also noticed some of the other servos becoming erratic, so basically failing. After initially just replacing one failing servo, I decided to give the caterpillar a “caterpillaroptomy” - a complete spinal replacement from SG90 to the MG90 model, which is the same sized microservo, but with metal gears. They’re not much more expensive, and because I’d already proven the basic mechanism, it seemed worthwhile.

Fundamentally, I think the construction with the servos is mechanically problematic. No matter how you construct it, a lot of strain is placed on these tiny servos, which they’re not good with. The very expensive RobugTix T8X robotic spider also uses the microservos, and Adam Savage already reported burning out three servos during his test. I don’t think it’s a proper way to design things, and it seems quite irresponsible to produce retail products like this. In that context, I think it could easily fail the basic “fit for purpose” test.

The OpenSTEM Caterpillar was undertaken as an interesting experiment and an exploration, but remains one of our mascots who we take with us to schools and events. I think it’s great if other people want to also build it and learn from it, but I would not consider turning it into a retail kit.

Red and green lights on the head, a white one on the tail.
Red and green lights on the head, a white one on the tail.

You’re right - direct drive servos may not be an optimal long-term solution, but they prove the movement pattern, and are very fun to play with. If you had your time over, or were creating a V2.0 of this project, is there anything you would change?

I think the first design and implementation was very worthwhile, and quite necessary for learning the various important lessons. It now also has a red and green LED at the front, as well as a white “reversing” LED at its tail - just because we can. For our next generation of robotic caterpillar, I’m thinking about a structure that uses ligaments. I haven’t yet sketched this out... but I’ll try to explain here.

Imagine a tube, with rings at regular intervals. Some of the rings would have a servo attached, which controls two wires that are threaded through adjacent rings. So basically, a servo could pull on one wire, while releasing the other, thereby bending the structure. Two servos at 90-degree offset should provide full control in every direction. A few such constructs across the length of the caterpillar should provide a very functional structure.

It could also deliver other advantages: fewer servos required, lower power consumption, less strain on the servos, smoother external structure (could get a neat coat). It could contain the battery inside the tube, which would ensure the caterpillar is not top-heavy, plus there could be options for snake-style and other locomotion; perhaps even a waterproof version?

My lack of “abundant spare time” has meant that I haven’t yet created this new design!

I think we all have a lot of ideas that stay on the backburner due to time! What are you working on now?

After the caterpillar, I also built a little hexapod using three servos and paperclips. It was a very simple design by someone from the Gold Coast in Queensland (Australia). Again, this is just to show that robotics does not have to be complicated or expensive.

Kids have an excellent time working out that I’ve used paperclips! The caterpillar costs about $40 including the battery and possibly the UBEC(w/buzzer), the hexapod should be less than $20. Both are built around an Arduino Pro Mini, although observant eyes will notice that the caterpillar currently has an Arduino Nano brain.

Noting the low cost is really important - often robotics is made to be too shiny, and very expensive. However, using Arduino and other components, robotics really can be very accessible both in terms of complexity as well as pricing. The caterpillar has really proven that kids (of all ages!) are interested, and it shows them robotics doesn’t have to be all whiz-bang fancy!

At home, I have built a system that monitors the collector and storage vat temperatures of our solar hot water system, and controls the booster to only switch on when necessary (e.g. near the end of the day or early in the morning). Generally, a solar hot water system comes with a simple switch for the booster, so to make optimal use of the solar you have to keep it off, but remember to turn it on when you think it might be necessary. A simple Arduino setup (although mine uses an EtherTen from Freetronics, with PoE) can sort this out nicely - perhaps this is a good story for another time?

Robotics that resemble natural movements seem to quickly take on human or animal characteristics.
Robotics that resemble natural movements seem to quickly take on human or animal characteristics.

At OpenSTEM we’re busy with so many aspects of the Australian school curriculum, that I honestly haven’t had much time for R&D indulgences in recent months. Most materials we develop for classroom use doesn’t require electronics, computers or a facilitator to be in the classroom. They can be run independently by the teacher, without relying on tech or having to be online. This is because getting everybody online and having it all work and operate at a decent speed is a serious struggle in many schools around the country, including in cities (again, this is another story for another time). It’s important that students learn and practice important thinking skills, which do not require them to be online.

Awesome - thanks for taking us through everything Arjen. We can’t wait to see what you come up with next!