Building BEAM robots is lots of fun. I get to brandish red-hot pokers at molten metal while placing jewel-like bits in a beautiful yet functional electronic sculpture. The end product is a gee-whiz contraption that can amaze friends and frighten animals. The real reason I build them, though, is to learn. So, let’s dive beneath the surface of amusement into the depths of knowledge. Perhaps then we may improve on the original idea and breathe life into a robot of our own design. Let us join fellow scientists and attempt to glimpse “the mind of God” and be awed and humbled by the comparison.
Turbot bottom view.
I’ve read lots of books about electronics and built every project in the Radio Shack Electronics Learning Lab often to come out with not much better understanding than when I started. I made lots of gadgets and they almost always worked, but I often wasn’t sure why. I learned best when a complicated project failed to work. Then I had to break it down into segments and test each piece to see what wasn’t working. That way I really understood what each part was doing.
I took on the Turbot as a step up from the Solarbotics© Photopopper because of its more complex behavior. I love the Solarbotics kits because they pack a lot of apparently intelligent behavior into very simple circuits. They’re also excellent quality for very reasonable price and the documentation is not only exquisitely clear, but actually fun to read. When I found no tutorial to walk me through the Turbot, I decided to figure it out for myself. The result was The Turbot for Dummies as I would want it written for myself with step-by-step hold my hand agonizing details and lots of pictures and diagrams.
To try to understand the Turbot just by tracing the schematic was to give myself a headache worthy of Excedrin Migraine. The state of one part of the circuit depended on another part whose state was not at all obvious, especially when it looked suspiciously like an oscillator. Since I was a kid, I always learned best by taking something apart step-by-step and, hopefully, putting it back together. That’s what I was going to have to do with the Turbot. But before I took it apart, I needed to examine the Turbot, its anatomy and the behavior I was trying to explain.

The author, Jim Phelan, examining the Solarbotics Turbot.
I was also going to have to take notes as this was going to get complicated. Making notations on the schematic as I probed, the brain would show me a picture of what was going on and I need pictures. I started with photocopies, but found it easiest to download the Turbot manual .pdf file from Solarbotics and spit the schematic page out of my printer as I needed one. Solarbotics_Turbot_Kit.pdf I could then label the parts of the schematic and indicate voltage readings. To make this tutorial I scanned a blank schematic and used Paint to draw the status lines. I also made a spreadsheet with a column for each pin of all three chips and a row for each state of the Turbot as to which eyes were getting more light and which were dark. I coded the chips with colored labels, shaded the background of the spreadsheet columns and colored the schematic with matching highlighters to reduce confusion. Even so, I fought to keep inverting buffers A and B straight! To be exceedingly scientific I recorded the actual voltage on the spread sheet, but just high or low would be sufficient. I used a green Sharpie pen to indicate a positive voltage, high or on state and a red one for ground, low or off. It also helped to have a data sheet from http://www.alldatasheet.com/ on the 74AC240 octal inverting buffers and the 74HC86 XOR gate chip. They show the supply, ground and output enable pins that aren’t indicated on the schematic.
Standard Anatomical Position
Which way is which? Since the Turbot travels by tumbling head over heels & rolling side to side, to have ANY chance of understanding this critter, we have to establish some orientation and sense of direction. In other words “standard anatomical position.”
Which side is the top? Logically it should be the prettier side: the side with the logos, lettering, on/off switch and power LED. This is the battery side. SC1 is therefore on top and SC2 is on the belly along with the stall LED appropriately near the butt. Neatly label your ‘bot “Top” and “Bottom.” Label the schematic SC1 “Top” and SC2 “Bottom.”
Which way is front? The point with the standoff spacer looks more like the nose to me, but that would put the eyes IR1 and IR2 in the rear. That won’t do. So the battery holder is the nose. That makes IR2 the right eye and IR1 the left eye. Label your eyes R and L on the schematic and on the ‘bot itself. I like to color-code the R eye red and the L eye green.
Click for larger images
 Schematic Basic #1 |
 Schematic Basic #2 |
 Schematic Basic #3 |
 Schematic Basic #4 |
 Schematic Basic #5 |
Turbot Behavior
Arm movement: It makes no sense to call them legs as this thing doesn’t really walk. They act more like arms articulated at the shoulder. Like a swimmer doing the butterfly, only backwards. This is the part that makes me bang my head against the desk and keeps me re-writing this paper! The turbot tumbles backward by waving its arms forward. Great! How do we make sense out of that?
First let’s change the arms to wheels. Just unscrewing the arms isn’t sufficient as the wheels are just a bit too small to lift the ‘bot off the ground. [Random thought: How about slightly bigger wheels next version or some rubber tires to go on the wheels to fatten them up just a bit. ? Solarbotics does have appropriate wheels in their catalog. And it would help to put some kind of caster at the battery pack nose end to prop it up.... Unless you changed the center of gravity by moving the motors forward.... But then you’d have to move the eyes.... And it would help if you made the wheels more parallel instead of at right angles to each other.... And then -- you’d have a different robot altogether. Ah, well, as I was saying....] After failing to find suitable Lego Mindstorm wheels, I just wrapped a layer of foam tape around the wheels. By putting it on a hardwood floor it was able to drag itself along. Put a bare lamp in the middle of the floor in a dim room so we can explore its behavior.
When placed right-side-up it does indeed waddle toward the light. On its back it waddles directly away from the light, contrary to the documentation that says it parallels it. In either case, the motor direction is the same. If you grab one of the wheels and stop it, the stall indicator illuminates and one, then the other, motor will reverse until the stall condition ceases and the motors return to their normal direction. This normal motor direction will be called forward regardless of which direction it makes the ‘bot go. Label your motors top and bottom as to whether they’re right or left and which way is the forward motor rotation [R fwd..., ...fwd L].
Observe. On its belly, light in the right eye makes the left motor run forward and makes the left wheel move forward turning it toward the light. Light it the left eye makes the right motor and wheel more forward. Light makes opposite wheel move forward. It waddles toward the light. On its back, light in the right eye makes the right motor run forward which, since it’s on its back, makes the right wheel move backward. Light in the left eye makes left motor run forward making the left wheel move backward. Light makes same side wheel move backward. It shuffles away from the light. This makes sense.

A simple voltmeter and schematics were all that were needed to find out how the Turbot “thinks.”
Now put the arms back on and throw away the foam tape. Here’s where all logic breaks down. The arm movement causes almost the exact opposite of wheel motion. On its belly forward rotation of the right motor makes the ‘bot flip backward and right-over-left in a peculiar way. If it started on its belly looking North, right arm forward motion leaves the ‘bot on its back looking West. Left motor forward rotation makes it flip backwards and left-over-right. Belly looking North becomes back looking East. I believe it is this 90? turn when flipping that makes it appear to travel perpendicular to the direction toward the light. When both run forward, (actually rapidly alternating combined with the ‘momentum’ circuits) the ‘bot does a back flip. When it is on its back, it does a back flip onto its belly. More to one side or another depending on the light. That this critter does anything resembling logical behavior may be an emergent property not easily predictable by its relatively simple right/left up/down operating characteristics. To be sure, four eyes and two motors wired in almost any configuration would create some consistent behavior. Whether that behavior would appear purposeful is another question. I’d like to substitute reversible & swappable pin/plug pairs for the motor leads to explore various mutations of motor wiring. What if you cross the motor wiring? What if you reverse one, the other or both? Would your mutated ‘bot survive in the Robojurassic era?
Brain Surgery
Now that we have some appreciation of the behavior, we’ll need to do brain surgery to probe the mind of the Turbot. First obtain satisfactory general anesthesia by turning the power switch OFF. Next remove the arms so you won’t have the patient flailing around on the operating table later. Place the patient in Standard Anatomical Position by doing the following: Point the ‘bot toward you, right-side-up. Flip it over right-to-left so it’s belly up still facing you. Reach out your right hand, palm up. The scrub nurse will slap a small Phillips head screwdriver into it. Can you tell I wanted to be a neurosurgeon? I did, thanks to Ben Casey, until I hit Neuroscience class and found out I couldn’t make heads or tails out of that blob of Jell-O salad. Compared to the human brain, the Turbot is infinitely more manageable!
Begin your incision by unscrewing the four bottom screws & bolt. Drop each with a dramatic clank into a stainless steel basin for later use. Now flip the patient right-to-left onto his stomach again keeping the skull intact. Open the skull by gently separating the sandwich while carefully unplugging the three header pins at the tail. Flip the top battery side away from you nose-over-tail so the wired corners point to each other. Now you can get at the brain. Remove the other bolt & standoff spacer to give better exposure.
The 3-pin header and the motor wires are like the corpus callosum in the brain allowing communication between the two halves. If we sever this connection by unplugging the header, the S/(-)/(+) sensor messages won’t get to the chips. I decided for simplicity to replace the header assembly with a 3-conductor cable. I also extended and soldered the center neg wire to the solder pad at the top end of the stand-off spacer to make a convenient ground for future measurements. Here’s a quick-and-dirty alternative: Stick three wires (I didn’t have to tell you to strip them first, did I?) in the header socket at the tail of the electronics side. Wrap the other ends carefully and snugly around the corresponding pins of the battery side without bending or shorting the pins to each other.

Backlighting allows illumination of the ‘bottom’ photocell.
Now flip the battery side over right-to-left so that SC1 and the power switch are back on top. Be careful not to unplug the connecting wires as you twist them around. The motor wires will also be crossed. The disassembled ‘bot should now have it’s battery side right-side-up facing away from you on top and the electronics side chip-side-up facing toward you on the bottom. See pictures if you’re lost.
Connect the negative (black) lead of your voltmeter to the middle (negative) pin of the header group. (Or the neg solder pad if you did what I did.) I like the alligator clip or the little hook grabber thing that I can stick on the probe of my voltmeter. This is the patient’s ground. Set your meter to accommodate 6v. Now you’re ready to read the mind of your creation.
Eventually you’ll need to work on a glass table over a lamp or something to allow light to shine on the bottom photocell while you’re probing the ‘bot. I used a clear plastic book holder for my operating table. I used blobs of putty used for mounting posters to keep the ‘bot in place and to cover the right or left and top or bottom eyes. It helps to have an assistant record the observations as you call them out so you can keep your eyes and mind on the pin count and your hands in the operating field.
Now awaken the patient by turning the power switch ON. Although your patient’s limbs have been amputated, motion should be detectable at the stumps. Depending on the shadows on the right and left eyes, one or both motors will start cranking. Cover its left eye IR1 (on your right) with a wad of putty. If it’s sitting on a transparent surface, put a wad of putty on the bottom SC2 also. Be sure there’s plenty of light on the top eye SC1 and the right eye IR2 (on your left). To be a doctor you have to keep it straight that it’s the patient’s right and left, not yours. Be sure your light source is placed so it won’t be shaded by your body as you work. Since these are infrared sensors, it helps to have a warm incandescent light source instead of a cool fluorescent one. Now only its left motor (on your left) should be turning counterclockwise, forward. Move the putty cover to its right eye IR2 and the right motor should turn clockwise, forward. Try uncovering the bottom SC2 and covering SC1 on top. Note the arm movement as you shift the light left<-> right. Now go back to top SC1 uncovered, bottom SC2 dark, left eye covered, right eye light.
Now let’s start reading this ‘bot’s mind one neuron at a time starting with the upper left of the schematic.

Examining the circuit during a simulated motor stall.
Power Supply
Check your full battery voltage with the positive red probe at the positive header pin. Should be ~5.5-6v if your batteries are good. Anything over half the full battery voltage counts as high; anything less is low. There shouldn’t be much doubt. Everything should be one extreme or the other. The only exceptions might be at the photo cells if they’re pretty evenly lit and at the pins associated with the stall circuit as they change with the stall condition. There, just measuring the voltage can cause a voltage drain and cause a low state setting up the stall condition. Later we will take advantage of this property.
Power switch & indicator
No-brainer here. Battery connects through power switch SWT1 to the positive (+) supply and to the positive end of LED L1. Color that part green. The other end of the battery and LED L1 connect to ground. Color that side red. The 1k current limiting resistor R1 keeps the LED from burning out from an otherwise direct short across the power supply. Switch closes, power goes on, LED lights green. “It’s alive!”
C5
A small filter capacitor to cancel out any transient spikes in the power supply.
Optical Sensor Voltage Divider
Note that IR1 and IR2 are diodes installed backwards against the current. Instead of changing forward current to light like LEDs, these infrared diodes permit backward current flow in proportion to the light they receive. To a light sensitive diode more light = more conduction. The cool thing with a voltage divider like this is that the absolute amount of light on the diodes doesn’t matter. Only which one gets more light. If they’re the same, their resistances are equal. Therefore the point between the diodes gets half the voltage (~3v) between the positive source (~6v) and ground (0v). If the upper diode in the diagram (the left eye) gets more light, the midpoint sees less resistance toward the supply voltage than toward the ground. Therefore its voltage is higher than the midpoint reference voltage and is therefore high. If the lower one (the right eye) gets more light, then the midpoint is better conducted to ground, therefore low. When combined with the XOR gate the voltage divider is like the Electoral College. It takes a majority vote from the various states and turns it into an absolute win or loss. Color the ‘wires’ on the schematic from the upper diodes to the (+) green; from the lower diodes to the ground red. Color the left eye IR1 and the bottom eye SC2 black as they’re in the dark. Leave the other two light. In this situation the midpoint of IR1 and IR2 is better conducted to ground though the illuminated right eye so is therefore low. Color from IR2 to the midpoint and over to pin 1 of the XOR red. The midpoint of SC2 and SC1 is also better conducted to ground through the illuminated top eye SC1 and therefore also low. Color from SC1 through the midpoint and over to pin 2 red.

This view is of the chip side of the Turbot bottom. It helps to label the parts.
Logic Cascade
The eXclusive OR gates convert the subjective relative brightness of the diodes into concrete values of positive voltage vs ground, on and off, high and low, yes and no. After these logical yes/no decisions are made, the circuits can again become emotional with the motors offering either positive energy (high) or being grounded to drain away stress, er, voltage (low).
XOR Pin 1: More light on IR1 (left eye) means more conduction from the battery, higher voltage at the midpoint between the IR’s and a logical high state or positive voltage at pin 1 of the first XOR gate. More light on IR2 (right eye) means more drainage to ground, lower voltage at the midpoint and a logical low state or ground-like voltage at pin 1. With the negative (black) probe grounded, touch the positive (red) probe of your voltmeter to the small XOR chip (74HC86 Quad Exclusive-OR IC) at pin 1 (nearest the little dot on the top near the notch). If our analysis above is correct, pin 1 should read near 0 volts (I got -0.22) Note in your spreadsheet X1 low or -0.22 (or whatever you got).
XOR Pin 2: Same story with SC2 and SC1. Right-side-up means more light on SC1 on top of the ‘bot (bottom of the schematic). This means more conduction to ground, lower voltage and a logical low ground state at XOR pin 2 (-0.32v). Being upside-down means a positive voltage logical high at pin 2. So, if you’re right-side-up and looking to the left of the light, (more light in your right eye) both inputs 1 and 2 to the XOR gate are low.
XOR Pin 3: In Boolean logic X1 low XOR X2 low equals X3 low (0v).

This shows my approach to designing a template for making a body to protect the Turbot as it tumbles across the floor.
XOR Pin 4: X4 goes to all that stall and reverse circuitry and it’s not at all obvious what state it should be in. I don’t see an obvious connection to either supply or ground. The only clue I see is that it connects to the enable low of the Reverse State Memory portion of Inverter A. Since the Reverse State Memory shouldn’t be enabled unless a motor is stalled, it should be high. I measured X4 = +5.18v, high. Ok, we know it’s high but exactly why isn’t clear. We’ll figure that out later. Color the line leading up to pin 4 green.
XOR Pin 5: X3 low connects to X5 at one input of the second XOR gate making it low also (0v). Color the line between them red.
XOR Pin 6: Since we measured XOR pin 4 as high and by XOR logic X5 low plus X4 high equals X6 high (5.32v). Color it green.
XOR Pin 7: X7 is ground per our data sheet and indeed measures 0v.
XOR Pin 12: X6 output high connects to X12 input of the third XOR gate making it high also (5.31v). Color line X6-X12 green.
XOR Pin 13: X13 connects to positive supply through R9 so it could be high. The other end of the circuit goes to pin 14 of inverting buffer A. If A14 is high then X13 is high. But if A14 is low then X13 is grounded or low. The specs for the 74AC240 Octal Inverting Buffer shows 2 enabling inputs each covering half the invertor, pins A1 and A19. If the enabling input is low then the invertor acts normally. But if the enabling pin is high then the outputs act as a high resistance regardless of the input. X4 is measured to be high therefore the inverting buffer A is disabled and A14 will appear as a high resistance to the positive supply making it effectively high. (4.09v) Color it green.

Bridge wires keep the two halves operating together while the body is opened up and tested.
XOR Pin 11: X12 High XOR X13 high equals X11 low (‘either or but not both’). Therefore X11 is low (0v).
XOR Pin 9: X11 low connects to X9 which is therefore low (0v). Color the line between them red.
XOR Pin 10: X10 is obviously high connected directly to the positive voltage (5.31v). Color that part of the diagram green.
XOR Pin 8: X10 high XOR X9 low equals X8 high (5.31v).
Motor Drivers
High voltage at X8 would be blocked by an oncoming diode D6. Color the line from pin X8 to the diode green. Beyond diode D6 the circuit is connected to positive supply through C6 and R6. The other end goes to inputs B6 and B8 of inverting buffer B connected to the upper motor in the schematic.
Inverting buffers or ‘invertors’ simply change states to their opposite. It may seem strange, at first, to turn something on by turning it off, but there is method in this madness. Sometimes it just makes practical sense for one thing going on to turn something else off and vice versa, but there’s another reason. Digital circuits such as XOR gates or invertors give their output the benefit of the full supply voltage or full grounding even if the input voltage has been weakened from passage through multiple components. The full output voltage can then switch a power transistor to control a voltage or current many times larger than the digital circuit could handle itself. Isn’t that the way is usually is? The smart wimpy guys make the decisions and the big dumb guys do the work.
With X8 high there is no ground in sight. Therefore B8 and B6 are high (4.0-4.23v). That part of the circuit is high. Color it green. If B8 and B6 are high then B12 and B14 are low (0.03v). Since we know X4 is high and it connects around to B11, B13, B15 & B17, they must be high also (5.13v). If they’re high then B9, B7, B5 & B3 must be low (0.08-0.09v). With lows on both sides of the upper motor, it’s not going anywhere. Capacitor C3 (and it’s buddy C2 for the other motor) shunts away any reverse voltage spike created by the collapsing magnetic field when voltage to the motor is turned off.
Pins X11-X9 however are low allowing them to ground (through diode D5) inputs B4 & B2 connected to the bottom motor on the schematic. But which motor is it? The line through D5 connects to pins 2 & 4 of Inverter B (B2 & B4). According to the schematic, all the motor wires attach to Inverter B. If you follow the motor wire traces, they go (surprise!) to the chip closest to where the motor wires attach at the rear of the ‘bot. Label this chip ‘Inv B.’ Pins B2 and B4 connect through invertors to pins B18 and B16. Pin B18 can be traced on the bottom of the PC board to a wire that goes to the left motor. This reassuringly matches the motor that should be running under these conditions as observed previously. Label your schematic top motor = right, bottom motor = left. With B4 & B2 low (0.34v) then B16 & B18 are high (4.87v). As we saw above, the other side of the motor B5 & B3 are low 0.09v). High input + low output = motor runs forward.
Ah, ha! We have traced a complete thought from the eyes to the arms!
Change in Orientation
Now for fun move the putty blob from the left eye to the right eye and retrace the thought patterns as above. This time the right motor turns. See schematic #2.
Ok, now blind the top eye with putty and shine a light through your operating table on the bottom eye. Move the putty blob back to the left eye. Right motor turns. See schematic #3.

Recharge jack, top side.
Lastly blind the right eye again while keeping the top blind & bottom lighted. Left motor turns. See schematic #4.
The behavior observed before surgery is confirmed by brain probe.
But what about all that stuff at Invertor A?
Stall and Reverse
All the forward motor motions of the scenarios above come from the output side of the motors being low as driven by the high state at B11, B13, B15, B17. Trace the line from these pins back to the only output of inverter A which is A5. The high at A5 can briefly reinforce itself through A17-3 and A15-5 limited by C8, but the main source traces back to A11-9. Anything that pulls A11 low would send A9-A15 high and drop A5 low. With A5 low then B11, B13, B15, B17 go low. This makes B3, B5, B7, B9 high reversing the motor polarity.
We can now begin to get a handle on the Stall Signal Detect, Reverse State Memory and Motor Reverse Timer circuits. If B11, B13, B15, B17 are all high then the circuit going across the bottom of Schematic 1 over to pin A17 is all high as is confirmed by our measurement of A17 (5.18v). This includes the branch up the middle to A5 5.28v) and X4 (5.33v). Note especially that the enable low pin of Inv A is high disabling the Reverse State Memory circuit. This is confirmed by all the pins in that circuit measuring low.

Recharge jack, underside view.
Now focus attention to the Stall Signal Detect circuit. Since the low state at B12 and B14 is blocked by D3 from grounding the stall circuit, the right motor has no effect. The high state of B16 and B18 is able to push a high state through D4 and R8, past C4, up to C1 & D2 and on to A11. C4 and R2 block it from draining to ground. The circuit beyond A11 and A17 is inverted to low as confirmed by our measurements at A3, A9, A13 & A15. I’m really not sure of the purpose of inverter A8-12 as A12 goes nowhere. Now watch what happens if you stall the left motor.
The Stall Signal Detect is rumored in the documentation to result from a low condition caused by a stalled motor acting as a low resistance compared to a running motor. You can prove this by connecting various scrap motors to your breadboard. Note the voltage of the open power supply with no motor. Then check the voltage across the motor while running. Then stall the motor by grabbing and stopping the output shaft. You are testing a small motor, I hope! What happens to the voltage? In my experiments the stall voltage was anywhere from 41% to 88% averaging about 72% of the running voltage. Our Turbot motors had the largest drop to 41% of the running voltage. Dropping to less than half makes a handy low for our comparator circuits.
See schematic 5. With the left motor stalled, the high state at pins B16 & B18 drops low. With both motor inputs low the inputs at D3 and D4 to the Stall Signal Detect circuit are both low leaving nothing to prop up the former high state which now slowly drains away through R2. When it drains sufficiently away, A11 drops low. With A11 low A9-A13 goes high pushing through D1 to make A15 high. With A15 high A5 goes low. With A5 low the motor output driver at B11, B13, B15, B17 goes low. As a consequence the motor output at B3, B5, B7, B9 goes high reversing the motor polarity. In addition, A5 going low pulls the enable low of the Reverse State Memory low enabling it. Further, A17 goes low making A3 high illuminating the Stall Indicate LED L2. The Motor Reverse Timer capacitor C7 fills and slows the flow from A9. This then backs up through C8 and D2 to A11 shutting off the reverse state. Everything goes back to normal. Try bread-boarding everything left of D3 & D4. Put and LED with limiting resistor at A5 to indicate output. It will be initially on. Simulate stall condition by grounding A11. After a second or two the stall indicator lights and the output indicator goes out for several seconds, then returns to normal.

Recharge cable.
The Reverse State Memory is an interesting circuit in itself. It turns out to be just a big, slow oscillator taking 5-15 seconds to cycle with the large 22uf capacitors. It can be explored by bread-boarding an inverting buffer chip and some similar capacitors and resistor. Use an LED with a limiting resistor as your output indicator. If your breadboard chip doesn’t have an output-enable pin it will enable itself when you turn on the power, otherwise ground the output enable pins. Each time it’s enabled it picks up where it left off switching A14 high and low. This feeds back to X13 causing the motor selector to alternate right and left as indicated by alternating red and green lines from A14 to the motors.
While probing your ‘bot you may have noticed that probing certain pins would provoke the stall condition. This is because the voltmeter drains some of the voltage away and grounds sensitive circuits. You can take advantage of this by connecting a wire to ground and touching the other end to the far side of D3 & D4 where they connect. This grounds the Stall Signal Detect circuit and lets you measure voltages during the stall state. This is tricky, however, since the stall state causes the Reverse State Memory to oscillate. If you measure long enough, you’ll notice the Reverse State Memory voltages fluctuating.
So, there you have Turbot Neurophysiology 101.
There will be a test on Friday.
James H. Phelan, MD
Links
Solarbotics, www.solarbotics.com, (403) 232-6268
Turbot Movie Topside
Turbot Movie Bottom
Turbot Locomotion Windows Media Video (3MB)
Turbot Neurophysiology Spreadsheet