November 24, 2024, 04:22:40 PM

News:

You can now use Vixen to program your Prop-1 and Prop-2 controllers!  Get started quickly and easily, without having to learn PBASIC.  Details in the Library forum.


new to this, need help with my crypt

Started by werf, September 22, 2012, 08:35:25 AM

Previous topic - Next topic

werf

Hi, I am new here. Got my prop-1 starter kit and have played a bit. But I think it is above me to make it for this season. I have a crypt that the top raises on. Componants are 12V sol for cyl, fogger, a small fan, and a light. it will be triggered by a switch. I have my ss relays for the light, fan, and fogger. my plan: switch activated, fogger starts, adjustable timer(so i can adjust) and the top raises a bit, then closes. I want the light and fan to start at the same time. then the top raises all the way, stays on for X number of seconds and then closes. every thing shuts down then, waiting for the next cycle. It would be cool to randomize the effect a bit so it is not the same every time. Whaty do you think can you help me?
Werf

bsnut

I will be happy to help you and will have a program done for you by this time tomorrow.
William Stefan
The Basic Stamp Nut

bsnut

September 22, 2012, 02:17:44 PM #2 Last Edit: September 23, 2012, 10:45:59 AM by bsnut
Here's your program for you to try. I randomize the lid opening and how long the lid stays open. The fogger time is adjustable by using the pot on your trainer board that came with the Prop-1 Starter Kit.

' =========================================================================
'
'   File......Crypt.bs1
'   Purpose...Control a Crypt Prop with fogger
'   Author....W. Stefan
'   E-mail....
'   Started...9/22/2012
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Fogdelaypot     = 7             ' fogger timer pot SETUP = out; no ULN
SYMBOL  Trigger         = PIN6          ' SETUP = DN
SYMBOL  CryptLight      = PIN5          ' 12VDC light in Crypt; OUT5
SYMBOL  CryptLid        = PIN4          ' Crypt Lid solenoid valve; OUT4
SYMBOL  FanRelay        = PIN3          ' Fan relay control
SYMBOL  FoggerRelay     = PIN2          ' Fogger relay control

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

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

SYMBOL  Baud            = OT2400

SYMBOL  Scale           = 100           ' scale value for pot circuit
SYMBOL  Mintime         = 15000         ' timing for opening the lid
SYMBOL  Maxtime         = 60000

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

SYMBOL  timer           = B2
SYMBOL  fogdelay        = B3            ' storage for the pot value
SYMBOL  opendelay       = W4            ' open dealy
SYMBOL  delay           = W5            ' run delay
SYMBOL  lottery         = W6            ' random # for delay


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

Reset:
  PINS = %00000000                      ' clear all outputs
  DIRS = %00111111                      ' make P0-P5 outputs


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

Main:
  timer = 0                             ' reset timer


Check_Trigger:
  PAUSE 5                               ' loop pad
  timer = timer + 5 * Trigger           ' update timer
  RANDOM lottery                        ' stir random #
  IF timer < 200 THEN Check_Trigger     ' wait for 0.2 sec input


Fogger_Control:
  timer = 0                             ' reset timer
  POT Fogdelaypot, Scale, timer         ' read pot raw level
  timer = timer - 5                     ' correct low end offset
  fogdelay = timer * 40                 ' convert to 0 to 10s
  FoggerRelay = IsOn                    ' turn on fogger relay
  PAUSE fogdelay
  FoggerRelay = IsOff                   ' turn off fogger relay

Opening_Crypt_Lid:
  delay = Maxtime - Mintime + 1         ' get span
  delay = lottery // delay + Mintime    ' calc lid timing
  FanRelay = IsOn                       ' turn on fan relay
  CryptLight = IsOn                     ' turn on 12VDC light in casket
  CryptLid = IsOn                       ' turn on Crypt Lid solenoid valve
  PAUSE 3000                            ' wait for 3 seconds for Crypt Lid
                                        ' to open a little bit
  opendelay = delay - 10000             ' set random open delay
  CryptLid = IsOff                      ' turn off Crypt Lid solenoid valve
  PAUSE opendelay
  Cryptlid = IsOn
  PAUSE delay                           ' show run delay
  FanRelay = IsOff                      ' turn off fan relay
  CryptLight = IsOff                    ' turn off 12VDC light in crypt
  CryptLid = IsOff                      ' turn off Crypt Lid solenoid valve
  GOTO Main


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



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

William Stefan
The Basic Stamp Nut

werf

Thanks, you are fantastic. I will load it tomorrow and give it a try.

Thanks again,
Werf

werf

ok, i tried the program on my trainer, think you could help me with a few changes. First turn on fogger, 15 sec latter turn on light, fan and solnoid open, hold 3 sec, turn off solenoid 4 sec, turn on solenoid 5 sec, turn off solenoid 5 sec, turn on solenoid 20 sec. end program

werf

Not sure how to do this, but when the trigger is tripped I want it to ignore any more trips until it has run its full program. I think this should be an easy fix, but just not sure.

livinlowe

Quote from: werf on October 10, 2012, 10:35:17 AM
Not sure how to do this, but when the trigger is tripped I want it to ignore any more trips until it has run its full program. I think this should be an easy fix, but just not sure.
The program should do this. Have you noticed that it doesnt?
Shawn
Scaring someone with a prop you built -- priceless!

bsnut

Quote from: werf on October 07, 2012, 05:45:12 PM
ok, i tried the program on my trainer, think you could help me with a few changes. First turn on fogger, 15 sec latter turn on light, fan and solnoid open, hold 3 sec, turn off solenoid 4 sec, turn on solenoid 5 sec, turn off solenoid 5 sec, turn on solenoid 20 sec. end program
I will post the changes to your program I wrote for you later tonight.
William Stefan
The Basic Stamp Nut

bsnut

Here's your redone program that is based on the info you provided in your last post.

' =========================================================================
'
'   File......Crypt_vers2.bs1
'   Purpose...Control a Crypt Prop with fogger with no random delay
'   Author....W. Stefan
'   E-mail....
'   Started...10/10/2012
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------
' First turn on fogger, 15 sec latter turn on light, fan and solnoid open,
' hold 3 sec, turn off solenoid 4 sec, turn on solenoid 5 sec, turn off
' solenoid 5 sec, turn on solenoid 20 sec. end program

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


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

'SYMBOL  Fogdelaypot     = 7             ' fogger timer pot SETUP = out; no ULN
SYMBOL  Trigger         = PIN6          ' SETUP = DN
SYMBOL  CryptLight      = PIN5          ' 12VDC light in Crypt; OUT5
SYMBOL  CryptLid        = PIN4          ' Crypt Lid solenoid valve; OUT4
SYMBOL  FanRelay        = PIN3          ' Fan relay control
SYMBOL  FoggerRelay     = PIN2          ' Fogger relay control

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

SYMBOL  IsOn            = 1             ' for active-high in/out
SYMBOL  IsOff           = 0
SYMBOL  fogdelay        = 15000         ' 15 second fogger delay time change
                                        ' here if you need more or less delay

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

SYMBOL  timer           = B2

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

Reset:
  PINS = %00000000                      ' clear all outputs
  DIRS = %00111111                      ' make P0-P5 outputs


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

Main:
  timer = 0                             ' reset timer


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


Fogger_Control:
  FoggerRelay = IsOn                    ' turn on fogger relay
  PAUSE fogdelay
  FoggerRelay = IsOff                   ' turn off fogger relay

Opening_Crypt_Lid:
  FanRelay = IsOn                       ' turn on fan relay
  CryptLight = IsOn                     ' turn on 12VDC light in casket
  CryptLid = IsOn                       ' turn on Crypt Lid solenoid valve
  PAUSE 3000                            ' wait for 3 seconds for Crypt Lid
                                        ' to open a little bit

  CryptLid = IsOff                      ' turn off Crypt Lid solenoid valve
  PAUSE 4000                            ' wait for 4 seconds
  Cryptlid = IsOn                       ' turn on Crypt Lid solenoid valve
  PAUSE 5000                            ' wait for 5 seconds
  CryptLid = IsOff                      ' turn off Crypt Lid solenoid valve
  PAUSE 5000                            ' wait for 5 seconds
  Cryptlid = IsOn                       ' turn on Crypt Lid solenoid valve
  PAUSE 20000                           ' delay for 20 sec
  FanRelay = IsOff                      ' turn off fan relay
  CryptLight = IsOff                    ' turn off 12VDC light in casket
  CryptLid = IsOff                      ' turn off Crypt Lid solenoid valve
  GOTO Main


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



' -----[ User Data ]-------------------------------------------------------
William Stefan
The Basic Stamp Nut

JackMan

QuoteNot sure how to do this, but when the trigger is tripped I want it to ignore any more trips until it has run its full program. I think this should be an easy fix, but just not sure.

The only thing I see is that there's no post delay between triggers which means it will re-trigger immediately at the end of the program if the trigger is closed. It's an easy fix, I highlighted the changes in red. It gives you a 30 second post delay between triggers.


' =========================================================================
'
'   File......Crypt.bs1
'   Purpose...Control a Crypt Prop with fogger
'   Author....W. Stefan
'   E-mail....
'   Started...9/22/2012
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Fogdelaypot     = 7             ' fogger timer pot SETUP = out; no ULN
SYMBOL  Trigger         = PIN6          ' SETUP = DN
SYMBOL  CryptLight      = PIN5          ' 12VDC light in Crypt; OUT5
SYMBOL  CryptLid        = PIN4          ' Crypt Lid solenoid valve; OUT4
SYMBOL  FanRelay        = PIN3          ' Fan relay control
SYMBOL  FoggerRelay     = PIN2          ' Fogger relay control

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

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

SYMBOL  Baud            = OT2400

SYMBOL  Scale           = 100           ' scale value for pot circuit
SYMBOL  Mintime         = 15000         ' timing for opening the lid
SYMBOL  Maxtime         = 60000

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

SYMBOL  timer           = B2
SYMBOL  fogdelay        = B3            ' storage for the pot value
SYMBOL  opendelay       = W4            ' open dealy
SYMBOL  delay           = W5            ' run delay
SYMBOL  lottery         = W6            ' random # for delay


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

Reset:
  PINS = %00000000                      ' clear all outputs
  DIRS = %00111111                      ' make P0-P5 outputs
  PAUSE 30000

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

Main:
  timer = 0                             ' reset timer


Check_Trigger:
  PAUSE 5                               ' loop pad
  timer = timer + 5 * Trigger           ' update timer
  RANDOM lottery                        ' stir random #
  IF timer < 200 THEN Check_Trigger     ' wait for 0.2 sec input


Fogger_Control:
  timer = 0                             ' reset timer
  POT Fogdelaypot, Scale, timer         ' read pot raw level
  timer = timer - 5                     ' correct low end offset
  fogdelay = timer * 40                 ' convert to 0 to 10s
  FoggerRelay = IsOn                    ' turn on fogger relay
  PAUSE fogdelay
  FoggerRelay = IsOff                   ' turn off fogger relay

Opening_Crypt_Lid:
  delay = Maxtime - Mintime + 1         ' get span
  delay = lottery // delay + Mintime    ' calc lid timing
  FanRelay = IsOn                       ' turn on fan relay
  CryptLight = IsOn                     ' turn on 12VDC light in casket
  CryptLid = IsOn                       ' turn on Crypt Lid solenoid valve
  PAUSE 3000                            ' wait for 3 seconds for Crypt Lid
                                        ' to open a little bit
  opendelay = delay - 10000             ' set random open delay
  CryptLid = IsOff                      ' turn off Crypt Lid solenoid valve
  PAUSE opendelay
  Cryptlid = IsOn
  PAUSE delay                           ' show run delay
  FanRelay = IsOff                      ' turn off fan relay
  CryptLight = IsOff                    ' turn off 12VDC light in crypt
  CryptLid = IsOff                      ' turn off Crypt Lid solenoid valve
  GOTO Reset


bsnut

October 11, 2012, 02:05:33 AM #11 Last Edit: October 11, 2012, 02:35:37 AM by bsnut
Thanks goes to Jack :), since I did think you needed a post delay. But the good thing is you have two programs to use. I fixed the second program that I wrote for you, now you can have three of them to play with.

' =========================================================================
'
'   File......Crypt_vers2.bs1
'   Purpose...Control a Crypt Prop with fogger with no random delay
'   Author....W. Stefan
'   E-mail....
'   Started...10/10/2012
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------
' First turn on fogger, 15 sec latter turn on light, fan and solnoid open,
' hold 3 sec, turn off solenoid 4 sec, turn on solenoid 5 sec, turn off
' solenoid 5 sec, turn on solenoid 20 sec. end program

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


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

SYMBOL  Trigger         = PIN6          ' SETUP = DN
SYMBOL  CryptLight      = PIN5          ' 12VDC light in Crypt; OUT5
SYMBOL  CryptLid        = PIN4          ' Crypt Lid solenoid valve; OUT4
SYMBOL  FanRelay        = PIN3          ' Fan relay control
SYMBOL  FoggerRelay     = PIN2          ' Fogger relay control

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

SYMBOL  IsOn            = 1             ' for active-high in/out
SYMBOL  IsOff           = 0
SYMBOL  fogdelay        = 15000         ' 15 second fogger delay time change
                                        ' here if you need more or less delay

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

SYMBOL  timer           = B2

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

Reset:
  PINS = %00000000                      ' clear all outputs
  DIRS = %00111111                      ' make P0-P5 outputs

  PAUSE 30000                           ' wait for 30 seconds

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

Main:
  timer = 0                             ' reset timer


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


Fogger_Control:
  FoggerRelay = IsOn                    ' turn on fogger relay
  PAUSE fogdelay
  FoggerRelay = IsOff                   ' turn off fogger relay

Opening_Crypt_Lid:
  FanRelay = IsOn                       ' turn on fan relay
  CryptLight = IsOn                     ' turn on 12VDC light in casket
  CryptLid = IsOn                       ' turn on Crypt Lid solenoid valve
  PAUSE 3000                            ' wait for 3 seconds for Crypt Lid
                                        ' to open a little bit

  CryptLid = IsOff                      ' turn off Crypt Lid solenoid valve
  PAUSE 4000                            ' wait for 4 seconds
  Cryptlid = IsOn                       ' turn on Crypt Lid solenoid valve
  PAUSE 5000                            ' wait for 5 seconds
  CryptLid = IsOff                      ' turn off Crypt Lid solenoid valve
  PAUSE 5000                            ' wait for 5 seconds
  Cryptlid = IsOn                       ' turn on Crypt Lid solenoid valve
  PAUSE 20000                           ' delay for 20 sec
  FanRelay = IsOff                      ' turn off fan relay
  CryptLight = IsOff                    ' turn off 12VDC light in casket
  CryptLid = IsOff                      ' turn off Crypt Lid solenoid valve
  GOTO Reset                            ' goto post delay in Initialization
                                        ' section


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



' -----[ User Data ]-------------------------------------------------------
William Stefan
The Basic Stamp Nut

JackMan

QuoteThanks goes to Jack , since I did think you needed a post delay.

No, thanks goes to you Bill, you wrote the program, I just added 1 small item.  ;)

werf

ok, this works fine on the trainer, but when i wire it to the terminals nothing works

werf

I got everythin to work except for thr fogger. I think I may have a bad relay, checkin it now. Thanks to both of you for your help. I will let you know when I get it working, considering I need it for Saturday.

Werf