Friday, December 14, 2012

A bit on IC chips, and a Dragon Headbot

At first in my self teaching of electronics.. I was completely unfamiliar of the IC chips available at Radio Shack, as well as Fry's Electronics, Willie's Electronics, and other stores in my home town. I knew the 555 timer ship was some sort of universally versatile little gizmo.. but had no idea how to wire it up. Similarly, when I read the package of "Octal inverter" I thought it was some sort of code generating chip for computers... something that used some sort of 8-bit (octo) ASCII code or something else completely over my head.

The Junkbots, Bugbots, Bots on wheels Book helped me out immensely! While I still at this time struggle to get a 555 timer to do what I want (I want it to do a short millisecond pulse of power each time I push a button.. but NOT stay on for the length of time it takes my slow Human speed finger to let go of it which is apparently hundreds of milliseconds even at my fastest), now I am an avid fan of the octal inverter. Lets talk about it a bit.
This is one of my favorite chips. Its SO useful! It can do so many things; from powering a motor that can reverse its power automatically, to switching things on and off, to other BEAM robotics related stuff like "Neural Nets" of a limited degree. Lets explain how.

Notice on the sketch there are up arrows and down arrows at the pin points. These are "data channels" symbols, which is a fancy way to say "either 1 or 0 goes in here or out here"; 1 being 5v, 0 being 0 volts. So yes, doing one to an input causes the connected output to do something as well, and they are in pairs 8 pairs, thus Octo.

Its called an Inverter because what it does is outputs the opposite of what was its input was! So you input in 5v, it puts out 0. You link one output to its neighboring input, and you can see more complicated things going on: 5V to channel 1= 0 volts at output, that 0 v gets sent to input of channel 2, it sends 5v at its output. Thus; a motor controller! Have one channel power 1 wire, another power the other wire, simply link them together, and one provides power, the other ground.. all from a single input of 5v (triggered by anything-- mechanical switch, etc)

Whats really neat is how it reverses... put 0 volts at the wire going to channel one, and now the wire that was power is ground, and the other channel is power!! and the motor is running the opposite direction.  Neat, huh? with just 1 wire and a jumper, you now have the equivalent of a DPDT relay wired to do the same thing... only there are 3 more pairs on the chip!

One thing to note though, is that the power output of these channels is not very high. Its more for data that driving motors, and this one in particuar is not a style designed for high milliamp loads (all that is locally available though). So, to make it a motor controller, you have to "gang up" multiple channels in parallel to have enough "push" to actually get it to go. To make the Headbot from the Junkbots book, it uses 3 pairs tied together to drive the motor, and the last pair as the "brains"

Remember how I said the more advanced robotics techniques can make these inverters "neurons"? This is how; take two linked together channels, and you have a loop of alternating on-off states. Wired directly, the voltage just zips back and forth too fast to mean anything... but add a resistor/capacitor to each side, and now there is a controlled delay (the time it takes the capacitor to fill up: stop hogging all the power, for the 5v to actually reach the input). Have each RC group of different values, and the two neurons can cycle like "bip-beeeep-bip-beeeep". How to make this into a 2 neuron  bug brain is rather ingenious: have the resistor of the RC groups be variable to external stimuli.. like a photo resistor that changes its resistance with light levels! NOW, if wired this way, the "beeep" will be "no light" cycle time, the "bip" will be "light hitting this one". Cross wire them so the left sensor makes the motor spin to the right, and what do you have?

A Headbot, that tracks LIGHT! it will scan left right left right, but time between the scan directions differing so that it drifts more and more towards a light. Then, when both sensors are full of light its just a rapid "bipbipbipbipbipbipbipbipbip" cycle, that keeps the eyes pointed at the light source. Move the light, and the head turns to track it. Wire the motor the other way, and now the headbot avoids light! Shift a light nearby it, it will flinch and look for the darkest spot (wear a black t-shirt, and it may be staring at you!). A brain. Of sorts.

Check out my Headbot, since we're talking about them:
This little critter is called, roughly "The blue Eyed Dragon. It uses a solarbotics geared motor, mounted in its wheel as a base, and all of the "brains" are literally in the head. It behaves with surprising amount of behavior for something so simple, as seen in a video below.

Here you can better see why its called Blue eyed, and a Dragon. heh. I was in kind of an odd mood late at night when I finished this, and I noticed the InstaMorph holding the underside of the chip all nice and stable (don't want those jumpers bending and touching each other), once trimmed, looked a bit like an alligator/dragon head. so I went with it when it came time to place all the parts.  ...My only regret is putting the power switch in such an awkward spot.
Anyways, video time. I uploaded this on Youtube as well, as I plan to add some notations as it is acting up a bit.
I like how he can spot lights from across the room (the dim light was my computer monitor), and gets a little squeal going on when really close to the light (The motor is still cycling left/right very rapidly when it looks like its staring.. and the squeal is the motor oscillating at audible frequencies)
 
So, back to IC chips. The Octal inverter is the one I tinker around with most, as the 555 timer, even after reading up on a bit, is still a bit beyond my current level of understanding- in order to get it to actually behave like a timer. Another chip I tried out was the Audio Amp- which can also power a motor, or even a pair of motors dynamically- alternating the amounts of power to each motor as it tries to "equalize" the signal as it varies with the photoelectronic eyes. This is how the "Herbie" bots chase a light around on Youtube. But I cant really claim to understand how the amp does this.. at this time.
 
One of the IC chips I want to get to mess around with is a Clock.. or Shift Register type of chip. These are like the inverter, but cascade down the list of channels whenever something happens. I'll admit I mostly want this chip just so I can make my own knight rider Kitt light bar... or a cylon scanner... no really- a scanner- an array or LED's light up cylon like, sweeping left and right, and another array of light sensors watch for reflections, to know when something is too close... either to avoid it, ram it, or reach out and shove it away... that kind of thing.
 
Well, I'm apparently off into daydream land now, so lets end this before I gt TOO loopy.

No comments:

Post a Comment