November 23, 2024, 07:32:50 PM

News:

Got VSA?  Want to use your Prop-SX?  Now you can!  See the VSA section of the Library forum for Prop-SX code that works with VSA.


Casket

Started by RosehallManor, September 21, 2010, 08:28:32 PM

Previous topic - Next topic

RosehallManor

Hey Everyone,

I need some programming help.  I need some help with a program.  I am running behind.  In fact I still need to purchase another prop1 and PIR!  I have a casket I want to:
  when triggerred by the PIR
  the casket lid will open slowly and 12v LEDs will come on inside the casket
  Once open, a skeleton will sit up
  the skeleton will sit up for 3 seconds then fall back to sleep
  the lid will close
  the prop will "rest" for 45 seconds

I am worried if I try writing this program, the skeleton will try to break through the top of the casket.  Then the lid will open.

Please Help!!

bsnut

I have no problem writing a program for you.
William Stefan
The Basic Stamp Nut

JackMan

RosehallManor,
      A little more info would be helpful. How much time is required for the lid to fully open? Do you want the LED's to come on as soon as the lid starts to open or after it is fully open? What's the total time required for the skeleton to sit up, pause 3 seconds, and lay back down?

bsnut

September 22, 2010, 07:28:30 AM #3 Last Edit: September 22, 2010, 07:41:36 AM by bsnut
Here is your program that you are looking for. Just copy and paste this program into your Basic Stamp Editor
' =========================================================================
'
'   File......Casket Popup Prop.BS1
'   Purpose...For Casket Popup Prop
'   Author....
'   E-mail....
'   Started...9/22/2010
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL  Sio             = 7                     ' SETUP = out; no ULN
SYMBOL  Trigger         = PIN6                  ' SETUP = DN; for PIR sensor
SYMBOL  CasketLight     = PIN5                  ' 12VDC light in casket; OUT5
SYMBOL  LidValve        = PIN4                  ' Casket Lid solenoid valve; OUT4
SYMBOL  SkeletonValve   = PIN3                  ' Skeleton soleniod valve; OUT3

' -----[ Constants ]-------------------------------------------------------

SYMBOL  IsOn            = 1                     ' for active-high in/out
SYMBOL  IsOff           = 0

SYMBOL  Baud            = OT2400


' -----[ Variables ]-------------------------------------------------------

SYMBOL  timer           = B2


' -----[ Initialization ]--------------------------------------------------

Reset:
 PINS = %00000000                              ' clear all outputs
 DIRS = %00111111                              ' make P0-P5 outputs
 PAUSE 45000                                   ' PIR warmup and prop reset


' -----[ Program Code ]----------------------------------------------------

Main:
 timer = 0                                     ' reset timer

Check_Trigger:
 PAUSE 5                                       ' loop pad
 timer = timer + 5 * Trigger                   ' update timer
 IF timer < 100 THEN Check_Trigger             ' wait for 0.2 sec input

Opening_Casket_Lid:
 LidValve = IsOn                               ' turn on Casket Lid solenoid valve
 CasketLight = IsOn                            ' turn on 12VDC light in casket
 PAUSE 5000                                    ' wait for 5 seconds Casket Lid to open
 SkeletonValve = IsOn                          ' turn on Skeleton soleniod valve
 PAUSE 3000                                    ' wait for 3 seconds then fall back to sleep
 SkeletonValve = IsOff                         ' turn off Skeleton soleniod valve
 PAUSE 2000                                    ' wait for 2 seconds
 LidValve = IsOff                              ' turn off Casket Lid solenoid valve
 CasketLight = IsOff                           ' turn off 12VDC light in casket
 GOTO Reset


' -----[ Subroutines ]-----------------------------------------------------


' -------------------------------------------------------------------------


' -------------------------------------------------------------------------


' -------------------------------------------------------------------------


' -------------------------------------------------------------------------


' -------------------------------------------------------------------------


' -----[ User Data ]-------------------------------------------------------

Since, this is a pneumatic prop, you need to have and adjust the flow regulators so that the lid is fully open before the skeleton to sits up. I provided in the program a 5 second delay for this. I also provided a 2 second delay for the skeleton to lay back down before the lid closes after the 3 second delay you were looking for. I will also provide a connection drawing so you can see how it is connected to the prop1.     
William Stefan
The Basic Stamp Nut

JonnyMac

A programmer cannot help you without more information.  For example, you say that you want the lid to open "slowly."  Controllers don't know "slowly," they know specific time intervals.  What this means is that you'll have to get your prop setup, adjust the flow-restictor for the lid cylinder to your liking, and then measure that time.  This is information a programmer will need to write the code so that the lid has plenty of time to open before the skeleton's cylinder is activated.

Likewise, one would need to know how long it takes the skeleton to retract so that the lid is not closed too soon.
Jon McPhalen
EFX-TEK Hollywood Office

bsnut

September 22, 2010, 03:41:11 PM #5 Last Edit: September 22, 2010, 10:19:21 PM by bsnut
Jon and JackMan are correct in saying their is little information to go on.

The program that I provided is a open loop program, meaning that the program runs the code without the outside world telling the prop1 (basic stamp) if it completed a task, like is the casket lid fully open.  When we close the loop the prop1 knows that it completed a task, by using limit switch or switches to tell the prop1 that it is done with a task.

I would suggest that you use limit switch on the casket lid to indicate that the lid is fully open. This can be done by adding a input to the prop1 for the lid, that indicates that is fully open and you can put a second input to the prop1 to indicate that the skeleton is laying down. With two limit switches as inputs, you can use the 3 second delay, without the need for knowing how long the cylinder needs to extend.

You can put a limit switch  in series with the skeleton valve which will work too. But, you still need to know long it takes for the cylinder to extend if put the limit switch in series with skeleton valve.
William Stefan
The Basic Stamp Nut

youngti

I did something like this called Sliding lid casket.  Here is the link http://www.efx-tek.com/php/smf/index.php?topic=1231.0
This uses no pneumatics and is relatively simple to build.  I also have an instructional pdf that I can send you if you like.  If you want the PDF send me a private message with e-mail and I can get it out to you.

RosehallManor

So, I think I have the programming concept down, but I have another question.  Right now the casket is sitting out in my yard propped open a bit.  I put the LED's inside of it just to light it up for now.  I used 7   5mm LED's with resistors for 12 volts.  I used a 12v 500mA output and it overheated...DEAD.  Will the power supply safely power the 12v lights as well as 2 solenoids?  They will only be on for like 30-35 seconds at a time, but the solenoids will be firing as well.  I appreciate any input... Thanks

JonnyMac

500mA?  No.  If you're using our 12v 1000mA supply then I think you'll be okay, but it's hard to know for sure without knowing the rating of your valves and how much current you're LEDs are drawing.
Jon McPhalen
EFX-TEK Hollywood Office

bsnut

I agree with Jon on this one. The best way to prevent from burning up the power supply or the ULN is to know how much everything draws(eg Vavles, LED's) . Once, you know your total current draw in mA or amps, then you can pick the power supply that fits your needs.

Another safe way, is to use relays for the heavy loads or for loads that stay on for a long time. Relays don't draw that much at all(100 mA or so) and they protect the ULN from overcurrent. You will, still need to know how much your total current draw is.
William Stefan
The Basic Stamp Nut

RosehallManor

Thanks for your replies.  I am using two STC 12v solenoids.  They are model 4V110-1/8.  THe only markings on them say 12V 2.5W.  I bought the LED's/resistors on EBay and had to put them together.  With that info, will the 1000mA supply work, or do you need more?   

BigRez

Those valves draw about .21 amps (2.5w/12vdc) which is more than fine.  I used those exact valves (and the slightly larger 4v210-1/4) without any problems.  Of course you're connecting the valves to the OUTx and V++ connections and not the PINS, correct?

RosehallManor

Yes, connecting to outputs not pins.  The LED's will also be on the outputs.  I used seven LED's to get enough light, but I could certainly cut back if necessary.

gadget-evilusions

Using your original 500ma power supply, you could have overloaded it if all your items were on.

2 valves @ 2.5 w = 420ma
7 leds @ 25ma    =  175ma
                             ------------
                               595ma

Granted none of this is exact. Superbright 5mm lLEDs vary from 20-30ma, the coil draw on a solenoid isn't always exact. I prefer to build with a good margin, so it would be in your best interest to use a regulated 12v supply rated at 1000ma, any project I do with an EFX-TEK controller gets one of their power supplies, http://www.efx-tek.com/topics/12vdc.html

This is also calculated that each led has it's own resistor and they are not in arrays.
Brian
Evilusions LLC
www.evilusions.com for all your pneumatic components

JonnyMac

And cheap supplies are.... well... cheap.  One should always budget at least 50% -- if not 100% -- when using an unknown supply.  That is to say that if your circuit needs 500mA you really should use a supply that can provide at least 1000mA so that you don't stress it into bad behavior.
Jon McPhalen
EFX-TEK Hollywood Office