November 15, 2024, 03:55:04 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.


prop 1 can yall see if i got a clue ???

Started by cmgjeep, August 11, 2009, 08:14:20 AM

Previous topic - Next topic

cmgjeep


Hello
Starting a new adventure, learning a new language (basic) as standard English is not hard enough
I am trying I thought was a simple prop, maybe I could get some input from the forum
Would like to control 2 12v lights using a separate power source and also have a 12v air horn
On the hood of an old dump truck
Objective:
Have lights flash on off slowly 3 times and on the forth flash have the air horn blast all about
A total of 10 to 15 seconds
Using all car parts for lights and horn

I have a prop 1 and a pir sensor
Will the prop 1 supply enough voltage to trigger the relays?
If so I attempted to write the first program by looking through the site in here
Any suggestions so I don't blow all my Dominos tips they have been little to none
If I need another controller I can always roll pennies for efx to get what I might need



' {$STAMP BS1}
' -----[ constants ]---------------------------
SYMBOL ison = 0
SYMBOL isoff = 1
' -----[ i/o definitions ]---------------------
SYMBOL lights = 0 'lights output to p0
SYMBOL horn = 1 'horn outputs to p1
SYMBOL trigger = PIN7 'trigger input to p7
'----[ program ]-------------------------------
main:
  IF trigger =  IsOff THEN main    ' wait for trigger
  HIGH lights
  PAUSE 150
  LOW lights
  PAUSE 250
  HIGH lights
  PAUSE 150
  LOW lights
  PAUSE 250
  HIGH horn
  PAUSE 100
  LOW horn
  PAUSE 250
GOTO main

??? sorry remember to   grin

JonnyMac

August 11, 2009, 08:29:18 AM #1 Last Edit: August 22, 2009, 01:17:04 PM by JonnyMac
That looks like it will work -- and here's another version.  We recommend using P6 as the trigger input to keep P7 free for serial devices; this also makes the program compatible with the Prop-1 Trainer.  This version is a little more verbose, but will easier to edit and maintain.

Note that this version uses our standard debouncing loop at the top to prevent false starts.

Updated 22 AUG 2009 -- added retrigger delay for PIR


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


' -----[ Program Description ]---------------------------------------------
'
' Sio     :: Serial IO to EFX-TEK accessories (RC-4, FC-4, etc.)
'            -- clip pin 1 of ULN2803 or replace with ULN2003
'
' Trigger :: Parallax-compatible PIR or N.O. button (mat switch, etc.)
'            -- connect N.O. button between P6.W and P6.R


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


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

SYMBOL  Sio             = 7                     ' SETUP = UP; no ULN
SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  Horn            = PIN1
SYMBOL  Lights          = PIN0


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

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

SYMBOL  Yes             = 1
SYMBOL  No              = 0


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

SYMBOL  timer           = B2
SYMBOL  idx             = B3


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

Reset:
  PINS = %00000000                              ' set IOs
  DIRS = %00000011                              ' declare output pins

  PAUSE 20000                                   ' PIR warm-up/re-trigger delay                               '


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

Main:
  timer = 0                                     ' reset timer

Check_Trigger:
  PAUSE 5                                       ' loop pad
  timer = timer + 5 * Trigger                   ' update timer
  IF timer < 100 THEN Check_Trigger             ' wait for 0.1 sec input

  FOR idx = 1 TO 3
    Lights = IsOn
    PAUSE 150
    Lights = IsOff
    PAUSE 250
  NEXT

  Horn = IsOn
  PAUSE 100

  GOTO Reset                                    ' everything off


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


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


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

cmgjeep

thanks for the help i will try mine and also the one Mr mac wrote 
i have a good hunch witch one will work

the only question i still have is will the prp 1 supply enough to trigger the 12v car relays
every thing i have read talks about the servo plugs at 5v, is it the same on the wire connections?

JonnyMac

You'll have to check the relays -- if the coils are rated 3w or less you're fine (most are).  If you look at the Prop-1 docs you'll see that relays connect between the OUTx terminals and V+.
Jon McPhalen
EFX-TEK Hollywood Office

cmgjeep

every thing is working great!!
except for some odd reason the prop is triggering it's self after the frist turn on
it plays the program 1 time then goes through it agian playing a 2nd
is this normal or should i just wait to see if it does it a third??
i taped the pir down to limit is's sensitivity




JonnyMac

You don't have any retrigger delay built in and this is usually a good idea with a PIR.  Change the Reset section to this:

Reset:
  PINS = %00000000                              ' set IOs
  DIRS = %00000011                              ' declare output pins

  PAUSE 20000


The PAUSE 20000 serves two purposes: 1) it allows the PIR to warm-up when you first turn on the prop and, 2) it provides a retrigger delay so that the prop doesn't immediately run again -- this allows the "victims" to clear the PIR zone.

Jon McPhalen
EFX-TEK Hollywood Office

cmgjeep

do i insert the 20000 pause in place of the

Check_Trigger:
  PAUSE 5                                       ' loop pad

if so do i need to change anything on the

timer = timer + 5 * Trigger                   ' update timer
  IF timer < 100 THEN Check_Trigger             ' wait for 0.1 sec input

just to let you know i am outside under a shed with my prop
do yall think i still need to narrow my triggers view any more after i redo the pause time or just a trial and error that i am having fun with

JonnyMac

<southern accent>What we have here is a failure to communicate.</accent>  ;D

No, do not change the debounce loop; it works just fine.  What you have to do is prevent an immediate re-triggering of the prop if victims are still in the area after the prop runs the normal code.  By placing the PAUSE 20000 in the Reset section we get this as the code routes back through Reset to clear the outputs.

I've edited the full listing above just to hammer the point all the way in.

You might also consider shielding the PIR; if it's outdoors it will be exposed to all kinds of IR light, especially during the day.  Scary Terry did a nice write-up here:

-- http://www.scary-terry.com/itw/pirsensor/pirsensor.htm
Jon McPhalen
EFX-TEK Hollywood Office

cmgjeep

ok i used the pause 2000 like i was sugested
powered on and off the porp 1 and it did not retrigger it's self
for a general understanding
i did this pause in the reset to allow the pir to configure it's self when power applyed on the initnal turn on?
so far it is working
much
thanks

JonnyMac

PIRs need a few seconds to "warm up" after they're powered on the delay in the Reset section allows for this.  That section also sets the output pins and clears them so we loop back to it at the end of the prop code to clear everything.  The delay after the prop run gives victims time to clear out.  You see, we're getting a 2-for-1 deal with the code at Reset.
Jon McPhalen
EFX-TEK Hollywood Office

cmgjeep

once agian
thank you J.Mac and the forum for all the help
ready to start another project

trust me, yall will hear from me agian ;D