Thursday, September 17, 2009

Appetizer Solar Robot

This miniature robot is derived from instructions provided on Chiu-Yuan Fang's website, from the BEAM community, and from Dave Hrynkiw. Some alterations are made based on the parts available.Appetizer solar robot.


Appetizer solar robot.
There are two major style changes:
  • Firstly, this robot drags the capacitor rather than pushing it.
  • Secondly, this robot carries its solar panel in front of it, like an appetizer tray.

Solar Robot Video

Video of Appetizer solar robot.
Video of Appetizer solar robot.
Click the above picture to see a video of Appetizer walking (or popping) in the early afternoon Colorado sun at 9,000 feet high. The video hasn't been sped up; this is the actual pace.

Solar Robot Schematic

Wiring diagram / schematic for a robot powered by a solar cell.
Wiring diagram / schematic for a robot powered by a solar cell.
This is a schematic of a circuit that I altered slightly from Dave Hrynkiw's schematic. I posted the following questions on this page without thinking about who might read it. Turns out that Dave Hrynkiw himself kindly provided his thoughts and answers. Thanks Dave!
#1a Since they act like switches, transistors Q1N and Q2N appropriately don't have loads connected to their respective emitters. But then shouldn't they have current-limiting resistors (like 1 kilohm) connected to their bases? It would seem current is being wasted.
Dave responds: You know, that's a good point, and I don't think I've ever tried that. Just by looking at it, I think the issue may be suspending the 3906 collector too high above ground for it to remain on.
#1b It would also seem that there's a voltage drop problem from power (2.5 V) through Q1P (-0.6 V) through Q1N (-0.6 V) to ground (0 V). Where'd the other 1.3 V go? Using a 1 kilohm resistor at Q1's base would source the voltage drop.
Dave responds: That's controlled by the 3906's base current (R1). Again, a resistor on the pnp collector may suspend the 3906 too high above ground to be effective. Good idea tho - worth a try.
#2 Why use bipolar-junction transistors? In a current-poor environment (solar power), why not use MOSFET transistors?
Dave responds: Bipolar transistors are used because they are very inexpensive and most FETs run better at high voltages. We have some Zetex ZVN2106's that work very well, but cost almost 10X more than a bipolar.
#3 Are the photodiode symbols in backwards? What about the solar-cell symbol? I thought I read somewhere that the arrow for these kinds of devices is reversed from regular diodes.
Dave responds: The photodiodes are in "backwards". When reverse-biased, they respond *very* quickly to changes in light intensity, leaking current proportional to the light. In forward-biased mode (as you show), they actually use the photoelectric effect to generate power (ie: 0.5V solarcell), which actually tricks the 1381 into triggering prematurely, as you're generating a voltage, which adds to the system voltage. Both techniques work in this circuit.
The solar-cell symbol should be like a battery stack, with arrows going into it.
These issues occurred to me after finishing Appetizer, which is free-form soldered. Therefore, I couldn't test these ideas to see if a problem exists nor if my suggested corrective measures work.

Solar Power

The solar panel (D3) stores power in a capacitor (C3). The voltage in the capacitor increases as the capacitor fills up. Either the left (U1) or right (U2) voltage-detector trips when there's a large enough voltage available, in this case between 2 and 2.5 volts.

Robot Movement

When the left voltage-detector trips, a transistor (Q1N) is turned on. This allows current to flow through the left motor (M1), which causes the robot to move forward by spinning to the right.
Almost immediately, the power remaining in the capacitor (C3) drops below the voltage-detector (U1) trip point. Another transistor (Q1P) keeps the remaining current flowing through the motor, so that the motor actually gets enough current to result in movement.
A resistor (R1) determines the lowest shut-off voltage. The lower the resistance, the lower the voltage delivered to the motor before shutting off. If the voltage is below the amount needed to cause the motor to turn, the remaining current is just wasted (turned into heat instead of motion) below that voltage point.
The right motor moves using almost the same circuit design as the left motor. However, the left motor is connected backwards (reverse-polarity) since the left motor must spin the opposite direction in order to move the robot in the opposite direction.
Electronic parts labeled on solar robot Appetizer.
Electronic parts labeled on solar robot Appetizer.

Direction

To steer, the amount of light to the left and the right of the robot affects the amount of voltage dropped through two photodiodes (D1 and D2). Only one of the photodiodes usually permits their associated voltage detector to trip, resulting in a left turn, right turn, or side-to-side forward stagger.
A potentiometer (R3) balances voltage-drop between the photodiodes to correct minor differences in motor efficiency, weight loading, circuit resistance, and so on. After repeated manual fine-tuning of the potentiometer, the robot can generally proceed directly toward a light source, rather than veering off.

Photon Food Hunting

Solar-powered robots are photovores (Greek for "light-eaters"), which necessitates a light-seeking technique.
The light sensor on the right side (D1) of the robot trips the motor on the left side (M1), and vice-versa. This is needed for brightness on the left side to cause the robot to move left, because activation of the right motor moves the robot forward and to the left.Implementation

Parts

Nearly all the parts were purchased from Solarbotics.
As of 2008, the Panasonic Voltage Trigger MN1381-C is still available from Solarbotics; search for 1381C. Or, it can be purchased from DigiKey as 1381SC (the letter S indicates the lead-free version). Tip: The datasheet is labeled 1380 not 1381, since that is the base part number of the family.
As of 2008, the exact solar cell is no longer available. However, any medium-size solar cell with a voltage between 3V and 5V will do.

Glue Gun

Every part of the robot connects by solder. The only exception is the motors, which are connected to the robot's body by glue from a hot-glue gun. The glue is lightweight, slightly flexible, and strong; maybe too strong.
After connecting the plastic back portion of the motors to the plastic casing of the potentiometer, I'm unable to remove the motors without possibly ripping off their backs. It's too bad, because the robot would perform better if the motors were angled more perpendicular to the ground (greater forward motion) and farther back (to place the center of gravity directly over the motors).

Heat-Shrink Tubing

Tubing covers the leads of most of the components. It isn't necessary to actually shrink the tubing, just slip it over the leads. The tubes protect against shorts, allow for tighter packing, decorate, and color-code connections (ground, positive voltage, or signal).
Additionally, tubing on the shafts of the motors (instead of wheels) provides traction. I tried using tiny LEGO wheels as well as homemade glue-gun glue cross sections as wheels. In both cases, even the larger pager motors failed to turn when wheels were attached.

Cell-Phone Motor Torque

I tried using cell-phone vibrating motors. Unfortunately, the robot didn't move at all! The cell-phone motors simply don't have enough torque.
Lifting the robot off the ground caused the motors to spin appropriately and showed that the motors were working. Adding a lithium cell for a steady 3 volts (rather than 1.2 to 2.5 volts) didn't help. (Lithium coin cells don't provide high current.) Adding a 3-volt power line (for plenty of available current) allowed the robot to continue moving, but didn't allow it to start moving from a still state. That's how I know the motors are the weak link, not the power source.
I suppose the only option is to gear down those kinds of motors. But solar power doesn't provide much total current per blast, so if you try to make a gearbox out of Lego gears then it may not be enough to move an entire tooth before it stalls.

Future Solar Robot Designs

  • Although the robot works well in sunlight, it's pathetic with indoor lighting. I'd like to design a solar engine that would pump-up small voltages, perhaps from a group of smaller capacitors and into a large storage capacitor.
  • To further reduce weight and size, soldering together surface-mounted components might produce a really peppy B.E.A.M. robot.
  • Even with touch sensors and greater spunk, I'm not sure the behavior will ever be as exciting as a microcontroller-based robot.
BEAM robots are fast and easy to create. They're a good way for newcomers to get started in robotics.
Appetizer was a lot of fun to build!

10. Movie of Sumo Battle Against Pound Of Wood

All of these notions are theoretical. It is amazing the number of great ideas that fail miserably in the ring. So, for your viewing pleasure, here is No.2 (a powerful, complex, sophisticated technological machine) versus a

All of these notions are theoretical. It is amazing the number of great ideas that fail miserably in the ring. So, for your viewing pleasure, here is No.2 (a powerful, complex, sophisticated technological machine) versus a piece of wood.
Click to see a movie of No.2 mini-sumo robot versus an inanimate block of wood.
Just look at the shock on the face of Pound of Wood! Click to see the movie.
In an actual public competition, No.2 won all 9 matches without ever being pushed out. The robot won first place. It was nice for all of my thinking, engineering, machining, soldering, programming, and testing to have resulted in exactly what I was trying to accomplish.
If you've ever made a robot, regardless of its capabilities, then you know the joy of seeing it work.
Just look at the shock on the face of Pound of Wood! Click to see the movie.
In an actual public competition, No.2 won all 9 matches without ever being pushed out. The robot won first place. It was nice for all of my thinking, engineering, machining, soldering, programming, and testing to have resulted in exactly what I was trying to accomplish.
If you've ever made a robot, regardless of its capabilities, then you know the joy of seeing it work.

9. PCB and Floor Sensors

PCB for sumo robot with Freescale HC08 microcontroller. Underneath: Floor edge sensors and a li-poly battery.

PCB for sumo robot with Freescale HC08 microcontroller. Underneath: Floor edge sensors and a li-poly battery.
All three printed circuit boards (PCBs) for this robot were created using ExpressPCB and purchased using their $59 MiniBoard service. Believe it or not, the motherboard on the No.2 robot is the exact same board as Jet uses. Yet, Jet is an entirely different robot -- it is an ultra-fast line-follower.
I've switched to Atmel RISC AVR microcontrollers because of their low price, availability at Digikey, availability in hobbyist-friendly DIP packages, and local friends that also use them. However, at the time I built No.2, I used a Freescale (formerly Motorola) HC08 CISC microcontroller. Specifically, the MC68HC908GP32.
The robot runs on a pair of lithium-polymer rechargeable batteries located underneath. The total voltage is around 8.2 when fully charged. These batteries can put out a lot of current and they're compact.
A red LED and phototransistor form a reflective pair to sense the white edge of the mini-sumo ring.
A red LED and phototransistor form a reflective pair to sense the white edge of the mini-sumo ring.
Obviously the robot shouldn't just drive off the board. So, the No.2 sumo robot has three sensors to detect the edge of the sumo ring.
The sensors are beneath the robot. Intense light from the red LED reflects off the sumo ring surface and into the phototransistor. When the robot is within the main boundaries, the black surface reflects very little light. But, when the robot approaches the edge, the white surface reflects a lot of light, thus changing the voltage of the phototransistor.
I've chosen to use red LEDs instead of infrared LEDs because it is easier for me to see where they're pointed. Also, red looks cooler. Red cannot be perceived as easily by the phototransistor, as phototransistors and photodiodes are usually designed for infrared. However, with the high output of a modern ultra-bright red LED, it works just fine for detecting the reflectivity of the sumo surface.
The No.2 robot has two sensors in the front to allow the robot to determine if it needs to do a 180 turn (both sensors lit up) or if it simply needs to turn another direction (the shortest turn is opposite the direction of the one sensor that lit up).
The robot also has one rear sensor for the occasions that turning and backing away from the edge actually backs the robot into another nearby edge. Unfortunately for me, I never bothered programming the code to read this sensor, which caused the only round loss for No.2 when it backed out of the ring by accident. Oops!
And now the moment you've been waiting for...

8. Building a Robot Body Out of ABS Plastic

Sometimes I'll create a robot extemporaneously. Sometimes I'll plan a robot precisely and completely in advance. However, most of the time I'll plan a little, build a little, and so on.
Mini-sumo robot plans, templates, and blueprints developed in Microsoft Visio.
Mini-sumo robot plans, templates, and blueprints developed in Microsoft Visio.
For No.2, the project started with the drivetrain and wheels, the pencil holder, and the circuit boards. From there I needed to create a central frame to attach those pieces together.
I design my robot pieces in Microsoft Visio for three reasons:
  • A drawing/drafting program (not a painting program) stores all of the information as exact shapes. They can be resized or altered at any time.
  • The values of the dimensions can be entered exactly into Visio. For example, I can type 3/8-inch or 3 mm or even 3/8-3/32.
  • If a 1:1 scale is selected, the plans can be printed out and they'll match the exact dimensions. That's useful for using them as paper templates during machining.
Looking at the blueprints for the No.2 robot, you may be able to see that I drafted items from different sides, depending on what needed to be machined or lined up to another part. For the most part, the center body created itself by simply putting the pieces together on the computer.
Machining a robot body out of solid ABS plastic on a mini milling machine.
Machining a robot body out of solid ABS plastic on a mini milling machine.
The center body is made from a single solid piece of ABS plastic. ABS is fairly inexpensive, lightweight, tough, and yet much easier to machine than metal. ABS is available in black, which means it won't require any painting to absorb infrared.
I purchased a 12-inch x 12-inch x 1.5-inch thick plate of ABS from McMaster-Carr. Thicker pieces are available. You can sometimes find ABS plastic on an eBay auction, but not usually in this size. Chunks are cut out with a hack saw and then machined smoothly to size on a mini milling machine.
Before the grand finale, let's look above and below the robot...

7. Finishing the Pencil Arms -- And a Debate on Damage

The pencils are now cut to length, capped and drilled. They are ready to go onto the pencil-holding comb that attaches to the front of the No.2 sumo robot.
An outer brass tube cap prevents the pencil from splitting under combat strain. An inner brass tube prevents rotational wear.
An outer brass tube cap prevents the pencil from splitting under combat strain. An inner brass tube prevents rotational wear.
Glue is applied to the hole in the pencil. A smaller tube is inserted into the hole and centered.
The smaller, inner tube protects against wear that would otherwise cause the pencil hole to eventually widen and loosen. The pencils would then be easier for the opponent to shove to the side.
The pencils are inserted into the pencil holder and the brass rods slide into place. There are actually two pencil holders on the front end of the robot. Each holder contains four pencils. After the pencils and rods are inserted, the pencil holders are screwed onto the front end of the robot, such that the rod openings face inward. This prevents the rods from sliding out. Pretty good trick, huh?Clear shrink wrap tubing coats the metal band of the pencil to prevent accidental electrical shorts on the opponent robot.
Clear shrink wrap tubing coats the metal band of the pencil to prevent accidental electrical shorts on the opponent robot.
I deliberated a long time regarding this final touch. If my robot purposely damages an opponent, my robot looses. But, if the opposing robot is poorly built or unreasonably vulnerable, then that robot looses.
Many robot builders (including myself) make the mistake of leaving robot circuit boards exposed. That is, the PCBs are not enclosed in a plastic case or within the robot's body. If a sumo robot has an electrically-conductive appendage, with a legitimate purpose other than damage, which causes the other robot to short out, who is at fault?
On the one hand, exposed circuit boards are an obvious vulnerability. Yet, on the other hand, most sumo robots have exposed circuit boards (so they would be considered "the norm") and the damage from an electrical short could be permanent.
So, upon weighing the consequences, and considering that I did not want to see children cry or grown men punch me in the face (or vice-versa) over their melted creations, I decided it was best to shrink wrap the aluminum bands on the ends of the pencils. 3M brand clear shrink-wrap tubing (from DigiKey) was chosen to not detract from the pencil's appearance.
There is one more scenario where significant damage could result. With multiple arms, No.2 might become entangled and pull the wires from the exposed boards of a competitor. However, such a vulnerability, no matter how common, would certainly seem like the responsibility of the builder. If it happened innocently to my robot, I'd accept that it was my fault, not my opponent's fault. (Also, my robots have built-in circuit breakers to reduce the likelihood of permanent self-inflicted electrical damage.)
How about a quick look at making this robot's body?

6. Cutting and Drilling Pencils and Brass Rods

Pencil wood is relatively soft. During sumo combat, would the forces split the ends of the pencils that connect to the rod? If so, it would be time consuming to replace the pencil. Either the robot would be disqualified or it would need to compete with a missing arm.
To prevent breakage at the most stressed point, I created a sort of tubular washer. In many applications, a washer spreads the load over a larger area. By applying metal tubing to the ends of the pencils, both rotational wear and combat stress could be absorbed by tougher material.
No industry-standard tube seems to fit firmly on a pencil. Instead, I turned to a metal tubing assortment from MicroMark (part #83260). There, I found an irregular tube (either it has thicker walls or it is metric) that has an inner diameter of approximately 0.28 inches.
Marking and cutting off brass tubing with a miniature circular cutoff saw.
Marking and cutting off brass tubing with a miniature cutoff saw.
I marked off 1/2-inch lengths on the hollow brass tube. The actual finished desired length is 3/8-inch, but the saw is going to cut away some material and the ends will be shortened when the burrs and rough spots are milled or sanded down.
I used a circular cutoff/chop saw from MicroMark. It holds round tubing easily and uses thin blades that reduce the amount of wasted material.
A hacksaw can be used, but you might need to insert a wood rod in the middle to keep the tubing from being crushed as it is cut. A standard tube cutter should be avoided, because it rounds and curls the ends of the tubing somewhat. Although this is a nice feature for some purposes, the rounded ends will prevent the tube from fitting onto the pencil.

Pencils cut to length with a brass tube fit onto the cut end.
Pencils cut to length with a brass tube fit onto the cut end.
Four pairs of pencils are cut to arbitrary lengths using a hacksaw with a fine-toothed blade. If you want matching pairs, you should tape a pair of pencils together and cut them at the same time.
Although not strictly necessary, I machined the cut ends smooth on a milling machine. The center of the pencil is graphite, not lead, so there isn't a health hazard. Graphite can lead to aluminum corrosion (it prevents the oxide from forming a protective surface), so don't machine graphite around aluminum parts.
Drilling a pencil with a brass tube cap in a milling machine vise.
Drilling a pencil with a brass tube cap in a milling machine vise.
The hexagonal (six-sided) shape of a pencil makes it easy to hold in a vise. A flat piece of scrap material can be placed underneath to make sure the pencil is lying flat. Make sure the brass end is not resting on the scrap piece, because it is slightly thicker than the rest of the pencil which means the pencil won't be flat.
Since this isn't a precision operation, you can line up the drill visually. Use a drill size equal to the outer diameter of the brass tube that will be inserted into the hole.
The pencils are almost finished...

5. Drilling the Rod Holes for No.2 Robot's Pencil Holder

Drilling rod holes in aluminum to hold the pencils.
There are two 1/8-inch rod holes in the robot's front comb / pencil holder. I made the mistake of drilling the holes in the aluminum block after the tines were cut. The tines flexed during drilling, so the holes aren't straight. Whoops! Next time, the holes should be drilled when the block is solid.The first rod holds the pencils to the robot. This allows the pencil arms to rotate up and down, but they can't be pulled out.
A rod holds up the offensive weapons of a mini-sumo robot, so that it won't be disqualified for touching the ground.
A rod holds up the offensive weapons of a mini-sumo robot, so that it won't be disqualified for touching the ground.
The second rod prevents the pencils from rotating much more than slightly beyond the surface of the robot sumo ring. In robot sumo, if any part of the robot touches outside of the sumo ring, that robot loses the match.
I made this mistake with the flexible spatula on Have A Nice Day. It did indeed slide the opponent over the edge of the ring, but the weight of the opponent on the thin spatula material (it was actually bare FR-4 circuit board substrate -- or garolite) bent it down so that my robot (bottom side of spatula) touched the ground first. It occurred during competition and the judge called it correctly. Bummer for me!
To avoid that mistake on No.2, the pencils are held up by the second rod. (It is still possible, but highly unlikely, that a pencil could get underneath an opponent as it is pushed off the board.)
The final front end of the robot is made of Delrin plastic with a solid aluminum rod.
The final front end of the robot is made of Delrin plastic with a solid aluminum rod.
After all that work, the aluminum pencil holder comb had to be discarded. During combat, the tips of the aluminum tines tended to dig into the sumo ring. Not only is damage to the ring prohibited by the rules, but it sapped motor power that could be better spent on pushing an opponent.
So, I started all over again with a piece of Delrin plastic. (Delrin is a trade name for acetal. It is available on an eBay auction, and from MSC Direct.com and McMaster-Carr.) Delrin is strong but slippery. It's also available in solid black -- which is good for absorbing an opponent's infrared emissions. That's exactly the kind of material attributes required for the front end of this robot.
The other change that was made was to replace the lower brass rod with a solid aluminum rod. Brass is too heavy, and a sumo robot needs weight over the wheels, not over the sliding front. I didn't replace the brass rod that holds the pencils, because I was concerned that aluminum might bend during battle.
Next up, making the pencils...

Followers