APC Australia

Meet Rocket, our DIY autonomous robot

Is a chassis necessary to build a robot? Darren Yates dived in to find out and in the process, created Rocket, a little chassis-less Arduino robot. Here’s how it happened — and how you can build one too.

-

Building an autonomous robot is a pretty awesome way to learn the ins and outs of Arduino and, over the years, we’ve built several robots within these pages. However, they’ve all required a commercial kit or chassis to make, which is fine — until the kit is no longer available. That made us wonder whether it was possible to make an autonomous robot just from the circuit boards, motors and other raw parts left over from previous robot builds, without a kit or plastic chassis holding it together. After much pencil-chewing, trips to the hardware store and the odd ounce of luck, Rocket, the no-chassis autonomous robot, was born.

NO CHASSIS?

The simplest way to build an autonomous robot is to start with a basic kit — there are plenty of options around, usually consisting of a plastic chassis base, mounting components, a couple of TT geared motor/wheel combos and a castor wheel of some descriptio­n. You’re usually left to provide the electronic­s and software code yourself. The problem was, none of the available kits were all that appealing — they were all just a bit plain. Our very first robot, the ‘Rolly’ Mk I, was built on the lid from a kitchen food container — it looked terrible, but it was much more fun to make than most ready-to-build kits we’ve tried. So in that same spirit, we stared at a bunch of components, scratching our heads at how to create a chassis-less autonomous robot.

ROBOT DESIGN

A basic robot design needs a minimum tricycle undercarri­age — two powered wheels to drive and steer, plus a universal trailing/leading castor wheel for stability. You can have four-wheel drive if you want, but the extra motors add little beyond extra load onto the battery. We already had a couple of spare TT motor/wheel combos, what we didn’t have was the castor wheel. Nor did we have anything to attach them to. Leaving that aside, the electronic­s was always going to be fairly straightfo­rward — an Arduino Uno R3 board with a Motor Drive Shield on top would take care of almost everything.

An HC-SR04 ultrasonic sensor attached to a tiny SG90 servo motor would serve as the eyes and neck. What’s great about the Motor Drive Shield is that it’s designed for this task — not only does it support up to four DC motors, it has two servo motor connection points, plus extra connection­s to the analog input/output pins ideal for the ultrasonic sensor.

GETTING POWER

The next question was how to power this robot. Some online designs use two batteries — a 9V PP3 battery to drive the Arduino board and a 6V battery to run the motors; others drive everything with multiple AA-cell packs. Having two batteries is just more work, so to keep things manageable, this would be a 6V-battery design based on four ‘AA’ NiMH cells — they’re cheap, rechargeab­le and easy to find. Online retailers sell a battery box with built-in power switch designed for four ‘AA’ cells and that’s when it dawned on us — the battery box could serve as a pseudo-chassis. After playing around with the layout for a bit, it worked out that the motors could be anchored to the under or ‘switch’ side of the battery box, while the electronic­s sit on the box top. Since the top came away from the battery box bottom, the AA cells themselves were still accessible, enabling them to be replaced and recharged. However, being NiMH rechargeab­le cells, this was more accurately a 5.5V-battery design, which would have ramificati­ons later on.

ANCHORING THE WHEELS

The battery box wasn’t designed with anchoring motors in mind, so the next best option was to try double-sided foam tape — this stuff sticks like the proverbial to a blanket. However, even before using the tape, it was clear there’d be little room to mount a castor wheel after the motors were in place. This was tricky because there needed to be enough surface area between the battery box and motors for the doubleside­d tape to grip, but not so much as to overly shorten the wheel-base (the distance between the drive wheel and castor wheel axle-centres) and make the robot tip over.

Hardware stores are great places to wander through and while searching for a suitable castor wheel, we found some useful 1mm-thick galvanised-steel right-angle brackets. They’re made by Carinya in China and measure 25 x 50 x 40mm — Bunnings have them for $1 each. The 50mm-long base could attach via double-sided tape to the battery box underside and would provide enough added length to enable a small universal castor to rotate through 360-degrees. The 25mm ‘lip’ facing up would also act as a bumper-bar ahead of the ultrasonic sensor. Things were

“A basic robot design needs a minimum tricycle undercarri­age — two powered wheels to drive and steer, plus a universal trailing/leading castor wheel for stability.”

starting to look up. The choice of castor wheel ended up being a 30mm Ambassador-brand unhooded plate furniture castor — these were $3.50 for a two-pack from Bunnings.

ELECTRONIC­S ON TOP

By good luck more than good management, the Arduino Uno R3 board and the Motor Drive Shield dimensions are just smaller than the battery box, so having these sit on top wouldn’t be a problem.

One slight annoyance was that the Motor Drive Shield had no header pins installed for the analog input/output, Vcc and GND pins. While the shield had dedicated pinouts for the servo motor, setting up the ultrasonic sensor would have to be a ‘home-brew’ job. Many eBay component retailers sell a row of 40 pin-headers spaced at 0.1-inch intervals for about $1 — these snap off easily to the desired amount and were soldered into position. The HC-SR04 sensor requires four connection­s — two for power (Vcc and GND), another two for data: one ‘send’ (trigger) and one ‘receive’ (echo).

WIRING UP THE MOTORS

Ordinary hook-up wire from Jaycar was used to wire up the motors. To reduce electrical noise from the motors feeding back into the Motor Drive Shield, 0.1uF capacitors were soldered across the motor connection­s. The wires were then cable-tied, twisted and brought up to the Shield and installed into motor outputs M2 and M3. The SG90 servo motor slotted into the ‘servo_2’ connection and the HC-SR04 sensor connected using dupont wires.

Four fresh AA-size NiMH rechargeab­le batteries were installed into the battery box, the source code flashed to the Arduino Uno and after checking everything twice, the battery power switched on.

INTERMITTE­NT PROBLEMS

The problem was, it just didn’t work properly. The code was checked and everything seemed to be connected up correctly — it only worked intermitte­ntly and intermitte­nt issues are the worst to try and troublesho­ot.

When troublesho­oting, it always pays to start with the power source because if the power isn’t right, nothing else will be. Everything here was wired up correctly, but the problem turned out to be my decision to use rechargeab­le batteries. Forget what’s written on the label — a fully-charged NiMH cell can give as much as 1.4VDC and four together around 5.5VDC, but drop nearer to 5VDC under load.

The way a Motor Drive Shield is normally used is to apply the main motor drive power directly to the Shield’s EXT_PWR terminal block (+M and GND) and choose whether or not to also send that same power down to run the Arduino Uno board by setting the two-pin PWR jumper. With the jumper in place, that motor voltage goes down to the Arduino Uno’s ‘Vin’ power-input pin — and this was where the problems started.

The Vin input connects to a 5VDC linear voltage regulator, which aims to generate a nice, clean 5VDC voltage rail to run the Arduino Uno with. The problem was, the regulator needs 7VDC minimum on that Vin pin to work correctly and it was only receiving 5.5VDC at best. It was enough to start the Arduino Uno, but as soon as the motors kicked in and the battery voltage dropped as a result, the Arduino Uno’s microcontr­oller chip didn’t have enough voltage to run and just turned off. Now with no load on the battery, the voltage rose again just enough to restart the Arduino Uno, setting off a nasty boot-loop. Basically, this robot build was starting to go pear-shaped.

STEPPING UP

Yet it wasn’t a total disaster — the designers of the Motor Drive Shield had cleverly allowed for the option of separating the motor drive power from the drive electronic­s through that simple two-pin ‘PWR’ jumper. With the jumper in place, the Motor Drive Shield’s power runs the Arduino. Remove the jumper and the Arduino Uno’s power rail is now separate.

This provided the germ of a solution. One of the many gazillions of gadgets you’ll find on eBay is a tiny 1-5V DC-DC step-up converter module — through some very clever design tricks, this device accepts anything from 1V to 5VDC voltage input and ‘steps it up’ to a steady 5VDC output at up to 500mA of current. Essentiall­y, it provides a second (more or less) independen­t voltage rail. The problem now was how to connect it into the setup — and this required some trickery of our own.

The way the Arduino Uno is wired, the voltage on the Vin input connects to the 5VDC voltage regulator and the 5VDC output of the regulator drives the Arduino Uno electronic­s. The Arduino itself provides an external link to this regulated 5VDC output for use elsewhere. However, what’s not commonly understood is that, if the Vin input isn’t being used, the regulator can be bypassed and the 5VDC rail driven directly — it’s essentiall­y what USB power does here. Neverthele­ss, in bypassing the regulator, you now take responsibi­lity for feeding the Arduino the correct voltage — muck it up and you can blow up the Arduino’s brain, the ATMEGA328 microcontr­oller chip. That said, the Motor Drive Shield very neatly provides numerous points to access this common 5VDC rail, so it was just a matter of removing the jumper, connecting the 5VDC output from the DC-DC step-up converter to one of the ‘5V’ pins on the Motor Drive Shield and we were back in business. So now, the battery directly powers the motors via the EXT_PWR terminal block, while the DC-DC step-up converter powers the Arduino Uno. All is well.

This seems a complicate­d method just to avoid a second battery, but now there’s only one battery to deal with — and NiMH AA-cells are more convenient than a 9V battery.

SOURCE CODE AVAILABLE

A word of warning — if you’re thinking of having a crack and building your own version, know this is not a simple task. Because of the unstructur­ed nature of this build, it’s not recommende­d for inexperien­ced builders and we cannot provide reader support. That said, we’re making the source code available on our website at apcmag.com/magstuff.

We’ve listed the parts we used to build Rocket, but only as a guide for your own design. Provided you follow the same component layout shown in the block diagram, the source code should still work, even if your bot looks completely different.

NIMH BATTERIES ONLY

Another thing, by using the DC-DC step-up converter module here, we cannot use standard 1.5V alkaline or Lithium AA cells — the combined 6V voltage from the four cells will likely swamp the DC-DC converter’s ability to regulate the output. The resulting voltage to the Arduino board may exceed the maximum 5.5V allowed and blow it up.

As NiMH cells also have a lower internal resistance, great care was required to check all wiring was correct and to ensure no short-circuits or reverse-polarity wiring occurred, which could cause catastroph­ic damage to the electronic­s or the NiMH cells.

TOP TIPS

We did have some luck during the build — the Ambassador-brand 30mm castor wheel had mounting holes that matched those on the angled bracket. We used 20mm M4 bolts and sufficient nuts and washers to offset the castor wheel height to match the drive motor wheels. This gave Rocket consistent height when the castor wheel moved through a full rotation.

The double-sided tape worked well for the components on top, but after a while, it stopped gripping the motors — we haven’t tried it but a hot glue gun should make short work of this issue.

LEARNING THROUGH TRIALS

In the end, our little robot build was a success, and with our rose-coloured glasses, it reminds us a bit of Robert Stephenson’s 1829 ‘Rocket’ steam locomotive. We couldn’t think of a better name.

Is it the best way to build a chassis-less robot? Of course not. It’s just one way — we’re sure you can think of ways to improve it. One of the key skills to have when making your own tech is the ability to troublesho­ot. More often than not, this leads into problem solving, looking at a problem from different angles and finding a solution that works. After that, tenacity, resilience and resourcefu­lness round out the top-five skills gained.

Still, these aren’t just good Arduino skills — they’re great life skills and it’s amazing how gaining confidence in one area can give a boost in another.

 ??  ?? An Arduino Uno R3 maker board is the brains behind Rocket.
An Arduino Uno R3 maker board is the brains behind Rocket.
 ??  ?? The block diagram of how Rocket was designed.
The block diagram of how Rocket was designed.
 ??  ?? This 4 x AA-size battery box with power switch is our pseudo- chassis.
This 4 x AA-size battery box with power switch is our pseudo- chassis.
 ??  ??
 ??  ?? ROCKET ROBOT — PARTS LIST
ROCKET ROBOT — PARTS LIST
 ??  ?? By good fortune, the angle bracket cutaway fits the battery box power switch. The castor wheel is aligned to the same height as the motor wheels.
By good fortune, the angle bracket cutaway fits the battery box power switch. The castor wheel is aligned to the same height as the motor wheels.
 ??  ??
 ??  ?? Cable ties anchor the motor wires in place to prevent stripping.
Cable ties anchor the motor wires in place to prevent stripping.
 ??  ?? Rocket, our no-chassis Arduino-powered autonomous robot. Rocket uses an ultrasonic sensor to see obstacles ahead.
Rocket, our no-chassis Arduino-powered autonomous robot. Rocket uses an ultrasonic sensor to see obstacles ahead.
 ??  ??
 ??  ?? The tiny red DC-DC step-up converter board sits next to the servo motor. The ultrasonic sensor is anchored to the servo arm using cable ties.
The tiny red DC-DC step-up converter board sits next to the servo motor. The ultrasonic sensor is anchored to the servo arm using cable ties.
 ??  ??

Newspapers in English

Newspapers from Australia