Need help using input switches and other stuff (For theater set at school)
Tech-Man
Posts: 100
First,
I need to figure out how to use my BS1 for something but when I went to connect it to my computer it dose not identify. I have Vista and I got the USB driver installed. So I'm guessing it's something else. Worse comes to worse ill just code on another computer.
Second,
I'm a stage tech for our school theater. Were building a set right now with lighted steps, so when he steps on a step it lights then when he gets off, it turns off and the step hes on now lights. You get the point maybe.
So I can do this pretty easily by rigging up a low voltage stitch in each step then have that trigger the corresponding relays for the 120V lamp's.
But I was thinking about having it do some other stuff that would require implementing my BS1.
Things that id need help knowing how to do.
1. Use one pin for the inputs of 8-10 steps. I think this can be done using resisters but i don't know what the schematic is for that.
2. Using the inputs from the steps, to control the the state of the 7 pins that will trigger the relays.
3. Maybe just some knowledge on how to use inputs.
4. Any ideas of what to use as a trigger on the steps (that can be made cheaply or out of scrap materials).
5. Anything else I would need to know.
See he (the actor) gos up the stairs onto a platform that is 6' in the air and sings while dancing. So while hes singing going up the stairs my vision is to have the stair under him stay on then the next and the next so that when he reaches the platform at the top, all the steps are on then they go into chasing patterns or blinking (random stuff). After hes done singing the steps will start going off one by one as he gos down.
I'm pretty good with the electronics part of all this I'm just asking for help with the programing. I know all this can be done so it shouldn't be that hard.
I know this is asking allot but the set shure would look better if I could implement the BS1 and add animation instead of just having lamps that go on and off.
We still have a few weeks so theres no rush. But we would like to get it done so they can use the set for play practice.
Encase your wondering the musical were currently doing is The Wiz.
On the behalf of the entire drama department and I thanks for any help.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
There are no Undo buttons in life.
I need to figure out how to use my BS1 for something but when I went to connect it to my computer it dose not identify. I have Vista and I got the USB driver installed. So I'm guessing it's something else. Worse comes to worse ill just code on another computer.
Second,
I'm a stage tech for our school theater. Were building a set right now with lighted steps, so when he steps on a step it lights then when he gets off, it turns off and the step hes on now lights. You get the point maybe.
So I can do this pretty easily by rigging up a low voltage stitch in each step then have that trigger the corresponding relays for the 120V lamp's.
But I was thinking about having it do some other stuff that would require implementing my BS1.
Things that id need help knowing how to do.
1. Use one pin for the inputs of 8-10 steps. I think this can be done using resisters but i don't know what the schematic is for that.
2. Using the inputs from the steps, to control the the state of the 7 pins that will trigger the relays.
3. Maybe just some knowledge on how to use inputs.
4. Any ideas of what to use as a trigger on the steps (that can be made cheaply or out of scrap materials).
5. Anything else I would need to know.
See he (the actor) gos up the stairs onto a platform that is 6' in the air and sings while dancing. So while hes singing going up the stairs my vision is to have the stair under him stay on then the next and the next so that when he reaches the platform at the top, all the steps are on then they go into chasing patterns or blinking (random stuff). After hes done singing the steps will start going off one by one as he gos down.
I'm pretty good with the electronics part of all this I'm just asking for help with the programing. I know all this can be done so it shouldn't be that hard.
I know this is asking allot but the set shure would look better if I could implement the BS1 and add animation instead of just having lamps that go on and off.
We still have a few weeks so theres no rush. But we would like to get it done so they can use the set for play practice.
Encase your wondering the musical were currently doing is The Wiz.
On the behalf of the entire drama department and I thanks for any help.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
There are no Undo buttons in life.
Comments
1) The "What's a Microcontroller?" tutorial downloadable from the Stamps in Class webpage under the Downloads menu item on Parallax's main page.
2) The "Nuts and Volts Columns" also downloadable under the Downloads menu on Parallax's main page.
As is usual, these come with schematics and sample programs. Some of the earlier Nuts and Volts columns deal with the BS1. A lot of What's a Microcontroller? deals with the BS2 series of Stamps, but a lot of the simpler stuff is directly applicable to the BS1. There's also a set of BS1 Application Notes that give great examples of things to do with a BS1. This is downloadable from the Parallax webstore page for the BS1.
Make sure you have the current version of the Stamp Editor. Some of the older versions did not support the BS1. Make sure the BS1 has power applied and you have the serial programming adapter for the BS1 plugged in properly.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Flying is simple. You just throw yourself at the ground and miss.
"I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image."
Stephen Hawking
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
There are no Undo buttons in life.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--DFaust
At the time i ordered extras so i have about 8 more of each. Would any one of these two parts be of any use to me.
I have some M74HC595
and some ULN2803A
I hope you can spare some time to help me through this project, we would just love to have these steps light up. Now I have not come up with an idea for a sensers yet. But I'm thinking about just putting push buttons under thin pieces of wood. i had thought about using inferred light but like you said the stage lights would interferer.
If you have taken a look at the drawing (above) you may have noticed that I will have three pairs of steps that have to be run off the same pin since I only have 7 open for outputs. But now that you bring up the registers do you think there is any way we could run all 10 steps using only 4 channels.
I hope you or someone else can hep with the code side of all this, the only thing i have be able to code so far is a servo and an LED.
I think i need to get a BS2 since there seems to be more documentation out there.
Thanks again from everyone here and myself.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
There are no Undo buttons in life.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--DFaust
If these are standard SSRs with 5V inputs that take about 10ma to drive, you could connect them directly to the 74HC595 outputs.
You could also use a 74HC165 serial input shift register that would provide 8 inputs for each 74HC165.
Like the 74HC595, these are cascadable to give you multiples of 8 bits and they use 3 I/O pins on the BS1.
You could attach a pushbutton to each 74HC165 input with the other terminal of the pushbutton connected to ground.
The 74HC165 inputs would each need a pullup of about 10K to +5V.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--DFaust
http://computerchristmas.com/christmas/link-how_to/HowToId-68/4-channel_SSR_to_go_with_the_controller_in_the_How_To
So you think its possible to control the M74HC595 with my BS1? I thank you for actual going and testing that out. I feal like were getting somewhere on this.
About the switches, they should be real sturdy. This is how I'm going to do it there will be the stair tread then on top of that there will be a piece of 1/4'' ply the same size that is hinged on the front. This will trigger one of the two switches on either side under the hinged board.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
There are no Undo buttons in life.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--DFaust
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
There are no Undo buttons in life.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--DFaust
http://computerchristmas.com/christmas/link-how_to/HowToId-89/Understand_the_74HC595
Als i downloaded a new vesion of software so now i can program the thing.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
There are no Undo buttons in life.
Post Edited (Tech-Man) : 10/27/2007 3:01:54 PM GMT
Here it is http://www.parallax.com/dl/appnt/stamps/bs1appnotes.pdf·go to page 8 and 9 and see if you can get the code to work.
Here is the data sheet : http://www.st.com/stonline/books/pdf/docs/1989.pdf
I don't think that I can help you much more becuase I am using a BS2 with the SHIFTIN/OUT commands.· This seems like quite a large task for two weeks!· Maybe someone with more (some)·BS1 experience can help you more.· Sorry
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--DFaust
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
There are no Undo buttons in life.
Note that in both examples, it's easy to modify them to allow for more than 8 bits. Simply cascade two registers (74HC595 or 74HC165), change the for loop to go for a count of 16, and change the definition of "temp" to w0 rather than b0 (and temp7 becomes temp15 = bit15). "value" would have to become a word variable as well. In the output example, the most significant bit of the value is sent out last. In the input example, the most significant bit of the value is received first. Keep that in mind when wiring the switches.
Post Edited (Mike Green) : 10/27/2007 6:41:04 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
There are no Undo buttons in life.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--DFaust
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
There are no Undo buttons in life.
By the way, for contacts, you could use home-made switches using copper foil where there's a little play in a portion of the step ... like make each step of 3 pieces of wood and have the middle one with some kind of compressible spacer on one end ... maybe 1/8 inch. When there's weight put on the step, the "loose" end of the board goes down 1/8 inch and the copper foil on the loose piece and on the brace on the side touch each other and voila! Remove the weight and the springiness of the wood breaks the contact.
The two examples of code are specifically for the BS1.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--DFaust
This is realy dumd but about the only thing i know how to do on the BS is asign a High Low comand to a pin. But i really am trying to make an effort to lean what you two are telling me.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
There are no Undo buttons in life.
Post Edited (Tech-Man) : 10/28/2007 1:08:53 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
There are no Undo buttons in life.
' Program Listing 38.1
' Nuts & Volts: Stamp Applications, April 1998
GetPin: Dirs = %00000000 ' all pins are inputs
IF Pin0 = 1 THEN GetPin ' wait for pin to go low
Blink: Dirs = %00000001 ' make pin 0 an output
FOR B0 = 1 TO 5
PAUSE 500
Pin0 = 0 ' LED on
PAUSE 500
Pin0 = 1 ' LED off
NEXT
GOTO GetPin ' do everything again
Well last weekend i spent all day up at the school working on the sets for The Wiz they came out great and the steps are awesome but of course i need to figure out this code. Its really nice to see somthing that you have spent hours designing come together, here is a picture of the steps i built.
For about the past hour iv been working on just getting some form of input to work so·I hooked up the switches so it looks like the schematic on page 155 (BASIC Stamp I Application Notes) and then used this code just to see if i could get some readings and i got some, and they were right for once [noparse]:)[/noparse]
' {$STAMP BS1}
' {$PBASIC 1.0}
Clear:
LET B0 = 0
Again:
· POT 0, 116, B2
· IF B2 >= 231 THEN clear
· GOTO ID_sw
Display:
DEBUG B3
GOTO clear:
ID_sw:
· IF B0 > 8 THEN skip
· B0 = B0+1
· GOTO again
Skip:
· FOR B3 = 0 TO 7
····· LOOKUP B3,(7,41,75,109,141,172,201,230),B4
····· IF B2 <= B4 THEN done
··· NEXT
done:·· GOTO Display
________________________________________________________
I·run the program and it works! Iv never done anything with the BS1 past lighting an LED and making weird sounds with a speaker so I'm proud of myself so fare. It displays a value of 0-7 depending on which switch was pressed. Will this set up do the same thing if i use 11 switches instead of 8 one would think so but just checking.
Now that i have the inputs working how do i·send this value (the value it displays) to the 74hc595, well i actually need to use 2 of the 74hc595 chips since i need to control 11 steps. But I can use the same three pins to run that chip to right?
You gave me this code but i do have a few questions i hope you don't mind.
symbol data = 1· ' 74HC595 pin 14 wired to BS1 pin 1
symbol dataPin = pin1 ' same thing in different form
symbol clock = 0 ' 74HC595 pin 11 wired to BS1 pin 0
symbol latch = 2 ' 74HC595 pin 12 wired to BS1 pin 2··· <<<<<<<<<<I get whats going on up to here then ya lose me, i understand some of the other
···································································································· stuff but not enough to use it to my own benefit, maybe you could add some
···································································································· side notes like this to further explain thing. Its essayer for me to use code
···································································································when·i·know·it·means.··········································································································································································································· symbol temp = b0 ' a temporary byte variable
symbol temp7 = bit7 ' most significant bit of b0
symbol i = b2 ' another temporary used as a counter
symbol value = b3 ' just a byte variable
' part of your initialization routine
low clock ' initialize clock line to output low
low latch ' initialize latch line to output low
low data ' initialize data line to output low
' subroutine to transfer a byte from "value" to the register
send:
· let temp = value·· ' make a temporary copy of value
· for i = 1 to 8·· ' 8 bits to transfer
··· let dataPin = temp7·· ' put most significant bit on data line
··· let temp = temp * 2· ' shift to next bit in temporary value
··· pulsout clock,1·· ' put out clock pulse
· next i
· pulsout latch,1·· ' put out latch pulse to copy to output register
· return
________________________________________________
Once i figure out how to have the corresponding pins on the register chips light an LED as a switch is pressed ill huck it all up to the SSRs to control the high power lights insted of the LED. Then ill need to figure how to have each light stay on once there pressed till there pressed again and stuff like that.
I just hope i can figure out how to send stuff to the 74hc595 chip,· i think this could be used for so many other projects. Im fealling good about this just getting the switches to provide input has been hard but I'm farther then i was a week ago. Its looking like it can be done in time with a bit of help. The show starts this next Thursday so i only have about· 5 days. Everything is wired so pretty much all i need to do is upload some code to the BS1 then conect it to my SSRs.
here are some more pics of the progress iv made to break you free from all this text. Like i said i understand how to wire all this stuff its just the code thats stopping me.
·
·
·
Thanks!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
There are no Undo buttons in life.
Post Edited (Tech-Man) : 11/9/2007 8:49:29 PM GMT
from the variable "value" with bits 8 through 15 transferred into the 74HC595
furthest from the BS1 and bits 0 through 7 transferred into the 74HC595
closest to the BS1. You connect all of the clock pins (11) together and
all of the latch pins (12). The data pin (14) of the 2nd 74HC595 is
connected to the Q7' output pin (9) of the 1st 74HC595. You have to be
sure to connect the "not output enable" pins (13) of both devices to
ground through a 4.7K to 10K resistor and the "not master reset" pins
(10) of both devices to Vdd (+5V) through a 4.7K to 10K resistor.
You have to make your input routine (which uses B0,B2,B3,B4) work with this. Since the send routine has to use B0/B1, change the
variables in your input routine so B0 becomes B3, B2 becomes B6, B3 becomes B7, and B4 becomes B8. That way, the two routines
won't conflict.
Your display routine, instead of DEBUG B3, becomes value = b7 (since B3 becomes B7), followed by GOSUB send. Since your input routine only provides an
8 bit value, the send routine will output all zeros to the extra bits of the 74HC595 pair.