[Update: we won third place!]
HUL-10 is a robot the Super Joiner Bros. and I are building for the Make: Robot Build contest. We built version 1 to get something working in a short amount of time. This post describes the changes in version 2, which improves on version 1 and will be our final submission for the contest. The changes in version 2 include a new chassis, improved obstacle avoidance, and phototropic behavior.
Be sure to check my Flickr stream for more photos and video.
The majority of the components are the same as version 1. The new components are emphasized in italics.
- 10 CDs
- 2 rubber bands
- Small caster wheel
- ShapeLock plastic
- Stiff wire (10 gauge aluminum, I think)
- 3/8″ plastic conduit
- Miscellaneous hardware (screws, nuts, standoffs, etc.)
- Arduino Nano v3
- Half-size protoboard and jumper wires
- 2 GWS S35 STD continuous rotation servos
- 2 Sharp GP2D120 IR sensors
- 2 photoresistors
- High-intensity green LED
- 4 AA NiMH rechargeable batteries and battery holder
- Dimension Engineering AnyVolt Micro switching DC-DC converter
- Passive components (100 Ω resistor, 3.3 kΩ resistor, 10 kΩ trim pot, 2200 μF capacitor)
The version 1 chassis was functional and had some style, but for version 2 we wanted something really cool. The new chassis is a slatted cage that contains the electronics, topped with a small dome and antennae supporting the IR sensors. The whole thing is backlit from the inside with the Arduino’s blue LED and a high-intensity green LED. We scratched a HUL-10 logo on the top CD so that it is also backlit from the LEDs.
The cage is made from the outer rings leftover from cutting the wheels. The dome was made from ShapeLock, and the antennae are made from stiff wire and corrugated plastic tubing.
We wanted to make version 2 a little faster than version 1, so we fabricated larger wheels. I used the same CD spindle jig from version 1 and drilled a new hole in the base for cutting the larger wheels.
We replaced the ShapeLock servo mounts with a wood brace (painted black). This is a simpler solution, and also solves the problem we were having with the base CD sagging. We mounted the batteries and a small power switch on the bottom of the base CD as well.
User eckern on the Make: Robot Build forum let me know that the L293 driver was not necessary since the servos have built-in drivers. This made sense, and I confirmed it by measuring the current on the servo input signal (very tiny) and power (~100 mA). Version 2 drives the servo input signal directly from the Arduino digital pins and provides power to the servo through a direct connection to the batteries (not through the 5 V regulator). Removing the L293 freed up a lot of room on the protoboard.
We added two photoresistors for phototropic behavior. I soldered long protoboard wires to the leads and used heatshrink tubing for insulation and strain relief. Each photoresistor is connected as the pull-up side of a voltage divider. The right photoresistor has a 3.3 kΩ pull-down. This value was chosen to maximize the voltage range at the A/D under typical lighting conditions. The left photoresistor has a 10 kΩ trim pot as the pull down. The trim pot allows us to compensate for the manufacturing variation that is present in photoresistors. To perform the one-time calibration, we subjected both photoresistors to the same light level and adjusted the trim pot until both voltage dividers had the same reading. We also verified that they remained in sync as the lighting conditions changed.
If anyone is interested, I have released the source code for HUL-10, version 2.
The obstacle avoidance algorithm in version 1 used the IR sensor readings to independently adjust the speed of the servos; the basic idea was: the closer an object is, the sharper we turn away from it. This works very well, but could occasionally get stuck in corners when the distance to each IR sensor was such that both wheels would stop turning. I addressed this by only allowing one wheel (determined by the closest detected object) to slow down. Thus, in the same situation where the version 1 algorithm would stop both wheels, the version 2 algorithm always keeps one wheel turning.
This fix worked well, but accentuated a second problem: when in a corner, the robot would oscillate left and right, unable to figure out which way to go. I solved this problem by implementing a “hard turn” mode. If an object is closer than the “enter hard turn” threshold, we do not allow turning in the other direction until both sensors detect that no object is within the “exit hard turn” threshold. The exit threshold is farther away than the enter threshold in order to provide some hysteresis and guarantee that we’ve avoided the obstacle. The effect of this algorithm change is that instead of being confused, the robot commits to a turn direction until it has successfully navigated the corner.
New in version 2 is a phototropic algorithm that uses the photoresistors to make the robot navigate toward light. The algorithm is based on a few simple principles. First, obstacle avoidance takes priority over phototropism. Second, the phototropism is based on the difference between the readings of the photoresistors; this allows the algorithm to perform consistently under different light conditions. Finally, the motors are adjusted based on the principle: the larger the brightness difference, the sharper we steer toward the light.
This little robot is a lot of fun. We like to switch him on and run around putting things in his way or build mazes for him. The obstacle avoidance is pretty good, and the only time he gets stuck now is when he runs into objects in the sensor blind spots.
The phototropic behavior works well too. You can use a flashlight to guide him around, but even without a flashlight he detects shadows and bright spots on the ground and navigates around them. I wrote and tested a random motion algorithm to make him wander, but the phototropic algorithm makes it unnecessary: there are enough shadows and bright spots in a typical room to make him appear to wander from phototropism alone.
One interesting effect we observed has to do with HUL-10′s shadow. When driving away from a bright overhead light or window, he casts a shadow that sometimes falls on one photoresistor but not the other. This causes him to gradually turn back toward the light source (assuming there are no obstacles in the way).
One thing was clear to us as we were finishing HUL-10 version 2: we’re going to have to build version 3. We still have several ideas we want to experiment with; plus, we’re already seeing ideas on other people’s coasterbots that we want to try.
- Add a speaker and some sounds to give him even more personality.
- Modify the chassis or build a new one, borrowing ideas from simplebot’s Crepton (low profile, wheels inside CD perimeter, spindle case).
- Add bump sensor(s) to get out of situations when the obstacle avoidance algorithm fails.
- Experiment with monitoring servo current as a bump sensor.
- Experiment with ultrasonic sensors.
- Experiment with using more distance sensors or maybe a rotating sensor.
The following table of current draw was completed using the component datasheets and measurements made during operation. Conversion from the switching supply to the batteries assumes 75% efficiency.
|Component||Switcher Current (mA)||Battery Current (mA)|
|2 IR Sensors||54||54||72||72|
|AnyVolt Micro (quiescent)||15||32|
Our rechargeable batteries are rated for 1850 mAH, so we can expect 4-5 hours of run time from a full charge.