November 24, 2024, 12:44:16 AM

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.


Scary Mirror Prop - Prop1, AP-8, RC-4, PIR

Started by jukingeo, September 30, 2011, 08:45:01 PM

Previous topic - Next topic

jukingeo

September 30, 2011, 08:45:01 PM Last Edit: September 30, 2011, 08:50:03 PM by jukingeo
Hello All,

For Halloween this year, I am FINALLY doing a couple of scares AND going to put a Prop controller for Halloween use! (I have many times used Prop-1 and Prop-2 in other scenarios).

Ok, one of the props involves a two way mirror in which a scary prop is positioned behind it.   Under normal conditions, with lights on in the room, the mirror appears like...well a mirror!   However, when the scare is triggered (via PIR), the lights in the room go off and lights behind the mirror (but in front of the scary prop) turn on making the prop visible through the two way mirror.   On top of that a loud scream is played through a speaker located near the mirror.

What I wanted to do was to use an AP-16+ to handle the above task, BUT it does look like I am already exceeding my budget for this year's Halloween, as I recently moved to a new home and it I have to redo most of my Halloween props to accommodate the new location.  The costs are mounting higher than expected.

While I might still be able to squeeze the AP-16+ into the budget, I am certainly not going to put my eggs all in one basket and I have to resort to a backup plan.

Moving on,  I already own a Prop-1, an AP-8, a RC-4, and a PIR that I could press into use to accomplish this task.

What I would like to do is the following:

1) An ambient track plays softly via the AP-8
2) The RC-4 turns on a set of blue lights that light the room.
3) The PIR is triggered by an approaching victim
4) The RC-4 turns off the blue lights in the room and turns on white lights that light the prop behind the mirror.
5) The AP-8 plays a loud scream.
6) Hold for duration of the scream sample (about 2 or 3 seconds)
7) Reset back to blue lights and ambient track.
8) Reset PIR for 30 seconds to avoid constant triggering by guests
9) Go back to 1 above and await another 'victim'

I know this seems strange as this is kind of a beginners program for me, but the truth be told that in the aforementioned move, a couple of my memory sticks have gone missing and one of them had all of my Prop-1 & 2 notes and template programs on them :(.

With Halloween looming over my head I just don't have time to look for the memory sticks right now and I want to have this ready in the event I can't budget in the AP-16+ for this year.

Thank You in advance.

GEo





JackMan

October 01, 2011, 08:46:31 AM #1 Last Edit: October 01, 2011, 08:51:00 AM by JackMan
I'm no programming Guru (like Jon) but I think this will work for you.


 
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================

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


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


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

SYMBOL Sio    = 7                            'Serial connection SETUP = UP; no ULN
SYMBOL PIR    = PIN6                         'SETUP = DN

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

SYMBOL  IsOn   = 1
SYMBOL  IsOff  = 0

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

SYMBOL timer      = B2

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

Power_Up:
  PAUSE 2000                                    ' let AP-8 power up

Reset:
  PINS = %00000000                              ' clear all outputs
  DIRS = %00111111                              ' make P0-P5 outputs
  SEROUT Sio, OT2400, ("!RC4", %00, "R", 1, 1)  ' turn on relay 1 (blue lights)
  SEROUT Sio, OT2400, ("!AP8", %00, "L", 0, 0)  ' play ambient audio loop (audio segment 0)
  PAUSE 30000                                   ' PIR warm-up/post delay

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

Main:
timer = 0                                     ' reset timer

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



  SEROUT Sio, OT2400, ("!RC4", %00, "R", 1, 0) ' turn off relay 1 (blue lights)
  SEROUT Sio, OT2400, ("!RC4", %00, "R", 2, 1) ' turn on relay 2 (white lights)
  SEROUT Sio, OT2400, ("!AP8", %00, "P", 1)    ' play loud scream (audio segment 1)
  PAUSE 3000                                   ' wait 3 seconds
  SEROUT Sio, OT2400, ("!AP8", %00, "X")       ' AP-8 stopped
  SEROUT Sio, OT2400, ("!RC4", %00, "X")       ' reset all relays
  GOTO Reset

jukingeo

Quote from: JackMan on October 01, 2011, 08:46:31 AM
I'm no programming Guru (like Jon) but I think this will work for you.

Thank you Jackman,

I will say that I had more of a grasp on the Prop-2 controller and I bought a Prop-1 about a year or so ago because I realized that most of the work I do could be handled by the Prop-1.   So I was/am still learning the Prop-1.   The thing is that I just don't work with the Prop controllers often enough to be 'an expert'.   I just kept refreshing myself with all the notes I made when Jon was coaching me.  Trouble is all those notes are on that memory stick :(.

Anyway, I will do a rough setup later on today and give that program a test.

Quick question to refresh my memory:

How come you don't have to designate a "PIN" designation for Pin 7 (which is normally used for the serial I/O)?

Thanks again.

Geo


JonnyMac

QuoteI'm no programming Guru (like Jon) but I think this will work for you.

I'm lucky: I get a lot of on-the-job practice.  Nicely done, Jack.


QuoteHow come you don't have to designate a "PIN" designation for Pin 7

This is one of the toughest parts of PBASIC1; and we fixed this in PBASIC 2.5 (I was one of the architects of that fix while working at Parallax).  I've explained this a couple times and thought it best to create a dedicated thread.  Here it is:

http://www.efx-tek.com/php/smf/index.php?topic=1773.0
Jon McPhalen
EFX-TEK Hollywood Office

jukingeo

Quote from: JonnyMac on October 01, 2011, 11:24:08 AM

I'm lucky: I get a lot of on-the-job practice.  Nicely done, Jack.

I WISH I could put more time in, but it is difficult.  That is why I made a bunch of notes, and I MUST find that memory stick.

I must say that coming on board with you guys here was one of the best things working with these micro-controllers.  But it is ironic that after all this time (when coming on board with the Prop-2), this is the first time I am physically putting an actual Halloween prop under the control of a Prop controller.  In the past I mostly set up virtual scenarios and mock props (for getting ideas for future applications).  So it will be cool to see how this comes together.  BUT I AM still interested in the AP-16+.   Oh!  And I can't wait until you come out with a Propeller based controller :).

Quote
QuoteHow come you don't have to designate a "PIN" designation for Pin 7

This is one of the toughest parts of PBASIC1; and we fixed this in PBASIC 2.5 (I was one of the architects of that fix while working at Parallax).  I've explained this a couple times and thought it best to create a dedicated thread.  Here it is:

http://www.efx-tek.com/php/smf/index.php?topic=1773.0

Well, I knew it was not a good thing to use the PIN designation for the Sio, I just forgot why.  But thank you for putting a sticky on the reason why.  It certainly was a good memory refresher.

I am putting the system together as we speak and I am going to try out Jack's program which I have ready to go.

Thank You,

Geo