November 24, 2024, 04:42:02 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.


Monster in the Fridge

Started by nkchristensen, September 15, 2012, 06:14:00 PM

Previous topic - Next topic

nkchristensen

I have a Monster in a fridge that is currently on a EZ-8 controller but I would like to put it on one of my several Prop1's that I have never figured out how to use so I can put the EZ8 on another project. I have never programed a Prop 1.
MIF is built with a washing machine motor & Transmission. I don't know if you can get the current program out of the EZ8 and download it into the Prop1 or how to do that. If not, this is how it works. The MIF is triggered by a motion sensor. on delay is 3 seconds, Run time is 8-10 seconds, and delay before it can start again is 1.5 minuets. The Run program has about 9 stops and starts in the 8-10 second run time so you don't get the repetitive washing machine agitator sounding banging. It is pretty basic one PIR dry contact input and one output going off and on, to an interposing 12vdc coil contractor, to run the 120V motor.

JonnyMac

While you could download the EZ-8 program to your PC using Vixen and then create a program from that, it would be boring. Sequencers (like the EZ-8) are boring. No getting around it; no matter how "random" we bang the button input, the fact is that the program is EXACTLY the same very time.

The cool news is that this would be a very easy program for the Prop-1 and you could add actual randomness to make it far more interesting (this is why we like programmable controllers so much).

Two important notes:
1. The PAUSE statements in the reset section mean you'll have to wait 1.5 minutes after programming to test
    -- "comment out" (using an apostrophe) these lines during testing; do not use PIR when testing (use N.O. button)
    -- if you have a trainer board you can plug it in to provide the button input for testing
2. The timing is a guess on my part; it will need to be fine-tuned for the actual prop
    -- this is why having a button to test and no delay between runs is important.

' =========================================================================
'
'   File...... Monster_In_Fridge.BS1
'   Purpose...
'   Author.... JonnyMac
'   E-mail....
'   Started...
'   Updated... 15 SEP 2012
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  Relay           = 0                     ' use V+/OUT0 to relay


' -----[ 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  delay           = W3
SYMBOL  lottery         = W4                    ' random #
SYMBOL  timer           = W5                    ' for debounce/timing


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

Reset:
  PINS = %00000000                              ' all off
  DIRS = %00000001                              ' set P0 to output

  PAUSE 60000                                   ' 1.5m delay
  PAUSE 30000


' -----[ 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

  RANDOM lottery
  delay = lottery // 2000 + 2000                ' delay 2 to 4s
  PAUSE delay

  RANDOM lottery
  timer = lottery // 5000 + 5000                ' run 5 to 10s

Slam_Door:
  TOGGLE Relay                                  ' flip relay state
  RANDOM lottery                                ' re-stir
  delay = lottery // 750 + 250                  ' delay 0.25 to 1.00s
  PAUSE delay
  IF timer < delay THEN Reset                   ' if done, back to top
    timer = timer - delay                       ' not done, update timer
    GOTO Slam_Door


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


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


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

Jon McPhalen
EFX-TEK Hollywood Office

nkchristensen

Thanks Jon, Its taken me a while to get the prop 1 installed where the EZ8 was, your program works great!
Another question if anyone knows - I have another prop in the same room, Does the prop 1 have the capability of a seperate trigger to start and run an additional unused outputs from this controller or would it be a matter of timing with the additional programing to the output?

bsnut

October 13, 2012, 09:18:58 PM #3 Last Edit: October 14, 2012, 03:07:23 AM by bsnut
QuoteAnother question if anyone knows - I have another prop in the same room, Does the prop 1 have the capability of a seperate trigger to start and run an additional unused outputs from this controller or would it be a matter of timing with the additional programing to the output?
To answer your question the Prop-1 (Basic Stamp 1) is a single threaded mircocontroller and it can't do multi-tasking like the Propeller chip (the brians in the HC-8+). The Basic Stamp 1 processor can only do one thing at one time and unlike the Propeller chip has 8 processors (known as Cogs) is able to do 8 different thing at one time.

   
William Stefan
The Basic Stamp Nut

JackMan

 
QuoteI have another prop in the same room, Does the prop 1 have the capability of a seperate trigger to start and run an additional unused outputs from this controller or would it be a matter of timing with the additional programing to the output

To expand a bit on Bill's reply, if you don't want the 2 props to operate at the same time then it's doable.