November 23, 2024, 07:26:59 PM

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.


Help using prop 1 to activate a cylinder..

Started by vincecamerano, September 14, 2010, 04:22:17 PM

Previous topic - Next topic

vincecamerano

Hello,

We are doing a last minute prop for our halloween haunt and were wondering if we could get some help. We have a coffin with a cylinder mounted inside and would like to use the prop 1 to tell the cylinder to go up and down 5 to 8 times when activated. What would be the easiest way to do this? Would someone please help us write the code?

Thanks a lot!

JonnyMac

You will get better answers when you ask better questions!  ;D

Of course you'll get help here, but it will only be as good as you give.  For example, what you don't spell out in the post above is:

1) *What* activates the prop?
      -- active-high or active-low sensor?

2) What kind of timing is involved for "going up and down 5 to 8 times"?

3) Do you want a fixed number between 5 and 8, or should the controller randomly select a value in that range?

4) Should there be any post-play delay?

I know that I sometime seem persnickety, but I have to remind folks that -- as simple as it is -- the Prop-1 is still a computer and will only do exactly what you tell it; it follows our programs; sadly, it can't read our minds!  ;)
Jon McPhalen
EFX-TEK Hollywood Office

bsnut

Yes, I can help you with this. This is easy to do and I will do for you tonight. What I need from you is

1. Is the prop trigger with a PIR or something else? PIR need warm up time in order to work right.
2. Is there any lights, other than the cylinder?
3. Is the cylinder controlled by 3way solenoid valve or a 4way valve? 4way valves have two solenoids in them and requires two outputs

Now you can see how this above info is need.  

 
William Stefan
The Basic Stamp Nut

BigRez

Quote from: bsnut on September 14, 2010, 05:03:51 PM
3. Is the cylinder controlled by 3way solenoid valve or a 4way valve? 4way valves have two solenoids in them and requires two outputs

Not all 4-way valves have multiple solenoids.  In fact, I have several that only have one solenoid.  See image below...

bsnut

Thanks Bigrez, I know I was trying to cover the worse case. 
William Stefan
The Basic Stamp Nut

bsnut

September 14, 2010, 08:40:10 PM #5 Last Edit: September 14, 2010, 08:42:27 PM by bsnut
Here is your basic program that cycles your cylinder movements 8 times. If you provide some more info we can do more with this program.
' =========================================================================
'
'   File......coffin_prop.bs1
'   Purpose...Cylinder_Control for Coffin
'   Author....W. Stefan
'   E-mail....
'   Started...9/14/2010
'   Updated...
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Sio             = 7                     ' SETUP = out; no ULN
SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  Valve           = PIN5                  ' Out6


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

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

SYMBOL  Baud            = OT2400

SYMBOL  cylces          = 8

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

SYMBOL  timer           = B0
SYMBOL  counter         = B1




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

Reset:
 PINS = %00000000                              ' clear all outputs
 DIRS = %00111111                              ' make P0-P5 outputs


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

Main:
 timer = 0                                     ' reset timer
 Valve = IsOff                                 ' make sure that is off


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

Cylinder_Control:
 FOR counter = 0 TO cylces                     'Count valve cylces for cylinder
  Valve = IsOn
  PAUSE 1000
  Valve = IsOff
  PAUSE 1000
 NEXT
 GOTO Main


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


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


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


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


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


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


' -----[ User Data ]-------------------------------------------------------
William Stefan
The Basic Stamp Nut

vincecamerano

Hey Bsnut,

I just want one of the outputs to turn on and off a few times randomly. (Like the open and closing of a coffin.) We just want to turn the efx on and off for our trigger. Hopefully this is enough information.

Thanks,
Vince

JonnyMac

You'll never get truly random behavior if you use the power-on of the controller as your trigger.  Can you connect a N.O. button to the Prop-1?  If you can, the behavior will be random and work better.
Jon McPhalen
EFX-TEK Hollywood Office

vincecamerano

It doesn't have to be truly random. All it needs to do is go on and off 5-6 times within a 5 second time frame.

JonnyMac

QuoteIt doesn't have to be truly random.

Everyone says that... until they see a program doing the same thing over and over and over and over again.  I employed a little-used feature in the BS1, the ability to save a value between power (most are used to reading from EEPROM, we don't often write to it).  This program does so that one cycle is not exactly the same as the last.

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


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


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


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

SYMBOL  Lid             = PIN0                  ' OUT0/V+ to valve


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

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


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

SYMBOL  idx             = B2
SYMBOL  bumps           = B3

SYMBOL  delay           = W4

SYMBOL  lottery         = W5
SYMBOL   lottoLo        =  B10                  ' bytes inside lottery
SYMBOL   lottoHi        =  B11


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

Reset:
  PINS = %00000000                              ' clear all outputs
  DIRS = %00111111                              ' make P0-P5 outputs


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

Main:
  READ 0, lottoLo                               ' read lottery from EEPROM
  READ 1, lottoHi
  FOR idx = 1 TO 3                              ' big stir
    RANDOM lottery
  NEXT

  bumps = lottery // 4 + 4                      ' 4 to 7 bumps

Bump_It_Baby:
  Lid = IsOn
  RANDOM lottery
  delay = lottery // 151 + 100                  ' 0.1 to 0.25s bump
  PAUSE delay
  Lid = IsOff

  RANDOM lottery
  delay = lottery // 750 + 250                  ' 0.25 to 1.0s delay
  PAUSE delay

  bumps = bumps - 1                             ' update bump count
  IF bumps > 0 THEN Bump_It_Baby                ' not zero?, keep going

Done:
  PINS = %00000000                              ' all off
  WRITE 0, lottoLo                              ' write lottery to EEPROM
  WRITE 1, lottoHi

  END                                           ' low power mode


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


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

Seed:
  EEPROM (10, 31)                               ' initial seed

Jon McPhalen
EFX-TEK Hollywood Office

vincecamerano

I just want to make sure I have my EFX hooked up right cause i'm getting nothing. I have my solenoid in GND and V+ and my power hooked up. Are we missing something?

JonnyMac

Your solenoid should be connected between OUT0 and V+, and the power switch must be in position 2 (V+ LED lit) in order for it to operate.  You might want to review the Prop-1 docs:

http://www.efx-tek.com/downloads/prop-1_docs.pdf

There's a diagram on page 4 that shows a couple valves connected.
Jon McPhalen
EFX-TEK Hollywood Office

vincecamerano

Hey guys,

Just wanted to drop in and thank you for helping with this code! It works flawlessly and were so excited about it!!


Thanks again!