Sunday, December 23, 2012

Frankenstein's (robot) monster.

"IGOR! ze body is finished! We may now begin!"


Those black and white wheels are from a Desk Pets toy called a "TrekBot" I really like the hubless wheel drivetrain setup, and finally got around to making a little rover out of them. So here it is, 2 trekbot wheels [different colors 'cause the other white one broke :( ] hot glued with some hobby sticks to a Project enclosure, with a little caster ball holdung up the rear.. front.. not sure yet which end will be which.
"IGOR!! Bring me ze brains!!"
 
These are "the brains".. well, robot version of brains. After seeing how the remote control of the cheap little toy car I tore apart was, I decided to keep them for other uses.. since the 2 channels transmitted were not in fact some complex variable proportional shenanigans.. but rather a "digital" on/off, in both directions... times two! So the brains on the left is a transmitter with 4 pushbuttons, and the brasin on the right is a receiver with 2 H bridges swapping polarity of the two motor plugs upon command. Here we see them stripped of their battery pack prongs and motor connectors, and also the power switch (which was JUMBO) hardwired to always be on.
"NO! zees vire here, dat one goes Zere! How many times must I tell you; do NOT cross the zappy bits with the squishy bits?!"
 
hookin the power posts up to my power supply, I checked at the "VCC" test point (so nice to have it marked!) to see if the thing has power. "its aliiiive!". I was pretty sure it was fine after I removed it, but wanted to make sure. Also, I needed to power it up to see which plug pin was technically "foreward", with respect to the motor it was powering.

After wiring up the receiver brains to new power source, I had to do the same with the transmitter brains... had a AAA battery pack around, to keep this part mobile. Here, we see me testing the motor out points, and finding the + voltage point when I press FWD on the remote (its upside down). This did a couple of things: prove the receiver brains were still working fine, as well as prove the transmitter brains were as well.
"Ve haff control"   Using the spare black wheel left over, I tested the receiver brains to see if it was able to do a couple of things: A) drive these strange motors from another device with enough power, and B) see if the brains could themselves handle more power... like 9 volts. This was a gamble, but in the end I just told myself "so I will just be out $13.00 if it fries" and went for it. You can totally tell the difference twice the voltage makes... and hey! It wouldnt be a Frankensteins Monster if it didnt have Monster power, right?
And here will be the power for the little monster rover. A 9volt is really more compact than 3 AA that the toy originally required, and fits in the enclosure box nicely... I just wish the brains would as well... oh well. I quickly undid all teh testing jumper wires, and replaced them with the 9volt power supply, and soldered the wheel motors on with the correct polarity. As I couldnt wait... lets test it out!!
Like Frankenstein, its first steps were a little rough. It was confusing!  Now instead of one set up buttons controlling fwd/rev, and the other left/right, now the left/right was fwd/rev of the other wheel! yet the buttons were sideways, and it wasnt very intuitive which way on those sideways ones was foreward... even with some practice. Still, the little monster has some power, poppin wheelies and such. And it certainly turns on a dime (that means I got the wheels positioned just right)... but the controller needs some work... if only they made spring loaded rocker switches, that would go back to center/off when let go...
(... they totally do). Again, the makers of these parts were polite enough to provide test points all over all of them, all the better to help me figure out which parts did what when I pushed a given button. After a bit of experimenting, it was simple- each button had a test point associated with it, that I could solder tiny wires to, to go up to the rocker switches. It wasnt pretty, but should certainly work better.
So lets try a final demonstration. This is what Toy Hacking is all about- taking some little electronics gizmo, using its parts for something else, and hopefully making something a bit better than the originals out of it all!
 
 I plan on using this little guy as a test bed.. to try out new drive/steering/control schemes, from BEAM photovores to Arduino explorers, to whatever. Thus the box design. this remote control setup was just gravy, to let me put the chassis through its paces and see if it would even go in a straight line, or turn in place. It turned out just about perfect. and its certainly cooler than the original mustang toy that needed 5 feet to turn around.

How I got transistors WRONG

So I've built a few things using transistors so far, and I thought I understood them.

I thought NPN meant that its input was "N polarity, so you put "P"ositive voltage to its middle pin, to get power to leave through the other N. Because opposite charges attract::conduct, or something. And for these transisors it was pretty much true.

Similarly, I thought PNP were just the opposite: you put a ground to the middle prong to let its power go through... it worked in breadboard tests with LED lights and such.. but that basic "understanding" was fundamentally wrong! And it turns out I had a LOT of fried PNP transistors sitting around, because guess how my transistor tester "tested" them?

But thats a good thing! As frankly, I was stumped on how to work "connect 0v to base" into any circuit design, and PNP transistors sat in my parts bid collecting dust.

Then I did some book learning... turns out what I was doing by putting a ground to the base of a PNP was simply using that base as the circuit instead of the emitter... or some other esoteric electronics misuse of a transistor I cant claim to understand...

Then I followed a step by step walkthrough of transistors.. from NPN, PNP, and SCR styles, in step by step breadboard demonstrations I could assemble and do as I read it.

This is when I finally learned than a PNP transistor is like a Normally Closed switch.. the opposite of how an NPN is a Normally Open. Each is controlled by Voltage to the base, but the PNP kills the power, the NPN turns on the power, when the base is activated.

The reason I never figured it out on my own is because an NPN was simple; just leave the base empty, put a 1k resistor between power and its base, and "click!" it turned on. A PNP was not so simple. It just didnt work. It was supposed to already conduct with nothing on its base, but it was just dead. Putting power to its base didnt do anything if it didnt do anything to begin with! The secret, I learned, could have been summed up in 3 words... that had anyone mentioned them to me, would have made me instantly figure it all out:  "Pull Down Resistor"!!

I guess the base of a PNP with power sitting in it sort of hovers around its own shutoff levels if left to its own devices. Putting power to it then, only reinforces its OFF state. A pull down resistor- it doesnt matter if it was 10M ohm- would force that base to be ZERO, and the PNP would function as normal. Adding +V to the base now would shift that "floating but pulled toward zero" value to a real, +V power, and turn it off, or regulate it, or whatever. Now I get it.

And now that opens up a whole new world of solid state switching to me, as now I can puzzle out a solid state DPDT relay, or a self latching power-on hold circuit, or a Coil Gun trigger mechanism that will turn on/OFF at nearly the speed of light... stuff I was just scratching my head about last week!

TOY HACKING- making a robot chassis from a cheap toy.

In my robotics hobby, I need chassis..'ese. Not something I have to engineer and design, line up and balance myself... but something that already has had that whole "frame and wheels" thing setup for me. This is where "Toy Hacking" comes in. To get an idea what this means, lets go find a cheap toy that I can "hack" apart to suit other needs/uses.
Heres one. not too bad for $13.00. radio remote control, fwd/rev, steering, etc. I played with it the requisite amount before getting out my teardown tools... and honestly, its about a $13.00 toy. Not very fast, not very responsive turning, etc.

But the point was: a wheeled chassis with steering mechanism already built! That plus any electronics parts I can salvage/repurpose.. another aspect of "hacking".

So, I started with the remote... seeing those two control sticks, I figured at least I would get some potentiometers out of it....
... nope. wow! really? This is how simple the controls were, little micro switches- on/off control sent to the car. I was a little bummed. then I got to thinking: here was a radio remote, with 4 buttons, controlling 2 motors with simple fwd/reverse polarity...!!! This could do anything! keep the remote intact and powered, and the receiver hooked up to any motor, this little thing could do anything from turn the lights on, to opening the garage door. So I kept them all intact. This was actually much better than some RC servo control scheme.. this was simple "this way- that way" radio control... and that could be useful!
 
So, I carefully took the "brains" out of the car, and kept everything still intact. The two motors had convenient plugs to disconnect them, and left the car nice and "ready" for anything else I may plug into it.
 
So the motors are still there, with nice connector jacks for future use. Nice. lets have a closer look at the steering of this thing.
Yeah, this was simple. no servo here, just a motor with a "knocker" on its axle, that would spin this war or that.. until it hit the linkage arm post underneath, that would throw the wheels left or right, depending on the spin of the motor. The travel of the tires wasnt very high, and the linkages were sping loaded to return to center... but the important thing is that the front wheel axles and turn linkages are already built. Trust me, those mechanisms are rather difficult to build yourself from the ground up... and to be this small/lightweight. Plus, I could always just put a servo in place of the motor, its arm tied directly to the linkage, to get full and controlled turns, if need be.
 
Looking the frame of the car over, I noticed some tabs... like sping levered latches molded out of the frame itself.. so I carefully pried them open to see what they were for.
OMG! this thing was modular! The steering section, drive section, and battery box section were clip together subassemblies... THIS was a neat surprise. with this I could bolt the steering and drive to another frame, to other kitbashed toys.. even to each other directly (6 wheeled tank made of 3 of these? Seriously neat!.
But at this point I was noticing the frame/chassis of the car was a bit bulkier than it needed to be- either to look more like a mustang, or just to hold the top on. It was a lot of extra material, and I thought I could do without a lot of it-- mostly on the front section.
After some rather messy work with my dremel cutting tool, I got a lot of that junk off of the fram up front... yet still keeping the steering mechanism OK.
 

And here we have it; formerly cheap toy, now prebuilt robot rover chassis, with some decent rims and a nice mustang "stance". And that is the basic premise of Toy Hacking. I could put pretty much anything on it, from an Arduino to some BEAM style rover... I dont exaclty know what just yet... but its ready!
 
Oh, I only cut away parts on the front section of the frame, because I learned the hard way NOT to start cutting into gearbox cases.. especially if you are unsure just whats inside...
... or this might happen. :( This is TankBot. and his gears are all loose, because I didnt know that the gear axels were held in that way when I tried trimming him down to its bare essentials. But THIS is a seriously cool toy to hack! so teeny, so useful, two motor independant tread drive, *sniff*.. I had high hopes for this little guy.
 
 


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.

Sunday, December 9, 2012

Coil Gun test firing.

 

Maybe I didn't shoot very far, nor punch any holes in tin cans.. but still pretty good for first attempt I think!

Using the scavenged Back EMF really added some kick to the firing! It may be a strange use of a relay, but its a new trick in my toolbox. :) But first lets get some Hero shots of the coilgun in all its glory.
Still brings a smile to my face. I'm glad the failed symet spinner capacitors found a new home. The rings were kept from the old design, and added a nice "raygun" look to the little cannon. I suspended the coilgun in the middle on the rigid solid core wires, hoping for a recoil effect as it shoots (not enough power yet for that). The barrel is a brass tube, so it wont mess up with the magnetics of it all, and the outer ring is + and the inner ring - of the capacitor bank.






The Capacitors were angled forward a bit, and the rear ring was bent back some, to give it a bit more of a tripod look, as well as some more interesting angles to look at. And of course it HAD to appeal to my sense of aesthetics... like a Corvette, if the coilgun LOOKS like its shooting even when it isn't, well then it MUST be cool!
 
Here is the new fangled power booster, fresh from the Back EMF experiments. Reading back, you could see how it is truly a booster, in that I put 7v in, and the back EMF it generates trickle charges up the capacitor bank... to 23volts!  The white sleeved leads are the EMF, the unmarked are the power. The only real drawback is the whine the clacking contactors do on it as it cycles.. at about a 400 hz whine. (one I recognize from my Air Force days)
After trying to get a 555 timer to monopulse to make a quick fire of the capacitors through the coil, to looking into using a camera flash trigger to do the job, I instead went old school: relay logic (!!), as something I could wrap my head around, and had past experience with, as well as something I could build right then with parts at hand.
So here it is. 2 double contactor relays, and 2 pushbuttons. The function is straightforward, if a little interconnected: the left relay is the arming relay, the right one is the fire/disarm relay. The top left contacts act as a holding circuit, that keep that relay on once I press the button. The bottom left contact is the Enable, sending power to be available at relay #2. Relay2 wont energize until I complete the ground with the other pushbutton, the fire button. When the relay energizes, two things happen: the bottom right contact switches the contacts, moving the connection of the capacitors from the power source to the coil for as long as the relay is on. That wont be very long, however, as the top right contact breaks the ground to Relay #1... which you may remember, was supplying power to relay2 so long as IT was on. So, what happens is the firing relay turns on-OFF really fast, but long enough for the bullet to be fired.
 
Here's the wiring schematic, for anyone whose interested. This is a simple way to have a pulse of capacitor dump that is only a fraction of a fraction of a second. Maybe 100ms or so. A quick on-OFF is important to shoot something with a coil, as if the power stays flowing too long, the coil will just be a magnet, sucking the bullet to the center of the coil, and keeping it there. The Capacitor bank I had held enough power that the discharge time would have been too long for them to just dump their charge, so I had to engineer a rapid switching pulse... thingy.
I could adjust the "on time" by simply adding a capacitor across relay2's coil taps.. when relay1 kills its power, the capacitor will leave it on a little bit longer... but just like this seemed to work the best. 
 
 
 

Saturday, December 8, 2012

Back EMF demonstration (and a peek at a coilgun)

Picture is worth 1000 words, as they say:
So, going counter clockwise from the blue lit power supply: it is producing 7 volts, shown on the gauge at top. the relay at left takes that 7V- the minimum to energize it, and mechanically oscillates on and off very rapidly due to how it is wired. The schottky diodes, wired reverse to the input polarity, deliver the Back EMF spike power to the bottom power rail of the breadboard, where it charges a 630v capacitor. A meter on that capacitor, shows its level of charge.

48 volts! So 7v in, 48 out.
Here's the wiring 'under the hood' of the car relay. The white marked wires are the Back EMF, the unmarked are the power and grnd leads. Notice that the power in doesnt go right to the coil, but to the Common contactor tap. The + side of the coil is jumpered to the NC contact.. meaning that the relay is energized as long as its OFF... see the trick? on then off then on then off then on then off... as fast as this little relay contactor can physically switch.. whicih turns out to be pretty darn fast. The Schottky diodes are wired in reverse, because the back EMF pulse is reversed polarity as well.. we dont want the power supply to add its power to the meter at the end! The giant diodes were 100v schottky ones.. because I didnt know how high voltage the EMF was going to be, and schottky diodes drop less voltage across them than normal diodes do. (.2 instead of .7 V drop)
 

This just amazes me. Why don't we use this power?! 7 piddly volts- less than a full amp of supply out of that little hobby power supply chip, and 50 volts pouring into the capacitor!! Sure its pulses, but even the way I've set it up in the video is so rapidly pulsing it might as well be steady.

This gets me thinking! See, I was building a mini coilgun that would shoot paperclip clippings, and it shoots pretty well with a 9volt powering it. but after some failed experiments to build a 555 chip voltage double to try to boost the power, THIS idea came along!

In fact, while this video is uploading, I'm going to go kitbash it right now!

Hmm didn't work for some reason. Maybe he 650v capacitor didn't have enough power capacity to fully energize the gun barrel coil I set up. Or something. bummer. Good news though: it DOES make an effective voltage tripler!! Those giant 10v 4700 Caps I tried to make my first symet out of were the original battery bank for the coilgun, Arranged in a neat circular frame that the coilgun could be suspended in the middle of in a sort of "raygun" configuration that I liked.
See? Isn't that awesome looking?! I don't bother making something unless it makes the inner child in me giggle with joy a bit.

 Together their capacity was 14100uf.. which.. I don't know, may equal 1.41 Full Farad. But in my initial build, all I could pump into those Capacitors was the maximum voltage my little hobby power supply could provide: 10V. this was the upper limit of the pulse I could send through the coilgun... meaning the 1.4" clip of paperclip only shot about 3 feet straight up.. pretty good for no moving parts and all, but not really a GUN. My goal for this coilgun is to have it punch a hole in a piece of paper in front of it... here's hoping!

Oh (lost track) so anyway, this Back EMF rig I have didn't work as a power bank, so, I tried it on my coilgun power bank seen here, to see if the EMF pulses could pump higher voltages into them. It DID. Sure the buildup was slow, so I guess the EMF spikes were infinitesimal (high voltage)spikes, but nevertheless, the volt gauge I had clipped onto them showed the charge rising, and rising, and rising, the meter slowing down its charge around 23V (remember the starting voltage was 7). I didn't have the patience to let it climb up to 50, to see if it could actually reach that charge, and anyway, the caps were only 10v, so if I pushed them too far, they go POOF- so I've heard.
 
So, if I can start with 7v and end up with 25v+ in a capacitor bank, then the back EMF rig is something I have a real use for; a way to double, triple, even septuple voltage, without any complicated electronics nor timing circuits.. nor reall any other parts at all! And thats cool enough to keep.

Finished the Leave Me ALONE! box, p2

Where was I? oh yeah, the wiring it all up:

And there it is.. all done! Little bit of hotglue to secure the freeform "brains" in place for all the shaking in its future, and using the red wired purposely soldered in a "too high" arch (so that the wires would pin the brains in place when the baseplate was screwed down.. sneaky, huh?!)
 
All that was left to do for now was to put a fresh battery in, bolt it all up tight, and add a little red ink to the silver paint I put in the writing on top.. and it was finished!
 
 
I'm taking a break on the LeaveMeALONE! box for a while, let it sit in glory for a while on my "neat stuff" shelf. But there ARE plans for further additions! After the relay mod, the DPDT switch is really not being fully used anymore.. and I have ideas for what to do with the "off" position set of posts. Things it can do when its technically "off"... like punish people who peek. But you know the saying: a pic is worth 1000 words, so lets save some space:

From Top to Bottom: micro piezo buzzer, mercury tilt switch, submicro pager vibrator motor. Oh.. that thing on the right? Just a little something I yanked out of an old CD-Rom player.... thats mah LAYZOR diode!!
Basically; if its "off" but the tilt switch on underside of door gets closed, all hell breaks loose on the cover itself- the buzzer is piercing at 9v, the pager motor is insane buzzing (feels like getting shocked, actually) at 9v.. and the laser.. well.. I'm not an EVIL guy, who wants to blind anyone or anything, so I was thinking more for internal effects.. a laser "tripwire" spotted when you open the lid for a peek... or a servo mounted cylon scan sweep inside.. something. I dunno. but nothing EVIL ( maybe I'll save it for mounting on frickin' sharks heads!!)