Projects

Part 1: Walking Wildlife

ESP32-Controlled Robotic Elephant

Andy Clark & Daniel Koch

Issue 26, September 2019

This article includes additional downloadable resources.
Please log in to access.

Log in

Build your own walking 3D printed elephant and control it wirelessly from your computer or smartphone.

BUILD TIME: 1 Hour (Servo Testing Build)
DIFFICULTY RATING: Intermediate

A few years ago, we saw a picture in an engineering magazine of a man welding what appeared to be a life-size elephant. We wrote to the magazine for more details and they told us it was a chap called Frank Stuart. Further research led to learning about his company Mechanimal who made a number of petrol-powered elephants in the 1950s. These ride on elephants could carry a number of children around a park or zoo. Frank’s motivation was to cut the costs of keeping live elephants.

Back in the 1950s, an estimated 250 elephants were being killed each day for ivory and meat, which led to a world ivory ban in the 1990s. This is now down to 100 a day but as this is more than the number of baby elephants being born, elephant numbers are still declining. World Elephant day on 12th August was created to spread the message about this problem and to educate people on how they can help: http://worldelephantday.org

Inspired by Frank’s elephant, we set about designing our own mechanical elephant model and add some tech into it so we could control it remotely.

THE BROAD OVERVIEW

We looked at a range of different walking robots from the very simple to the extremely sophisticated. The key features we wanted were that it could move on its own without external wires and could be steered with some form of remote control.

We settled on this elephant model, which is moved by four servos, controlled by a web server running on the ESP32 board. When the forward button is pressed the servos walk the elephant forward. When the left button is pressed, the legs on the left take smaller steps causing the elephant to steer to the left. When the right button is pressed it steers to the right.

An elephant shaped 3D model was designed to house the electronics, with wheels and articulated knees to make the elephant move.

Assumed knowledge:

Servo Power

Issue #26

http://diyode.io/026pwqn

This project uses the Servo Breakout Board, which is described in this issue. The servo breakout board helps distribute power and data to servos using their common three-pin connectors.

We provide a compact PCB version and a solderable breadboard version, so you can easily build one based on your preferences.

The Fundamental Build:

Servo Testing

Parts Required:JaycarAltronicsCore Electronics
1 × Solderless Breadboard#PB8820P1002CE05102
1 × Pack of Wire Links#PB8850P1014ACE05631
6 × Pin to Pin Jumper LeadsWC6024P1016PRT-12795
12-Pin Length of Double-sided Header Pin Strip#--POLOLU-1065
1 × Arduino Uno or Compatible BoardXC4410Z6240CE05629
4 × SG90 ServosYM2758Z6392SER0006
4 × 150mm × 3mm Cable TiesHP1201H4033A-
1 × Piece of Balsa Wood---

Parts Required:

# Not required if you're using our Servo Power project.

It was necessary to first test the arrangement of the servos. We had to do this to ensure that our code translated from theory to reality, and to verify that the servos would do the job. At the same time, we were able to calibrate the alignment of the servos, and check whether they would carry the weight of a battery.

To achieve this, we cable-tied four servos to a piece of balsa wood, having marked the servo positions and drilled 5mm holes in the balsa for the cable ties. This gave us the ability to mount the Uno used for the test, as well as our servo breakout board described elsewhere in this issue, to the test rig. A battery could be either slung underneath, or rested on top. For the initial testing, we used external power.

In the Fritzing for the test rig, we show a breadboard. You could easily do this if you don’t want to build (or don’t have access to) the breakout board.

If you do use a breadboard, using sections of symmetrical header strip, the type with equal pin length on each side of the plastic, will enable you to plug the servo headers into the breadboard. Alternatively, you could use pin-pin jumpers. Of course, you won’t need to be testing this particular project, as we already have, but many people take these projects as starting ideas and go their own way.

If you are following these ideas for your own project, now is a good time to perform some electrical tests. With a multimeter set to buzzer or ohms, check for continuity between the positive incoming power connection to the breadboard or breakout board, and each of the servo V+ connections.

Also test whether 5V is arriving at the Uno. Repeat the test for ground connections. You may have to ease the pins out slightly to get a multimeter probe on them, but be careful that they don’t lose contact with the board or headers.

Now you can test continuity on the signal paths. Do this the same way, from the servo header to the Uno header. We have found that using an alligator-clip multimeter lead with a straightened staple in its jaws allows you to slide the staple-now-probe down the back of header connections between the wire and shell. This goes for the power connections above as well.

Test Observations

Now that the rig was assembled and electrically tested, we could test the code. In the original development phase, a similar rig was used to test a variety of algorithms for walking.

The more rigid rig was used as above. Two significant observations were made initially. Firstly, simple arm-swinging, backward-and-forward motion from servo horns was not enough to get the rig to actually move in any useful, linear way. This meant that some other motion-converting arrangement would be needed.

Basically, as there is equal friction between the servo horns on the bench, even with rubber pads added, the non-mobile horns at any given moment had no inclination to remain in place in preference to the horns that were moving at that time. The test rig moved, but in a random way and not all forwards.

Secondly, we discovered that the servos will work on 3.3V, such as that used in some lower-powered microcontrollers, but they had virtually no torque at that voltage, barely able to lift their own weight, let alone attachments.

This means that the system has to be 5V operated. At 5V, the servos draw around 300mA when in motion. This will likely increase in the final build, as friction and load become involved. While this dictated external power during testing, we still opted for 3.7V battery for the build to remain wireless. Consequently, we went with a power boost controller, rather than a step-down.

3D PRINTED MODEL

We'll get stuck into the full build next month, but before you can do that you'll need all the printed parts. We have provided a breakdown of all parts required, since there's a reasonable amount of printing involved. We'll go into it in further detail in part 2, but you can skip ahead if you'd like to.

Based on the learnings from our servo test, we designed the Elephant as a 3D model using Fusion 360. The .stl files can be downloaded from the resources section of our website.

The parts have been designed with one flat side and manageable overhangs and spanning. Orientate the prints with the flat side down. Note that you may prefer to use supports. The renders do not necessarily show optimum print angle.

EDITOR'S NOTE: Andy’s model was printed in a Silver Grey ABS from Rigid Ink. Including the test prints, that used about 40m of filament. We printed another model in the office using 3mm Polylite True Grey PLA Filament from Core Electronics, printed on a TAZ6.

A. SERVO CHASSIS × 1

The first part of the 3D model to be created was the servo support frame. Given the shape and size of the servos, they will influence the scale and form of the elephant. The frame was designed to hold the four servos, with added slots for the cables and screw holes for mounting the servos.

B & C. EARS × 1 each

You need to print 1 × right ear and 1 × left ear. These may need supports.

D & I. HEAD & NECK × 1 each

The head was a complex part to model, the best tool to create the organic shape was the “form” tool as that uses Nurbs to produce a curved shape. These could be pulled and pushed to create the shape of the head. You may need to add support, depending on your printer. You need to print 1 × head and 1 × neck.

E. Lower BODY × 1

The body needed to be hollow to house the electronics. This was made as a form then sliced up and emptied out using the shell command.

H. MIDDLE BODY × 1

L. UPPER BODY × 1

For the upper body, you may find it helps to slow the print speed as it gets near the top.

M. UPPER LEGS × 4

Next up was the leg. Frank Stuart's elephants had a wheel at the end of each leg. A simple forward/backwards motion combined with a brake on the wheels propelled the elephant forward. Hydraulics kept the elephant level and ensured the wheels were always on the ground. You will need to print 4 × upper legs.

F & G. LOWER LEGS × 2 EACH

You will need to print 2 × lower left leg and 2 × lower right legs.

J & N. WHEELS & PAWL × 4 EACH

For our elephant, it did not matter if the elephant wobbled so the hydraulics were not needed. For the wheels, we added ridges around the outside and a pawl to form a ratchet. The small size of the pawl will also benefit from a slower print rate. You will need to print 4 × wheels and 4 × Pawls.

K. TAIL × 1

What's an elephant without a tali?! The tail will likely need supports.

MODEL MODIFICATIONS

Several test prints were made to check the parts fitted together and moved as intended. Some of the components were flagged by the slicer as having invalid geometry. This usually occurs when two parts are very close but not joined. It can also occur when a part is too thin. If you can’t fix these issue at the source, tools like MeshMixer can repair the mesh for you. Fusion360 also has an inbuilt patch tool for repairing meshes by hand.