May 02, 2024, 01:24:38 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.


how can I do this II

Started by bill, July 11, 2018, 09:22:33 PM

Previous topic - Next topic

bill

I asked before and you said it could be done, I have thought about it a little more and have a better description. I plan to use a retro-reflective sensor as the trigger. I will have 20 reflectors set up around the path to trigger the sensor. I will be using 2 audio players, along with a SS relay. There will be a full background soundtrack, playing from start to finish. There will be sound effects at each scene.
For the input signal(Insig), the sensor is 12 volt. I am thinking I could use a 12vdc coil relay to use P6 or P7(these are 5volt?

My thought is that each reflector will trigger different effect. I have it planned as follows: Insig1=start full ride audio; Insig2=play nursery rhyme; Insig3=play scream; Insig4=relay output firecracker; Insig5= circus; Insig6= sawmill; and so on.

My thought is the prop controller will run a register, something like Insig1, Insig1+1=Insig2, and keep counting up until the last input. The last input will shut off all sound and reset the program.

The other question I have is the input for the prop controller, is it a PNP or a NPN setup? I think it is a PNP setup.

Well I hope I can get this to work. I know you guys are expert genius' on this kind of stuff. Also, tell me what I need and I can get it ordered.

Thank you so much.

Bill (Ideas I have, answers, not so much)






JonnyMac

Using the NPN type sensor is the safest way to go because it switches between open and ground, and ground is common to the board and to the 12V supply used by the sensor. Since you also posted in the Prop-1 forum (I locked that thread), I will provide an idea with Prop-1 code.

First, you'll need to modify the Prop-1 to remove the ULN influence from P6 and P7. If it's a new controller use this document:
-- http://www.efx-tek.com/downloads/prop-1_revG_addendum.pdf

If you have an older board with a socketed ULN, refer to this post:
-- http://www.efx-tek.com/php/smf/index.php?topic=130.0

In either case, after removing the ULN influence from P6 and P7, you'll want to move the P6/P7 SETUP jumpers to the UP position. This sets up the pins for use with NPN sensors and serial communications with our accessory boards.

Here's an example -- UNTESTED, but does compile -- that I think matches your requirment. It thinks there are two AP-16+ audio players. One playing the main show audio is at address 0 (A1 and A0 OFF), and the effects audio player is at address 1 (A1 is off, A0 is on). Both are set to 2400 baud (BR is OFF), and no looping.

This program expects your main audio to be on player 0 and called SFX00.WAV. The other files are on player 1 and called SFX01.WAV up to SFX19.WAV (assuming you have 19 sound effects waypoints).

' =========================================================================
'
'   File...... bills_train.bs1
'   Purpose... Audio control for Bill's train ride
'   Author.... JonnyMac of EFX-TEK
'   E-mail....
'   Started...
'   Updated... 12 JUL 2018
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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

' Uses NPN sensor on P6 to control audio at various waypoints of ride


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


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

SYMBOL  Sio             = 7                     ' SETUP = UP; no ULN
SYMBOL  Trigger         = PIN6                  ' SETUP = UP; no ULN


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

SYMBOL  Yes             = 1
SYMBOL  No              = 0

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

SYMBOL  TriggerOff      = 1                     ' for active-low (NPN)
SYMBOL  TriggerOn       = 0

SYMBOL  Baud            = OT2400

SYMBOL  LastSFX         = 19                    ' 20 total waypoints


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

SYMBOL  debounce        = B2                    ' for input timing
SYMBOL  waypoint        = B3                    ' track to play
SYMBOL  tens            = B4                    ' help for PW feature
SYMBOL  ones            = B5


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

Power_Up:
  PAUSE 3500                                    ' let players reset
  SEROUT Sio, Baud, ("!AP16", $FF, "X")         ' reset both players

Reset:
  PINS = %00000000                              ' all off
  DIRS = %00111111                              ' P5..P0 are outputs

  waypoint = 0


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

Main:
  debounce = 0                                  ' reset debounce timer

Check_Trigger:
  PAUSE 5                                       ' scan delay
  IF Trigger = TriggerOff THEN Main             ' check trigger input
  debounce = debounce + 5                       ' update timer
  IF debounce < 50 THEN Check_Trigger           ' check timer

  IF waypoint > 0 THEN Play_Waypoint            ' where are we now?

Play_Master_Audio:
  SEROUT Sio, Baud, ("!AP16", %00, "PS", 0, 1)  ' start show audio
  GOTO Next_SFX


Play_Waypoint:
  tens = waypoint  / 10 + "0"                   ' 10s digit to ASCII
  ones = waypoint // 10 + "0"                   '  1s digit to ASCII

  ' play waypoint audio
  ' waypoint number is converted to ASCII for PW command

  SEROUT Sio, Baud, ("!AP16", %01, "PW", "SFX", tens, ones, 13, 1)


Next_SFX:
  PAUSE 1000                                    ' allow sensor to clear
  waypoint = waypoint + 1                       ' prep for next file
  IF waypoint > LastSFX THEN Reset              ' done?
    GOTO Main


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


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


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




Jon McPhalen
EFX-TEK Hollywood Office