November 24, 2024, 09:44:13 PM

News:

Be sure to checkout our Vixen interfaces in the Library forum -- if you want PC automation at near zero cost, EFX-TEK and Vixen is a great combination of tools.


Help integrating the Prop-1 and Monster Guts Nerve Center

Started by smileyface4u23, October 06, 2012, 11:41:49 PM

Previous topic - Next topic

smileyface4u23

This is for an Exorcist bed running off pneumatic cylinders.  The plan (if it works) is to have the prop-1 trigger off a PIR, then trigger the Monster Guts Nerve Center.  The Nerve Center will run Regan's spinning head and provide the audio for the music and her voice.  After her 35 second program runs, I plan to have the prop-1 make her bed bounce and rise.  We have 2 double acting pneumatic cylinders running off 12VDC solenoids.  One cylinder is at the head of the bed, and one at the foot of the bed.  I would like the head/foot boards bounce up and down a few times (5-6 times) making it look like her bed is shaking, have both drop down and then have the bed rise and stay in the air for 8 seconds before lowering and having the program reset.   Can the Prop-1 and Nerve Center be integrated so the Prop-1 actually tells the Nerve Center when to run?  If it can, I have no idea how to write the code to make that happen. 

How I see the program in my head...
PIR Triggers Prop-1
Prop-1 triggers Nerve Center
Nerve center plays 36 second program
Prop 1 makes cylinders on headboard/footboard bounce 5-6 times each
both cylinders lower
both cylinders raise and hold for 8 seconds
both cylinders lower
program resets

I hope I was clear enough - if not, please let me know and I'll try to make myself more clear.  Thank you in advance for any help you can give me.

JonnyMac

Please provide a link to documentation for the Nerve Center so that we can figure out how to integrate the two device if it's possible.
Jon McPhalen
EFX-TEK Hollywood Office

smileyface4u23

Here's the link to the Nerve Center manual - as far as I know this is the only documentation available.  Thank you.

http://monsterguts.com/manuals/Nerve_Center.pdf

JackMan

Give this program a try. Connect a common GND between the Prop-1 and your Nerve Center, connect OUT2 from the Prop-1 to IN on your Nerve Center trigger terminal. Make sure your Nerve Center is set up for N.O. trigger.


' =========================================================================
'
'   File...... Exorsist
'   Purpose...
'   Author....
'   E-mail....
'   Started...
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL PIR         = PIN6                       ' setup/DN
SYMBOL NerveCntr   = PIN2                       ' Nerve Center trigger - connect OUT2 to IN (Nerve Center set for N.O. trigger)
                                                ' MUST connect common ground between Prop-1 and Nerve Center
SYMBOL FootValve   = PIN1                       ' foot solenoid on V+ and OUT1
SYMBOL HeadValve   = PIN0                       ' head solenoid on V+ and OUT0

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

SYMBOL  IsOn            = 1                     ' for active-high in/out
SYMBOL  IsOff           = 0
SYMBOL  SHAKE_TIME      = 4000                  ' shake duration

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

SYMBOL  valves          = B2
SYMBOL  last            = B3
SYMBOL  delay           = W3
SYMBOL  timer           = W4                     ' for debounce loop and shake time
SYMBOL  lottery         = W5


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

Reset:
  PINS = %00000000                              ' clear all outputs
  DIRS = %00111111                              ' make P0-P5 outputs
  PAUSE 60000                                   ' PIR warm up and post delay

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

Main:
  timer = 0                                     ' reset debounce timer

Check_Trigger:
  PAUSE 5                                       ' scan delay
  timer = timer + 5 * PIR                       ' update timer
  IF timer < 200 THEN Check_Trigger             ' wait for 0.2 sec input

  NerveCntr = IsOn                              ' Start Nerve Center
  PAUSE 1000
  NerveCntr = IsOff                             ' Nevre Center trigger off
  PAUSE 35000                                   ' play 36 second program from Nerve Center

  timer = 0                                     ' reset timer

Shake_It:
  RANDOM lottery
  valves = lottery & %00000011                  ' isolate two bits
  IF valves = last THEN Shake_It                ' force change
    last = valves
  PINS = PINS & %11111100 | valves              ' update valve outputs
  RANDOM lottery
  delay = lottery // 151 + 100                  ' create delay
  PAUSE delay
  timer = timer + delay
  IF timer < SHAKE_TIME THEN Shake_It

  HeadValve = IsOff                             ' valves off
  FootValve = IsOff
  PAUSE 1000
  HeadValve = IsOn                              ' valves on
  FootValve = IsOn
  PAUSE 8000
  HeadValve = IsOff                             ' valves off
  FootValve = IsOff

  GOTO Reset

JonnyMac

Luckily, it appears that you can start the Nerve Center by connecting one of the OUTx terminals on the Prop-1 to the IN triggper point. You also need to connect the GND terminal to ground on the Nerve Center.

I promise I didn't look at Jack's program when I wrote this -- but this is a style I suspect Jack learned from me (which makes me happy!). Mine is similar but randomizes the bed shaking time.

' =========================================================================
'
'   File......
'   Purpose...
'   Author....
'   E-mail....
'   Started...
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  NerveStart      = PIN5                  ' use OUT5 and GND

SYMBOL  Valve2          = PIN1                  ' use V+ and OUT1
SYMBOL  Valve1          = PIN0                  ' use V+ and OUT0


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

SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  TrOn            = 1                     ' active-high trigger
SYMBOL  TrOff           = 0

SYMBOL  IsOn            = 1                     ' active-high I/O
SYMBOL  IsOff           = 0



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

SYMBOL  valves          = B3
SYMBOL  last            = B4

SYMBOL  delay           = W3
SYMBOL  lottery         = W4                    ' random #
SYMBOL  timer           = W5                    ' for debounce & timing


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

Reset:
  PINS = %00000000                              ' all off
  DIRS = %00100011                              ' P5, P1..P0 are outputs

  PAUSE 30000                                   ' inter-show delay


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

Main:
  timer = 0                                     ' reset debounce timer

Check_Trigger:
  RANDOM lottery                                ' stir random #
  PAUSE 5                                       ' scan delay
  IF Trigger = TrOff THEN Main                  ' check trigger input
    timer = timer + 5                           ' update timer
  IF timer < 100 THEN Check_Trigger             ' check timer

  NerveStart = IsOn                             ' start Nerve Center
  PAUSE 1000

  NerveStart = IsOff                            ' end start pulse
  PAUSE 35000                                   ' finish NC program delay

  RANDOM lottery
  timer = lottery // 1000 + 2000                ' random 2 to 3 seconds

Bed_Shake:
  RANDOM lottery                                ' re-stir random #
  valves = lottery & %11                        ' extract valve control bits
  IF valves = last THEN Bed_Shake               ' force state change
    last = valves                               ' save for next
  PINS = valves                                 ' update valves
  RANDOM lottery                                ' re-stir random #
  delay = lottery // 250 + 100                  ' create delay
  IF delay > timer THEN End_Shake               ' done with cycle?
    PAUSE delay                                 ' do delay
    timer = timer - delay                       ' update timer
    IF timer = 0 THEN Lower_Bed                 ' timer expired?
    GOTO Bed_Shake                              ' no, keep going

End_Shake:
  PAUSE timer                                   ' finish timer period

Lower_Bed:
  PINS = IsOff                                  ' lower bed
  PAUSE 1000

Raise_Bed:
  PINS = %00000011                              ' both on
  PAUSE 8000

  GOTO Reset


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


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


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


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


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

JackMan

QuoteI promise I didn't look at Jack's program when I wrote this -- but this is a style I suspect Jack learned from me (which makes me happy!).

You got it buddy! I always like to learn from the best!  ;)