November 17, 2024, 07:35:35 AM

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.


electric chair

Started by sk287930, April 02, 2008, 01:06:14 PM

Previous topic - Next topic

sk287930

I decided to skip the mauseleum prop for now and just do a more simple prop such as an electric chair which will just use one cylinder. 

I need help still though with the coding.

I want to activate it using a PIR sensor.

Once activated have the cylinder extend, retract, extend, retract, extend, retract, extend, retract and at the same time this all starts have a soundtrack playing using the ap8.....   for 45 seconds then the sound and cylinder action stops completely.

I would then like to have it coded to not be able to be tripped again for 2 minutes.

I appreciate your help everyone.

Also, is it possible to add a strobe light to the prop-1... to be activated at the same time through the whole duration of the prop?  If so, where do I hook it up to on the prop-1?

-Scott



sk287930

also, with the cylinder extending and retracting, I want them to be real quick so maybe like extended for even up to a half a second if at all possible.  Thanks once again.
-Scott

livinlowe

Shawn
Scaring someone with a prop you built -- priceless!

JonnyMac

You can use one of the extra outputs from the program Shawn references above to control a relay (or SSR) that activates your strobe.
Jon McPhalen
EFX-TEK Hollywood Office

sk287930

i tried getting that code to open but I can't.  It says that it's corrupted.  Can I just get a quick script for the electric chair as described w/out the strobe light.  I'm using the pir sensor and the ap8 audio.  I appreciate it. 
-Scott

JonnyMac

Give this a try -- I just whipped it out off the top of my head because, frankly, that's sometimes a good way to get better at programming.  These kinds of programs are not hard when you've had practice.

You can use a PIR or N.O. button (between P6.W and P6.R) to trigger the program.  The AP-8 is connected to P7 (make sure you have a ULN2003 or snip pin 1 of the ULN2803) and file 0 is played, so record to that segment then open switched 0, 1, and 2 so that the Prop-1 can select it.


' =========================================================================
'
'   File...... Electric_Chair-2008.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK (www.efx-tek.com)
'   E-mail.... jwilliams@efx-tek.com
'              Copyright (c) 2008 EFX-TEK
'              Some Rights Reserved
'              see: http://creativecommons.org/licenses/by/3.0/us/
'   Started...
'   Updated... 12 APR 2008
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Sio             = 7                     ' SETUP = out; no ULN
SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  Valve           = PIN0


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

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

SYMBOL  Baud            = OT2400

SYMBOL  ThrashTime      = 10000                 ' thrash for ten seconds


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

SYMBOL  delay           = B2                    ' valve on/off delay

SYMBOL  timer           = W4                    ' for event timing
SYMBOL  lottery         = W5                    ' random #


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

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

  SEROUT Sio, Baud, ("!!!!!!AP8", %00, "X")     ' kill audio

  PAUSE 20000                                   ' inter-show delay
  timer = 0                                     ' reset timer


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

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

Start_Audio:
  SEROUT Sio, Baud, ("!AP8", %00, "P", 0)       ' play sound #0

Thrash:
  timer = 0

Keep_Thrashing:
  Valve = 1 - Valve                             ' toggle valve output
  RANDOM lottery                                ' new random #
  delay = lottery // 151 + 100                  ' delay = 100 to 250
  PAUSE delay                                   ' hold
  timer = timer + delay                         ' update timer
  IF timer < ThrashTime THEN Keep_Thrashing     '  and check
    GOTO Reset                                  ' reset everything


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


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


' -----[ User Data ]-------------------------------------------------------
Jon McPhalen
EFX-TEK Hollywood Office

sk287930

what do you mean by "ULN2003 or snip pin 1 of the ULN2803"?  Thanks for the code.  I hope to have that prop built today and then need to purchase some more prop 1s.  Thanks once again Jon.

JonnyMac

Jon McPhalen
EFX-TEK Hollywood Office

gadget-evilusions

I used this program last week in an Electric Chair I built for a haunted attraction, and it was perfect.

Is there a way to make it so that it operates 4 different outputs randomly, but in the same style as the electric chair (fast and randomly timed).

I am making a prop that that uses 4 cylinders to thrash a body during an electric torture scene, and would like to operate the enitre prop completely randomly vs having all the cylinders activate at once.
Brian
Evilusions LLC
www.evilusions.com for all your pneumatic components

JonnyMac

June 09, 2008, 11:31:56 AM #9 Last Edit: June 09, 2008, 12:17:28 PM by JonnyMac
This question probably should have been in a new thread but, perhaps, there are some that want to add multiple valves to an electric chair so this update shows how.  Just a note on random parallel outputs: it's important to put the RANDOM function into a short loop when the output is going to be parallel outputs.  The reason is that the internal process is called a Linear Feedback Shift Register and if you don't stir more than once, you can actually see the linear shifting movement of the bits in the output.  With valves on a prop this might not be a problem, but with LEDs -- especially in a row (like on the Prop-1 Trainer) -- this movement is very apparent.

So... what I did was a big stir of the random value and then copied the lower four bits of it to the lower four bits of the outputs; note that masking is used to protect the other pins.

' =========================================================================
'
'   File...... Thrasher.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK (www.efx-tek.com)
'   E-mail.... jwilliams@efx-tek.com
'              Copyright (c) 2008 EFX-TEK
'              Some Rights Reserved
'              see: http://creativecommons.org/licenses/by/3.0/us/
'   Started...
'   Updated... 09 JUN 2008
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Sio             = 7                     ' SETUP = out; no ULN
SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  Valve4          = PIN3
SYMBOL  Valve3          = PIN2
SYMBOL  Valve2          = PIN1
SYMBOL  Valve1          = PIN0


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

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

SYMBOL  Baud            = OT2400

SYMBOL  ThrashTime      = 10000                 ' thrash for ten seconds


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

SYMBOL  delay           = B2                    ' valve on/off delay
SYMBOL  idx             = B3                    ' loop controller

SYMBOL  timer           = W4                    ' for event timing
SYMBOL  lottery         = W5                    ' random #


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

Reset:
  PINS = %00000000                              ' clear all outputs
  DIRS = %00001111                              ' make P0-P3 outputs

  SEROUT Sio, Baud, ("!!!!!!AP8", %00, "X")     ' kill audio

  PAUSE 20000                                   ' inter-show delay
  timer = 0                                     ' reset timer


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

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

Start_Audio:
  SEROUT Sio, Baud, ("!AP8", %00, "P", 0)       ' play sound #0

Thrash:
  timer = 0

Keep_Thrashing:
  FOR idx = 1 TO 3                              ' big stir
    RANDOM lottery
  NEXT
  PINS = lottery & %00001111                    ' update four valves
  RANDOM lottery                                ' new random #
  delay = lottery // 151 + 100                  ' delay = 100 to 250
  PAUSE delay                                   ' hold
  timer = timer + delay                         ' update timer
  IF timer < ThrashTime THEN Keep_Thrashing     '  and check
    GOTO Reset                                  ' reset everything


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


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


' -----[ User Data ]-------------------------------------------------------
Jon McPhalen
EFX-TEK Hollywood Office

gadget-evilusions

June 09, 2008, 11:50:24 AM #10 Last Edit: June 09, 2008, 11:52:34 AM by gadget-evilusions
You amazing jon.

I posted the question in this thread because I will also be adding this functionality to an electric chair also, and I figured it was an addition to the above program.. thank you very much sir.
Brian
Evilusions LLC
www.evilusions.com for all your pneumatic components