Huey

Not Duey, not Louie.  Those are yet to be developed.

Huey is meant to be a research tool without any particular purpose other than trying things.  Huey has a compass, distance sensor and a rotation sensor for each of the wheels.  A long-standing goal was to get a PID control loop running and Huey was the test platform for it.  The main processor is an old RoMeo v1 from DFRobot.  The distance sensor is one of the analog Maxbotics devices, and the compass is a SparkFun HMC6352. Getting the rotation sensors going was a long process that involved a lot of trial and error.  Some of the problems included not having enough reflection from a simple pattern printed on my inkjet printer.  I ended up using aluminum foil as a background and then gluing a cut-out pattern on top:

Not too pretty, but it works great! The next set of mistakes involved the OPB-709 sensor that I had picked up during a visit to an electronics surplus store on the Left Coast.  It’s output is a photo darlington without a Schmitt trigger, so I had to add a 74LS14… a C or CH device would have been better, and because of the low voltage swing I ended up needing a 2K pull-down resistor to the input of the LS14 to get a clean transition as each edge came around. Once hardware was done, writing a PID control loop was next.  One of my first problems was using the standard Arduino Servo library’s Servo.write function… a range of 0 to 180 was very limiting when doing the calculations, so moving to writeMicroseconds helped. The basic idea is that you take the current speed (measured by the detectors outlined above) and subtract it from the desired speed (set by the application).  This is the error and will be positive if the wheel is turning too slowly, zero if moving exactly the right speed, or negative if turning too fast.  Next, multiply this number by a magic constant called Kprop and the result is added to the current servo speed control setting.  This is a P control loop; no I or D in it.  While I’m measuring speed, the values can be distance, time, number of wombats, etc.  The speed measurement and the desired speed must be in the same unit.  I happen to use Inches Per Second since that’s common in robotics. My wheels have a circumference of 8 inches and have 32 segments on my detectors, so that means each change represents .25 inch.  More or less.  Remember that depending on where the sensor happens to be looking, a wheel can turn almost .25 inch before the rotation being sensed. I ended up creating a new C++ class to hide the two servos with the intention of not only having PID control, but also locking the two servos in sync so when I specify a speed, it’ll try to get both motors spinning close to that speed so the robot moves in a straight line.

The IR receiver takes commands from an old TV remote that was laying around the house.

If you look at the Elenco Titan Tank page, you’ll see a robot we use a lot for Boy Scout projects.  Since I was writing code for Huey anyway, I added code to detect being “fired at” by the Titan Tank.  Huey gets really annoyed when Scouts are firing at it, so it’ll spin around until it’s pointing at the tank and will send a long stream of “fire” signals at it.  So if fired upon, Huey gets a bad attitude and will hunt down whoever fired at it.  The Scouts get a kick out of it.

Building a robot from scratch is so easy anymore given all the neat pieces that can be purchased off the shelf, such as servos, Arduino based controllers, chassis, wheels, distance sensors, IR receivers and tons of free code to control all the devices.  While I do have several Lego Mindstorm sets, they’re just not as satisfying as building from scratch.