Bugdozer’s Emitters and Phototransistor Line Detectors

Bugdozer is an autonomous mini-Sumo robot. The edge of the ring is painted bright glossy white as opposed to the matte, flat, black arena. This contrast aids a Sumo bot in detecting the edge (white line) and allows it to change direction before falling off the playing field.

Emitters and detectors

Emitters and detectors

The emitters (top row of three) are 3,000 MCD ultra-bright red LEDs - Everlight #383URC-2/TR1-C(R) T 13/4 5 mm water clear. They were purchased from All Electronics Corporation (CAT# LED-50) for 2 for $1.00. (Note: Ultra-bright LEDs are even cheaper and more available now, than when I originally wrote this article in 2000.)

The detectors (bottom row of four) are visible-light (800 nm) phototransistors purchased from Jameco Electronics, part number 120221, product number BPW77. They cost $0.99 each, but I bought 10 for $0.89 each. Phototransistors react much more quickly than do cadmium-sulfide photocells.

Three of the LEDs are interspersed with four phototransistors underneath the front scoop. The LEDs provide enough and consistent light for reliable, repeatable detection. Being underneath the scoop means false signaling due to ambient light isn’t a problem.

Having four phototransistors in a row allows for intelligent turning. Which phototransistors light up, how much they light up, and the order in which they light up, is used to determine the direction and method (pivot or spin) of turning around. This prevents turning into the edge as opposed to away from it.

I avoided placing LEDs on the far edges of the scoop to avoid a detectable light source bleeding out the side of the robot. Like most Sumo robots, Bugdozer doesn’t want to get hit on the sides!

The blue potentiometer (500 ohms) allows the amount of light emitted to be adjusted as needed. The resistor (150 ohms) nearest the potentiometer prevents damage to the LEDs if the potentiometer is accidentally adjusted to 0 ohms.

Each phototransistor has a resistor (22 kilohms) as a voltage divider. Each phototransistor connects to analog-to-digital converters on the MC68HC908GP32 microcontroller on the motherboard. This arrangement allows software to determine the cutoff point of reflectivity of the white border, rather than being stuck with the decision of a fixed-value logic IC.

The two stacks of washers are ballast to weigh down the front of the robot, also improving the center of gravity. If my scale is wrong, I can remove some washers before a match in order to meet the qualifying 500-gram limit.

Bugdozer lifting off? Bugdozer’s tail light

Left: Bugdozer lifting off? Right: Bugdozer’s tail light

Ultra-bright red LEDs were chosen instead of infrared LEDs for a couple of reasons:

The front emitters are blinked on and off every half-second after the start button is pushed, providing the operator with confidence that the countdown sequence has been activated.

Feeding wires under the blocks to get around the gears Feeding in and out of drilled holes

Left: Feeding wires under the blocks to get around the gears. Right: Feeding in and out of drilled holes

As all the wires feed through a single hole in the aluminum scoop, the tail light presented a wiring problem. To reach the scoop hole, the rear wires needed to pass the motor gear mechanism. I didn’t want the wires to jam the gears or for the wires to become broken or shorted.

To solve the wiring problem, the wires are feed underneath and between the friction pegs of the LEGO bars that form the body of the gear case. Entrance and exit holes had to be drilled in each bar to feed the wires in and out.

Bars and wires in place

Bars and wires in place

Once the bars are snapped into place, the wires are quite protected from both the gears and the wheels.

The rear line detector is used in case a turn or spin gets out of control, or to detect if Bugdozer is losing in a push or backing up due to a sneaky white scoop.

The rear reflective emitter-detector pair is higher off of the ground and exposed to different conditions than the front detectors. As such, a separate potentiometer controls the current flowing through (and therefore the brightness) of the rear LED.

A Bug!

Unfortunately, there was a software bug in handling detection on both the front and rear sensors at the same time when the robot’s right side is parallel to the edge. This bug has been corrected.

Let’s take a closer look at the problem and solution...