November 22, 2024, 03:07:50 PM

News:

Got VSA?  Want to use your Prop-SX?  Now you can!  See the VSA section of the Library forum for Prop-SX code that works with VSA.


Jumping Spider Code

Started by CoffinBound, September 26, 2008, 07:01:58 AM

Previous topic - Next topic

CoffinBound

Could you help me out with some code please John? I am working on a jumping spider prop.  Here is a rundown of the show.

The spider will be retracted from view. When triggered, the spider will move in, jump up and down with smoke spitting out, strobes and some screeching noise playing.  After a few seconds, it will retract.

In detail:

1. Move spider in (using a wiper motor)
2. Stop spider
(For a random amount of time, between 7 and 15 seconds, perform steps 3 through 6 all at once)
3. Turn on strobe lights
4. Initiate sound effect (using a cowlacious sound board)
5. initiate random up/down jumping motion (using a pneumatic cylinder)
6. Blow smoke
(At end of random time time cycle, turn off items 3 through 6)
7. Move spider out
8. Stop spider and pause for 30 seconds before it can be triggered again.
9. Wait for trigger (most likely will be triggered via relay)

Thanks in advance.

JonnyMac

Sure, I can help, but I need more details.  #1 & #2 deal with moving the spider "in."  How will the controller know that the spider is in fact in?  Same for #7 -- how will the controller know that the spider is out?  How are you controlling the smoke (relay?)?  Why don't you detail your connections for me and I'll build up the code.
Jon McPhalen
EFX-TEK Hollywood Office

CoffinBound

I was thinking that for In and Out of the spider, it could be a simple "on for 3 seconds" type of thing.  If 3 seconds was too long, I could fine tune it later. I was thinking the same for the Move Out scenario.  If you don't think that is a valid solution, I am up for suggestions. 

As for the smoke, yes, I was thinking of rewiring a relay in place of the normal toggle switch on my lite f/x fogger.

I'm not quite sure what you mean by "detail my connections", but I will take a stab at it.  As of right now, no wiring has been done, so connections can be however they need to be.

Let's say...
Out 0 - Wiper Motor (Saturn wiper motor, move spider in and out)
Out 1 - Strobe Lights (120VAC, controlled via relay)
Out 2 - Sound Trigger (Cowlacious ISD sound player board, I believe this is a dry contact)
Out 3 - Fog Machine (controlled via relay)
Out 4 - Solenoid Valve (most likely controlled via relay because of voltage requirement differences (24VDC))
Out 7 - Trigger (via relay contact closure, a wireless key fob device)

Does this help any?

JonnyMac

It still doesn't answer how to move the spider in versus out -- do you have any details on your wiper motor?  Send me docs or a link.
Jon McPhalen
EFX-TEK Hollywood Office

livinlowe

Scarry Terry did a breakdown on these motors.

http://www.scary-terry.com/wipmtr/wipmtr2.htm

Hope this helps
Shawn
Scaring someone with a prop you built -- priceless!

JonnyMac

That just illustrates the problem: you can use a wiper motor as a reciprocating control device but without position sensors for the "in" and "out" positions one cannot use it as an absolute position device.
Jon McPhalen
EFX-TEK Hollywood Office

CoffinBound

I see your point.  I was thinking that I could time how long it took to go a half revolution and adjust the code accordingly.  I plan to have it connected just like a piston would be in an engine. Or like this... http://www.flying-pig.co.uk/mechanisms/pages/reciprocate.html

I know that it would be hard to get it to stop in an exact position, but I'm not sure how else I can do it.

CoffinBound

Just re-read your last comment Jon.  I think that I will swap out the motor for another pneumatic cylinder.  In the end, it sounds like it will be easier to control.  I was just trying to get away from the additional expense of another valve/cylinder/relay combination since I had the motor already.

menehune

You could use either mechanical limit switches or IR leds as beam breaks to tell the controller if the prop is in one position or another.

JonnyMac

September 26, 2008, 07:34:43 PM #9 Last Edit: October 11, 2008, 11:00:45 PM by JonnyMac
Here's something to get you started.  I've adjusted the IOs to make sense in my head for connections.  Hopefully I interpreted what you're looking for, at least closely enough that you can make adjustments as needed.

' =========================================================================
'
'   File...... Jumping_Spider.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'              Copyright (c) 2008 EFX-TEK
'              Some Rights Reserved
'              -- see http://creativecommons.org/licenses/by/3.0/
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated... 26 SEP 2008
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Audio           = PIN7                  ' SETUP = DN
SYMBOL  Trigger         = PIN6                  ' SETUP = DN

SYMBOL  Fogger          = PIN3
SYMBOL  Strobe          = PIN2
SYMBOL  Lifter          = PIN1
SYMBOL  Spider          = PIN0


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

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

SYMBOL  IsOut           = 0
SYMBOL  IsIn            = 1

SYMBOL  IsUp            = 1
SYMBOL  IsDown          = 0


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

SYMBOL  delay           = W3
SYMBOL  timer           = W4
SYMBOL  lottery         = W5


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

Reset:
  PINS = %00000000                              ' clear everything
  DIRS = %10001111                              ' set outputs

  PAUSE 30000                                   ' inter-show delay


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

Main:
  timer = 0                                     ' reset timer

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

  Spider = IsIn
  PAUSE 500

  timer = lottery // 8001 + 7000                ' 8 to 15 secs (random)

  Audio = IsOn
  PAUSE 25
  Audio = IsOff

  Strobe = IsOn
  Fogger = IsOn

Jump_Baby_Jump:
  Lifter = 1 - Lifter                           ' toggle lifter
  RANDOM lottery                                ' re-stir
  delay = lottery // 251 + 250                  ' 0.25 to 0.50 (random)
  PAUSE delay
  IF timer < delay THEN Drop_Lifter             ' done?
    timer = timer - delay                       ' no, timer delay
    GOTO Jump_Baby_Jump                         '  and go again

Drop_Lifter:
  Lifter = IsDown
  PAUSE 500
  GOTO Reset


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


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


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

CoffinBound

Jon,
I never said Thanks for the code you supplied, so let me say that first.

I just downloaded the code to my prop1 and gave it a test run with the prop trainer board installed.  After a couple hours tinkering with the code, I have a couple questions.

1. The whole show appears to finish rather quickly, like within 2 seconds after the Trig button is pushed.  Is this how fast it is supposed to be?
2. In the Jump_Baby_Jump section, I can't see if the Lifter pin is actually cycling on/off by the LED.  Is this because it isn't, or is it just cycling so fast that the LED appears to stay lit?
3. If I adjust the 251 +250 numbers in the jump section to 5001 + 5000, would that increase the "hold time" for the spiders vertical position, or does it just lengthen the amount of time that the spider has to jump?

Thanks for any help you can offer,
CoffinBound

JonnyMac

1. I found a typo -- the corrected line is marked red in the code above.
2. No, the type was causing only one jump; that's fixed
3. That adjusts the "on" time for the jump; the jumping duration is set in "timer."
Jon McPhalen
EFX-TEK Hollywood Office

CoffinBound

Thanks Jon.  I will have to give the change a try tomorrow.  Thanks for looking at that again.

Kevin