Friday, March 21, 2008

BUILDING ROBOTS : Mousey robot finishing steps












A mechanical computer mouse has an ingenious way of translating the movement of a mouse's rubber ball into X- & Y-coordinate movement on your screen. Inside the mouse are two encoder wheels .As you move the mouse around on the desk, it rotates these wheels inside (one wheel being perpendicular to the other, with their drive shafts in contact with the ball). The encoder wheels have slits in them, & on either side of these slits are infrared emitters & infrared detectors. The detectors count the number of light pulses reaching them (through the moving slits in the encoder wheels) from the emitters, & then the on-board chip translates these pulses into X/Y coordinates that it sends to your computer screen On most mice, the emitters are clear plastic with a little dome protruding from them while the detectors are solid black. Find the clear emitters & desolder them from the PCB. You're now the proud possessor of a pair of robot eyeballs


Now Breadboarding the Robot`s Circuit


Creating Eyestalks



  • Before we start hooking up the wiring on our breadboard, we need to give our Mousey eyes some optic nerves. Our computer mouse IR emitters only have two stubby little pins coming out of their packages. Our robot is going to have eyestalks that jut from the front of its body. These will not only look cool, but we can use them to adjust Mousey's sensitivity to light by moving the stalks backward & forward & from side to side.

  • To create the stalks, cut four 6 1/2-inch pieces of 22-guage solid core hook-up wire. If you have red & black wire, cut two of each color. Solid core wire is better here than stranded wire because it'll give you much stiffer stalks that will hold the shapes you mold them into as you adjust light sensitivity.

  • Now we're going to do something strange. We're going to reverse our red & black wires. We're going to solder the red wire to the cathode (–) pins on the emitters & the black wires to the anode (+) pins. This is called reversed biasing in electronics. It's a technique that will help improve our light sensitivity even more.

  • When the wires are soldered in place, twist them together & strip some of the jacket off of the other ends (to fit into the tie points of your breadboard). The stalks are so tall because they're going to stick out of the mouse about 4 inches when installed in our actual robot, & the negative wires will need to reach our control chip in the bottom of the mouse

Hooking Up the Op Amp



  • With all of your electronic components in hand, you're ready to breadboard the circuit. Here are the steps to installing the op amp, our main control circuit

  • 1)The first thing you'll need to do is install the LM386 across the trench on your board. As always with ICs, the pin to the immediate left of the little dimple (as you hold the chip up so that the dimple is on "top" of the chip) is Pin 1. Count in a "U" shape down the left side (in this case, Pins 1–4), across the IC, & then up (Pins 5–8).

  • 2)Now you'll want to connect Pins 1 & 8 with a piece of hook-up wire. These two pins were designed (with the IC wearing its original op amp hat) as gain controllers. By connecting them together, we're boosting the gain (in other words, increasing the sensitivity of the signals coming from our computer mouse's IR emitters).

  • 3)The next components to connect are the eyestalks. Take a black wire from one of the stalks & put it in a tie-point group for Pin 2 & the other black wire in a tie point for Pin 3. Pins 2 & 3 are the op amp's input pins. Now take the two red wires for the stalks & plug both of them into the same tie-point group someplace above the 386 chip (about five to six tie-point groups above the chip). They're on their way to the upper positive power bus, but we're going to add some additional electronics before we get there.

  • 4)We found in our experiments using the IR emitters from mice that they're not as sensitive to light as they could be. In Junkbots, Bugbots, & Bots on Wheels, Dave Hrynkiw includes a sensitivity-boosting subcircuit that BEAM uber-hacker Wilf Rigter (wilf.solarbotics.net) came up with for Herbie-based bots. We decided to add these components, which are nothing more than an LED & a 1kW resistor. Adding this booster on the breadboard simply involves plugging the negative (cathode) lead of an LED into the same 5-point group on the board where you have the two red leads for the eyes plugged in, & then jumping the trench & plugging the positive LED lead into the corresponding 5-point group on the other side of the trench. In that same 5-point group, plug in one lead from your 1kW resistor & then plug the remaining lead into the positive tie point of your upper power bus.

  • 5)Now to finish up this part of our circuit, all we have to do is connect the power pin of the LM386 (Pin 6) to our upper positive power bus, & the ground (Pin 4) to the lower negative bus.

Connecting the Motors & Power


After you've checked all of the preceding steps to make sure that all components have been properly installed on the board, you're ready to connect the motors & power



  • 1>Connect the positive wire from one motor to Pin 5 of the LM386 chip. On many motors, the positive terminal is marked in some way, often with a dimple or with a plus sign (+). Our Solarbotics RM1 motors have silver dimples next to the positive terminals. (Er...& they have a red wire attached to the positive terminal & a black wire attached to the negative terminal. That's always a solid clue.) Connect the negative motor wire from this first motor to Pin 4 on the relay.

  • 2>Connect the negative wire from the other motor to Pin 5 of the LM386 chip. Then connect the positive wire to Pin 13 on the relay. (Notice that the polarities are reversed from step 1.)

  • 3>Everything should be hooked up by now & we should be ready to power our circuit. Because the robot itself will use a 9V battery, that's the power you should deliver to the board. You can use the 9V battery snap you bought for this project

 


Freeforming Mousey's Control Circuit


Now that we have a light-hungry robot brain, we need to install it in our mouse body so that it can motor around to feed (add your own zombie/Night of the Living Dead sound effects here). Obviously, all of the hook-ups will be the same as on the breadboard, but here we'll want to switch to a lighter-gauge &/or a stranded wire. The 22-guage solid core wire used in most breadboard jumper kits is too stiff for most of the connections we'll need to make inside of our mouse case. It makes it too hard to close the lid & puts unwanted stress on our solder joins. Either try a stranded 22-guage wire or a 24-guage (stranded or solid) wire. We used a 22-guage stranded wired


 


Installing the Battery & Relay


1>Using two-way tape, Velcro tape, or poster putty, install the battery where you want it to go.


2>Before you install the relay, you might as well solder what you can to it while it's still outside of the mouse case.


3>Solder the emitter pin of your NPN transistor (that's the right-most pin looking at the transistor with the flat side facing you) to the top-left coil pin on the relay


4>There are a few more relay hook-ups we can do "out of body." First, solder a short positive (red) wire from the top pin on the right side of the relay to the bottom pin on the right side.


5>Now you're ready to glue the relay in place & solder its remaining connections.


6>Solder the negative wire from the left motor onto the middle pin on the left side. Again, use black wire if you have it. Then solder the negative wire from the right motor onto the right middle pin on the relay


Before we move away from the relay/switch/motor area, we have a few more things we need to do.


Solder about 2 inches of positive wire to each of the positive motor terminals (if the motor doesn't have wires already).


Solder the stripped ends of these two wires together side-by-side.


Finally, solder a third positive wire, about 3 inches long, onto the soldered end of the two motor wires you created in steps 1 & 2 . What we're doing here is making the two positive motor wires into one positive wire that we'll attach to the output pin on our control chip.


Installing Our LM386 Control Chip


Find the spot in your mouse case where you decided to install the LM386. You'll want to position it in dead bug mode (with its pins in the air). It doesn't matter how the chip is oriented. Ours has pins 1 & 8 facing towards the robot's rear.


Before you glue in your chip, go ahead & bend Pins 1 & 8 toward each other & solder them together.


2>Glue your LM386 IC in place.


3>Now find the negative wires from the transistor (attached in step 3 of "Installing the Battery & Relay"), the relay (attached in step 4 of "Installing the Battery & Relay"), & the timer cap (attached in step 1 of "Connecting the Switch Components"). Solder all of these negative wires together, side by side. Here we're joining all of the negative wires together on their way to the control circuit & to power.


4>Solder the negative wire from the battery snap onto the 3-wire negative junction you joined previously in step 3.


5>Solder a short piece of negative wire (about 1 inch) to Pin 4 of the 386. Then solder this wire to the uber-negative wire junction created in steps 3 & 4.


6>Solder the positive wire from the relay (attached in step 4 of "Installing the Battery & Relay") to Pin 6 on the chip (our output pin). Solder the motor junction wire to Pin 5 on the IC.


Installing the Eyestalks


As you install the eyestalks, following the steps listed here, refer to Figure 8.18 for some visual cues.


The first thing we want to do is make holes in our mouse top to thread the eyestalks through. The two buttons on most computer mice are separate pieces of plastic that snap onto the mouse's top half & rock a little forward & backward (so that they can engage the actual switches on the PCB underneath). You'll probably want to glue these two pieces onto the rest of the top so that you have a solid upper half. When the glue is dry, mark where you want to sink your eyestalk holes, & drill out just enough of a hole (using your Dremel tool & a drill bit) to feed your eyestalk wires through. We installed our eyestalks about 1/2 inch from the front edge of the mouse case.


Thread the eyestalks through the holes so that about 1 3/4 inches of wire & sensor remains outside of the case. On the inside, clip the two positive wires so that they just reach each other on the underside of the top & overlap each other a bit. Solder them together.


Run the negative wires along the top of the case & bend them down wherever your IC is located (ours is in the back of the mouse's bottom half). Don't solder them to the IC just yet. We want to keep the two mouse halves unconnected until the end.


Cut a short piece of red wire (about 1 inch) & strip the ends. On one end, solder on the 1kW resistor of our sensitivity booster subcircuit. On the other end of the resistor, solder on the anode side of the LED (with its leads splayed out). We want this wire/resistor/LED combo to fit from the middle pole of our toggle switch to the junction of the two positive eyestalk wires we soldered together previously in step 2.


Go ahead & connect the sensitivity booster from the middle switch pole to the positive solder join of the eyestalk wires.


Our LED/resistor combo is really only in our circuit to add a voltage bias, or in other words, to tweak the sensor output voltage so that it's more in line with what the chip's input is expecting. This will result in the motors turning on & off more gracefully, leading to smoother mouse motion. One cool side benefit to the booster is that it can double as a "power-on" indicator, so we want it showing through the top of the mouse case. Consequently, we're going to have to drill a hole in the top for the dome of the LED to poke through. With the booster circuit in place, you can see where that should be. Gently bend the LED out of the way (so that you don't drill into the top of it!) & sink your hole. Then poke the light up through it. Use a piece of electrical tape to hold the LED in place inside the hole you just cut.


Make the FINAL ROBOT CONNECTIONS


We almost got bot! All we have to do now is make the final connections between power, the switch, & the control chip, & to install our front whisker.


Solder the negative eyestalk wires to Pins 2 & 3 on the LM386.


Solder the positive (red) wire from the battery snap to the (normally open) outside pole of the toggle switch.


Solder a short red wire (about 1 inch) from the center pole of the switch to Pin 6 of the IC.


Connect your bumper plastic to the bumper switch. We simply used a couple of layers of cellophane tape. You want to install it so that it's connected to the left side of the switch front, so that it crosses over the face of the switch & across the little cylinder that's the switch button itself


2 comments:

Unknown said...

hey please tell me how to know which is +ve and which is -ve end off the IR emmiters

alansaki said...

Nice and such a informative post for me. I will try to make some unique circuit board which can use in robots also. Thanks for share history also.
Printed Circuit Board

 

© | Irecipe