How Not to Build a Robot

 

bad_robot
Can you spot the problems in this picture?

I learn best through experience. I learn the most through bad experiences. The picture above was a bad experience. Fortunately though, I did learn a lot.

Shortly after I got the electric wheelchair home I took the seat off, removed the plastic cover from the base, and started slapping on my hastily purchased parts.

In my defense, I had put some thought into what you see above, just not very much thought. And because I’m a tightwad and unwilling to shell out $200 for some connectors, boxes, and other small but very important accessories, I ended up with this hairball.

This post is a list of things I learned the hard way. Hopefully you can learn from my mistakes.

Secure Your Equipment

You’re seeing that right: scotch tape is what secures the Pixhawk and GPS to that platform. Wondering why you’re getting “Bad AHRS” readings in Mission Planner? The fact that your GPS and compass unit can wiggle +/-5° might have something to do with it. Especially if it’s taped to some cardboard that is then zip tied to your robot.

Even if the Pixhawk and GPS/compass unit had been adequately secured on my first iteration of this robot, a lot of other critical components should have also been more secure. Nothing holds the Sabertooth in place except for the 10 gage wire tied to the batteries. Nothing holds the RC receiver in place except the servo cable.

If you want a robust robot, then you need to secure everything. If it is loose, it will fall off your robot and get damaged. Related to securing your equipment…

Vibration Is No Joke

Vibration? That’s something the copter guys have to worry about, not us rover guys.

-Me, 2014

Boy was I wrong. It’s tough to see in that picture, but the cardboard is zip tied to a piece of .030 thick aluminum plate. That plate is bolted to a floor mount pipe flange. The pipe flange has a plastic pipe threaded into it that is then crammed into the seat pipe on the wheelchair base.

I don’t think I could have created more vibration problems if I had tried. What I made was basically a giant diving board to mount the Pixhawk to. You could watch the thing bounce up and down every time I started and stopped when driving in manual mode. I’m sure this contributed to the “Bad AHRS” I was getting in Mission Planner. Another reason to secure your equipment.

Wire Management Matters

When your robot is running over the loose wires hanging off the chassis, you have a problem. Wire runs should be as short as possible and zip tied to your frame. When I had to get my multimeter out to test continuity across wire runs that are electrical taped together, I should have stepped back and said “maybe there’s a better way to do this.”

Related to secure your equipment: wires conduct current, not mechanical force. Yes, I knew this before I slapped this monstrosity together, but this experience gave me first hand experience when a servo cable between the Pixhawk and Sabertooth came uncrimped because the robot ran over a wire tied into the Sabertooth.

Be smart with your wires. Even wire nuts are better than what I’ve done here. Rovers are nice because unlike the guys running RC planes or copters, weight isn’t an issue. But it’s no excuse to get sloppy.

An On-Off Switch is Mandatory

Would you turn on your kitchen light by reaching into an exposed outlet box on your wall so you can bend a wire to contact a terminal? Of course not, and just writing that sounds ridiculous.

But that’s how I powered on the robot, by taking a wire and cramming it into one of the battery lugs. It sparked something nasty every time I did it, and always created a nice little smell afterwards. But more importantly, that was pretty dangerous.

One nice improvement you can’t see here is a switch I jury rigged together after I got tired of the inevitable zap that happened when I connected the wire to the battery terminal. I had an old light switch lying around, so I wired it in by clamping the wire under the switch terminals. Did I secure it to the frame? Of course not.

Power Supply

The Pixhawk needs a nice, clean 5V supply. One of my favorite features of the Sabertooth motor controller is the 5V, 1A BEC output. Unfortunately, 1A really isn’t enough to power both the Pixhawk and any useful peripheral devices, like the GPS and especially the telemetry radio.

The 0V was wired into the − rail and the 5V was wired into the + rail of the Pixhawk. Using this configuration, I experienced regular brownouts. I’m not sure how much current my radio, GPS receiver, and PPM encoder were drawing, but it was enough to cause the Pixhawk to reset not infrequently.

You really need a good BEC that can output a few amps of current to make sure the Pixhawk is well supplied. I skimped by thinking the Sabertooth BEC allowed me to not purchase a good BEC.

Another downside, albeit a small one, was that without a good BEC there’s no way to measure current consumption or voltage drop across the batteries. With two 12V, 35AH SLA batteries though it’s really not a big deal, but it would be nice to get some information about battery state.

DC Motors and Magnetic Flux

twistercow
Your compass is going to have a bad time.

Brushed DC motors create a lot of magnetic interference. I would liken it to the movie Twister, except with magnetic flux. Your compass is the cow getting sucked into it. This has big implications for your compass reading and ultimately your heading.

When I did try to run the robot in Auto mode, it would weave left and right really bad if I tweaked the skid steer parameters just right, but mostly it would just run in circles, sometimes switching rotation direction. Toiletbowling is the technical term, I think.

I suspect this was because my compass was getting swamped by all of the flux created by the motors. The long cables carrying several amps probably didn’t help either. The ferrous pipe flange could have contributed. But because of all of the other jacked up stuff I mentioned above, I never did figure out the root cause. It was probably a combination of things.

Calibration could also have been an issue. This robot weighed 80+lb, and to rotate it about all axes for calibration was pretty much impossible, especially with the way my equipment was secured. So I was basically rolling with a half-baked compass calibration. So there’s that, too.

The Moral of the Story

I hope that wasn’t too depressing. There is, however, a moral to this story.

Robustness is important. You can’t trouble shoot a “Bad AHRS” error if the Pixhawk is bouncing all over the place. You can’t tune your skid steer parameters if you are experiencing brownouts every 5 minutes. You can’t calibrate your compass if nothing is mounted to your frame. Murphy’s law applies: if it can fail, it is going to. Spend the time and money to do it right. It’s not worth it to do it any other way.

Planning is important. If I had spent even 5 hours laying stuff out and making a wiring diagram, I would have been light years ahead. Where I work we have a saying, “an hour of design saves an hour of rework in the shop”. Basically, you save time and money by planning things out. It’s true where I work, and it’s true with robot building, too.

Go slow and pace yourself. It’s important to do things deliberately and methodically. I was basically just slapping things together trying to get it to work. Sometimes you will get lucky and things will work perfectly. But mostly, you’ll just end up discouraged about the lack of progress. Start with small bits and get them working, and working robustly. Then move on to combining the small bits into larger ones. Rome wasn’t built in a day. A good robot isn’t, either.

Unfortunately, this experience was so discouraging that I stopped working on the mower project altogether for a few years. The wheelchair sat in the garage collecting dust. But it was always in the back of my mind. I cleaned out the garage several months ago and decided it was time to give the mower project another try, but this time with a more deliberate approach. Next time I’ll give some detail about what I’m doing differently this go around.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s