November 21, 2024, 03:32:26 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.


Needing Help!

Started by cooperfan, March 04, 2007, 08:53:15 PM

Previous topic - Next topic

cooperfan

     Hello my name is Dean. I'm New to the message board. I bought two prop one controllers at the 2006 Mid West Haunters Convention. I don't have a clue where to begin writing the program to control the prop one controller. im hooking up 6 lights and a motion sensor in a long hallway. i want the lights to flicker randomly like faulty wiring then when the sensor is tripped the lights go out one at a time in order away from the group. Then after about 5 seconds all the lights come back on and after 20 seconds they reset and flicker again. Any help would be greatly appreciated.

Thank you,
                Dean

JonnyMac

March 04, 2007, 09:42:49 PM #1 Last Edit: March 05, 2007, 12:33:45 AM by JonnyMac
Okay, Dean, what have you been doing with those controllers since, uh... JULY!  ;D

Believe it or not, your request is for a fairly sophisticated program -- something that would come toward the end of a book.  But here it is.  Study it using the online help file and it will all come together.  If you happened to buy a Prop-1 Trainer from us then you can see the program in action without connecting anything else.

Note: In order to keep the hallway from getting too dark or looking like a pyscho light show during the "malfunction" period, only one light is flickered at a time -- this is the purpose of the variable called "mask" in the program (it holds the pattern of 5 on and 1 off).


' =========================================================================
'
'   File...... Hallway.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK (www.efx-tek.com)
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated... 04 MAR 2007
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Motion          = PIN6                  ' SETUP = DN
SYMBOL  Lights          = PINS                  ' use P0..P5


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

SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  AllOn           = %00111111             ' all lamps on


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

SYMBOL  idx             = B2                    ' loop control
SYMBOL  mask            = B3                    ' faulty lamp mask
SYMBOL  flicks          = B4                    ' flick events
SYMBOL  timer           = W4                    ' for variable delays
SYMBOL  lottery         = W5                    ' random value


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

Reset:
  DIRS = %00111111                              ' allow all on
  GOTO Cycle_On


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

Main:
  FOR idx = 1 TO 3                              ' stir random value
    RANDOM lottery
  NEXT
  IF Motion = Yes THEN Cycle_Off                ' victims present?

Pick_Bad_Lamp:
  idx = lottery // 6                            ' create pointer, 0 - 5
  LOOKUP idx, ($3E,$3D,$3B,$37,$2F,$1F), mask

  RANDOM lottery                                ' stir again
  flicks = lottery // 3 + 1                     ' 1 to 3 flicks

Flicker:
  FOR idx = 1 TO 2
    Lights = mask                               ' light out
    RANDOM lottery
    timer = lottery // 26 + 25                  ' 25 to 50 ms
    PAUSE timer
    Lights = AllOn                              ' back on
    RANDOM lottery
    timer = lottery // 76 + 25                  ' 25 to 100 ms
    PAUSE timer
  NEXT
  flicks = flicks - 1
  IF flicks > 0 THEN Flicker                    ' finished?
    RANDOM lottery
    timer = lottery // 751 + 250                ' 0.25 to 1 sec delay
    PAUSE timer
    GOTO Main

Cycle_Off:
  FOR idx = 0 TO 6                              ' sequential shutdown
    READ idx, Lights
    PAUSE 500
  NEXT
  PAUSE 5000

Cycle_On:
  FOR idx = 6 TO 0 STEP -1                      ' sequential start-up
    READ idx, Lights
    PAUSE 75
  NEXT
  PAUSE 20000

  GOTO Main


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


' -----[ EEPROM Data ]-----------------------------------------------------

Lights_Out:
  EEPROM (%111111)
  EEPROM (%111110)
  EEPROM (%111100)
  EEPROM (%111000)
  EEPROM (%110000)
  EEPROM (%100000)
  EEPROM (%000000)
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

And in the event I misunderstood you and you want all the lights to flicker at the same time, I've attached a version that does that.


' =========================================================================
'
'   File...... Hallway-v2.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK (www.efx-tek.com)
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated... 04 MAR 2007
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Motion          = PIN6                  ' SETUP = DN
SYMBOL  Lights          = PINS                  ' use P0..P5


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

SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  AllOn           = %00111111             ' all lamps on
SYMBOL  AllOff          = %00000000             ' all lamps off


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

SYMBOL  idx             = B2                    ' loop control
SYMBOL  flicks          = B3                    ' flick events
SYMBOL  flkDelay        = B4                    ' delay between flickers
SYMBOL  timer           = B5                    ' for variable delays
SYMBOL  lottery         = W5                    ' random value


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

Reset:
  DIRS = %00111111                              ' allow all on
  GOTO Cycle_On

  flkDelay = 100                                ' set for 2.5 secs


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

Main:
  FOR idx = 1 TO 3                              ' stir random value
    RANDOM lottery
  NEXT

  IF Motion = Yes THEN Cycle_Off                ' victims present?

  IF flkDelay = 0 THEN Flicker_Cycle
    PAUSE 25
    flkDelay = flkDelay - 1
    GOTO Main

Flicker_Cycle:
  RANDOM lottery                                ' stir again
  flicks = lottery // 4 + 1                     ' 1 to 4 flicks

Flicker:
  FOR idx = 1 TO 2
    Lights = AllOff                             ' light out
    RANDOM lottery
    timer = lottery // 26 + 10                  ' 10 to 25 ms
    PAUSE timer
    Lights = AllOn                              ' back on
    RANDOM lottery
    timer = lottery // 51 + 50                  ' 50 to 100 ms
    PAUSE timer
  NEXT
  flicks = flicks - 1
  IF flicks > 0 THEN Flicker                    ' finished?

Reset_Flicker_Timer:
  RANDOM lottery
  flkDelay = 81 + 40                           ' set 1 to 3 seconds
  GOTO Main

Cycle_Off:
  FOR idx = 0 TO 6                              ' sequential shutdown
    READ idx, Lights
    PAUSE 500
  NEXT
  PAUSE 5000

Cycle_On:
  FOR idx = 6 TO 0 STEP -1                      ' sequential start-up
    READ idx, Lights
    PAUSE 75
  NEXT
  PAUSE 20000

  GOTO Main


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


' -----[ EEPROM Data ]-----------------------------------------------------

Lights_Out:
  EEPROM (%111111)
  EEPROM (%111110)
  EEPROM (%111100)
  EEPROM (%111000)
  EEPROM (%110000)
  EEPROM (%100000)
  EEPROM (%000000)
Jon McPhalen
EFX-TEK Hollywood Office

cooperfan

 Thanks for the help. We bought them in July and were so busy building we didn't have time to even look at them. Are you guys gonna be at MWHC again this year? If so are you gonna do a seminar? I have a couple of more places i want to use the controllers but i would like to be able to know how to do them myself. I'm gonna study this one to get an idea. Thanks again.


Dean

JonnyMac

Yes, we think so.  But don't count on it -- there's a lot of time between now and then and if you'll just "play" for 15 or 20 minutes a day you'll be an expert by the time the busy season rolls around.
Jon McPhalen
EFX-TEK Hollywood Office

cooperfan

  I hooked up the prop trainer and the program worked great. I do have another question. how do the lights hook up to the prop 1 controller? Do they still need thier own power source? Or does the controller power them?


Dean

JonnyMac

If you're using 12v or 24v lamps AND the total current consumption is less than about 1500 mA for all six, then you can hook them right up to the controller.  Use the V+ terminal as the common side and the OUT0..OUT5 terminals as the control side (one per light).  Just make sure your 12- or 24-volt DC power supply can handle the current as well.

If your lamps are 120 VAC then you'll need two RC-4 boards, six 3-pin extension wires, and six Crydom relays (one for each circuit).  You could control the RC-4s through a single serial connection but your flickering rate would be affected (would be slower due to the message transmission time).  Maybe this isn't a problem.  If you're going to use the RC-4s and want a serial version, let me know and I'll update the program.
Jon McPhalen
EFX-TEK Hollywood Office

cooperfan

 Ok i just recieved my RC-4 boards And my Crydom Relays . I plugged each Relay into the RC-4 boards. then attached The RC-4's to the prop 1 controller with six  3-pin extention wires. The led's come on on both RC-4 and start flickering so I assume i have it hooked up right. Now how exactly do the lights hook up to the RC-4? Thanks for all the info so far youv'e benn a great help.



Dean

JonnyMac

The RC-4 documentation (see below) shows how to hook up lights; what you're going to do is use the RC-4 to switch the HOT side of the A/C circuit.  Note: You are dealing with 120 VAC now and this could be dangerous so get help from an experienced friend (preferably an electrician) before moving on.

RC-4 Documentation
Jon McPhalen
EFX-TEK Hollywood Office

gmacted

JonnyMac: "Note: You are dealing with 120 VAC now and this could be dangerous so get help from an experienced friend (preferably an electrician) before moving on."

Excellent advice Jon.  Those are "words to live by" ... literally!