|
Author: |
Rembrandt |
Created: |
2/16/2007 12:06 PM |
 |
|
A blog to track the [slow] progress in learning how to make an Adventurers' Club Mask room. |
|
Almost Blinking ... |
|
|
By Rembrandt on
4/3/2007 1:20 PM
|
|
|
With a little more tinkering, I got the code fairly close to a 'double blink' with the servo. [With the beginnings of serial out as well, I might take a little stab at a windows program to read what the pic is sending out and update an image on the screen or something .. the beginnings of a controll program.
Since I have done a lot of talking about stuff, with out much concrete examples, I decided the otherday to start pasting up code. That way I can not only show others, but have some place to go find it if i lose my project :P
So, here is the 'blink' routine, which is written for the PIC 16F874-A
'**************************************************************** '* Name : Futaba s3003 RC Servo Test 'Blink-Blink '* Author : Steven Ivan Walk '* Notice : Freely given from www.Code-Geek.com '* : '* Date : 4/3/2007 '* Version : 1.1 '* Notes : PIC 16F874-A, '* : Pin 20 = Servo Control Out '* : Pin 21 = LED indicator Out '* : Pin 40 = Serial Communication Out '* : 4.00 hz Crystal '**************************************************************** DEFINE OSC 4 start: high portd.2 pulseWidth var byte ' set up constants with the minimum and maximum pulsewidths minPulse CON 50 maxPulse CON 100 ' set up a constant with the time between pulses: refreshPeriod CON 20 looper var word outerlooper var word ' set an initial pulsewidth: pulseWidth = minPulse
main: for outerlooper = 1 to 2 'take the output pin low so we can pulse it high Low PORTd.1 ' pulse the pin for looper = 1 to 12 PulsOut PORTd.1, pulseWidth ' pause for as long as needed: Serout2 portb.7, 16468, [DEC pulsewidth,10,13] Pause refreshPeriod next
Low PORTd.1 ' pulse the pin for looper = 1 to 12 PulsOut PORTd.1, maxpulse ' pause for as long as needed: Serout2 portb.7, 16468, [DEC maxpulse,10,13] Pause refreshPeriod Next pause 250 Next pause 2000 Serout2 portb.7, 16468, ["looping",10,13] GoTo main
|
 |
|
|
|
|
|
Da-Da-Da-da-DA do the servo shuffle. |
|
|
By Rembrandt on
4/3/2007 12:15 AM
|
|
|
My breadboard isn't playing nicely. Something is wierd with it. Either they are warped, or there is some strange loose connection inside, or who knows what. They were originally mounted to a metal sheet with clips: two for power and one ground. Maybe the sheet metal was warped and it slowly bent the plastic as they sat there for years on a shelf. Who knows. All I know is that its a pain in the ass sometimes. Not only do my PIC chips loose power randomly, But I have actually fried one of the 627-a's :( Free or not, its still a chip. Regardless, off of the metal backing they came, and they are more reliable now. Not 100%, but at least i know what to expect.
Since last time, I managed to get serial communication back to my PC working, So I had chips talking to hyperterminal on my pc. I started messing around with PNP transistors as digital switchs, and this weekend I bought a RC servo from the local hobbyworks.
I have managed to make the server quickly go about 30 degrees. ALMOST fast enough for a blink. I am only using a 4mhz crystal .. which only lets you manage 10ms signals. A 20mhz crystal will allow as low as 2ms signals. So one of them will go on my next parts order from digikey. With the 'registered' version of Picbasic Pro, I could write a number of 'blink routines', like single blink, double blink, eyelids 1/2 closed etc .. and fire them off from a serial program or whatever to the mask.
I also noticed that if the servo loses power, it will 'hold' position. I am not sure if its got predefined stops, but that could be very use for certain applications, pulsing power into the servo to hold it in place isnt very efficient. Thats where the transistors come in. I have been turning the servo on and off via a pnp transistor acting as a switch - there is no reason i couldn't send a 'halt' command to the servo to 'freeze' it with eyes in a certain position or whatever. I just don't know how it will react when getting power the next time.
These servos (the cheap ones) are pretty big, so i definatly can see a 'housing box' for electronics that might hide behind the mask with only linkages or speakers etc coming out. Probably will need to be recessed into the wall or something. But cheap servo's definatly open up a lot of interesting things. Now I have to figure out how to make mechanical linkages etc.
|
 |
|
|
|
|
|
Step One .. Don't Panic |
|
|
By Rembrandt on
3/12/2007 10:41 PM
|
|
|
Well, I finally got a working PICKit 2 from Microchip. It took me a few days to understand how the PICBASIC compiler works with the programming environment. Microchip's IDE environment was confusing as hell, and, of course, came with almost NO documentation.
Following one of the books I have, I started using MicroCode Studio [Free] with PicBasic Pro Compiler from melabs.com [Free]. I had to wait a few days for my free samples to come in from Microchip, as none of the chips I had bought for my programmer worked with the free compiler. The registered version of the compiler that works with everything runs about $230.00 .. So free chips it is, until my code demands more lines or better chips.
After about 2 days I *FINALLY* got a helloworld ... a blinking LED. WOOT.
That rapidly turned into a blinking light on a second chip when a pin on the first chip was +5v. Which soon turned into the second chip getting power, and the +5v pin reading via a cat-5 cable. *cool*.
Tonight while waiting for the USPTO to update .. I played around with serial communication between two chips. [sending only numbers, no ascii chars yet.] As I don't have a usb <-> serial cable yet [but will soon $4.00 off ebay] I had to do all my debugging with LED's. 1/2 way though the project some wierdness occoured. My circut spontaniously loses power ? or something wierd. if I move the .1uf capacater i have across Vdd and Vss on the first chip [or totally remove and put it back] the circut starts going again. Sometimes if i touch the metal housing the breadboards are attached to, that will reset it too. Either the breadboards are cheap [I hope not, it was like $40.00] or I might have hurt one of the chips somehow .. regardless ..
Tonight's final result was that I have a PIC16f627A talking to a PIC16f876A via Serial communications. The 876A [chip two] will flash a green LED if it receives a value of 8, with a double flash for a value of 7. It flashes a red LED for any other value.
Chip A can send 7,8, or 125, determined by the presence or lack of +5v on two pins, over the serial communications pin.
Works pretty good.
What does this get me ? one might ask :
I know I can send Power [+5v], Pin voltages, and Serial Communication over Cat-5. I know I can, using jumpers or a DIP switch array, set the address on a PIC, and then communicate that address to another chip. I know that, on another chip, I can do something depending on the value of an address.
What this gets me bigger picture wise, is the ability to make a 'routing' circutboard with multiple cat-5 jacks. These jacks can be connected to child boards - which can be set with an address via dip switches. When a command is sent to the main chip on the router board, I can compare the 'target address' of the command with any of the child boards attached to the router board, and send the command accordingly.
Depending on how I truncate the command string, I can even have programmable sub circuts on the child board, to fire off selected events .. so I'm thinking via serial communication my commands might look like this :
[address of child].[address of child target].[command values]*
Where command values are whatever I need for the sub circut. [analog voltage, pin on .. whatever]
This might let me standardize commands .. for example maybe a command of 'blink eye' might have a command value of 57. [regardless of if a mask has that ability] so if I wanted all masks who COULD blink, TO blink, I wouldn't have to program each one, I would just send the command out to ALL masks, ALL Targets with command 57.
The ones that could blink, would.
I havent really gotten to far in thinking the language behind all this out quite yet. :P I need talking circuts first.
Then .. I need masks - but I have been thinking of ways to make them efficiently. Probably casting with Bondo and plaster molds - as they would be neigh-unbreakable - and I could saw and cut them into 'moving' parts without losing integrety easily.
Besides, 1 gallon of bondo is like $15 .. thats 1-2 good sized masks.
|
 |
|
|
|
|
|
|
It all starts with an Idea. |
|
|
By Rembrandt on
2/16/2007 12:07 PM
|
|
|
I'm not sure who here has been to The Adventurers' Club in Downtown Disney Orlando. I've
gone a few times, its a fun place - because they like to play with the
drunks. There are all kinds of 'tricks' like barstools that move, or
strange lighting effects.
My favorite, is a room called the
'Mask' room, where there are a bunch of audioanimatronic masks covering
the walls. every once in a while, one moves. It blinks, or its eyes
light up, or it closes its mouth .. etc .. not enough so that you would
really notice, but enough so out of the corner of your eye (especially
if you have been drinking) you might say .. 'hey .. did that just move
?'
Needless to say, I was fascinated with this room BEFORE I went to disney with my best friend and his (now X) wife.
Kevin suggested out loud (after a few beers) 'How cool would it be to build something like this !'
Man .. what a horrible thing to say.
|
 |
|
|
|
|
|
|
 |
|
|
Blog History |
 |
|
|
|
|