November 21, 2024, 11:23:41 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.


Programing Understaning THANKS FOR THE HELP?

Started by michilson, November 03, 2008, 10:37:10 AM

Previous topic - Next topic

michilson

November 03, 2008, 10:37:10 AM Last Edit: November 03, 2008, 10:43:59 AM by michilson
Here's a little demo program i put together (please note I do not own a controller and this sample was created inside visual Basic for the use of knowledge and question asking and understanding of how the coding works with the controllers

'====================================
'
'File.....DOOR_SHAKER_POP-OUT.BS1
'Purpose.....Shake Tomb doors then Open and move popper out
'Author.....MICHAEL CHILSON



'------I/0 TIGGER-----

SYMBOL PIR = PIN7  'SETUP =UP Motion Sensor
SYMBOL SW = PIN6  'SETUP =DN Push Button (local Trigger)

'-----CONSTRANTS-----
V1 = PIN0       'Valve 1 (Door Cylinder)
V2 = PIN1       'Valve 2 (Prop Cylinder)


L1 = PIN3       'Light Circuit 1 Mood Light (On Prir To Event)
L2 = PIN4       'Light Circuit 2 STROBE (Activation on Event)
L3 = PIN5       'Light Circuit 3 Red Light (Activation After Event)


SYMBOL ISON = 1
SYMBOL ISOFF = 0

'----CODE-----
MAIN:

If PIR = ISOFF Then MAIN
If SW = ISOFF Then MAIN
Low L1              'Turn Off Mood Light
PAUSE 3000          '3 Sec Pre-Delay
HIGH L3             'Turn On Red Light
HIGH V1             '{RAPID FIRE DOORS CODING}
PAUSE 2000          '{RAPID FIRE DOORS CODING}
Low V1              '{RAPID FIRE DOORS CODING}
PAUSE 2000          '{RAPID FIRE DOORS CODING}
HIGH V1             '{RAPID FIRE DOORS CODING}
PAUSE 1500          '{RAPID FIRE DOORS CODING}
Low V1              '{RAPID FIRE DOORS CODING}
PAUSE 1500          '{RAPID FIRE DOORS CODING}
HIGH V1             '{RAPID FIRE DOORS CODING}
PAUSE 10000         '10 Sec Delay
HIGH L2             'Turn On Strobe
HIGH V2             'Extend Prop
PAUSE 20000         '20 Sec Delay
Low V2              'Retract Prop
Low L2              'Turn Off Strobe
PAUSE 20000         '20 Sec Delay
Low V1              'Close Doors
Low L3              'Turn Off Red Light
HIGH L1             'Turn Mood Light on for Next group

GoTo MAIN

Guys,
My biggest questions here are did I address the pins correctly and as you review this please keep in mind I do know some VBA coding but my knowledge and understanding is still on the Newbie Level (Basic understanding on how it works)

Here's what I was trying for and I'll try to explain this so that it's easy to understand.

The scene is a graveyard and I want a blue light to be lit on the large tomb. When they Trigger the Controller I have 2 Cylinders under the lid which is split in half. There's a Red light in the Tomb and a lot of fog (fog was tripped by previous event)

I want the Lid to open and close rapidly as if what's inside is trying to get out. And the red light to be on. As the event (IE my code) runs I want the lid's to fully open and a skeleton to sit up from with in the tomb. As the skeleton is appearing out of the fog a strobe turns on also.

Future add-ons to this might be the addition of a audio Track via a mp3 player

Once all the events have happened the skeleton needs to lay down the strobe turn off.
The lid Close and the red light turn off
And the Blue light be turned back on for the next group.

Please review for me to make sure I have a decent grasp on how to write the programming. (Basics of turning things on and off)

Advanced tips can be referred to in later questions once I have a unit in hand to actually test run with.

THANKS GUYS

JonnyMac

Don't use VB to write PBASIC programs -- it doesn't work.  Download the FREE Basic Stamp Editor (links at Parallax and on our site) and use that.  While you're installing the BSE I will re-write your program to show you how you'll ultimate do those things.  Once you get BSE installed crack open the help file and read the section called "The Elements of PBASIC Style."  Just as there are accepted styles used by pros in VB, pros use "The Elements of PBASIC Style" when writing BASIC Stamp (Prop-1 and Prop-2) programs.
Jon McPhalen
EFX-TEK Hollywood Office

michilson

I plan on downloading the program tonight and looking threw it. I was using a LED chase Program from one of the documentations as a guide to write what i had

I dont plan to write anything more than maybe a Test program in VB. UNless Basic Stamp Editor has a way to run the programs into a Visual Interface without connecting it to a controller. I want a interface to display the outputs and inputs and to show me a status of each with a button that can act as the trigger.
So i can make adjustments to the program without conecting everything up!

Mainly i was just looking to see if i had things labeled correctly and if not, the correct way to label things!

Thanks for the help.

JonnyMac

November 03, 2008, 12:02:55 PM #3 Last Edit: November 03, 2008, 12:05:00 PM by JonnyMac
No, the BSE does not have a simulator in it but it will compile your code and show you the plethora of syntax errors you've introduced -- something you cannot doe with VB.  You wouldn't drive a VW in the Indy 500, right?  Don't use VB to write PBASIC code; it's pointless.

Here's how you'd have written that program after getting used to PBASIC coding, style, and actual prop control.  Note that by following the style guidelines found in the help file that the program is virtually self-commenting.  Note, too, that good program design for prop control suggests that trigger inputs should be debounced to prevent false triggers.

' =========================================================================
'
'   File......
'   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... 03 NOV 2008
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  Sio             = 7                     ' SETUP = out; no ULN
SYMBOL  PIR             = PIN6                  ' SETUP = DN
SYMBOL  Trigger         = PIN5                  ' local trigger
SYMBOL  RedLight        = PIN4
SYMBOL  Strobe          = PIN3
SYMBOL  MoodLight       = PIN2
SYMBOL  Extender        = PIN1
SYMBOL  Doors           = PIN0


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

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

SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  Baud            = OT2400                ' B/R jumper removed


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

SYMBOL  timer2          = B2                    ' local trigger debounce

SYMBOL  delay           = W3                    ' valve delay timing
SYMBOL  timer1          = W4                    ' pir debounce / timing
SYMBOL  lottery         = W5                    ' random #


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

Reset:
  PINS = %00000000                              ' clear everything
  DIRS = %00011111                              ' configure output pins

  MoodLight = IsOn
  PAUSE 20000                                   ' re-trigger delay


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

Main:
  timer1 = 0                                    ' reset timers
  timer2 = 0

Check_Trigger:
  RANDOM lottery                                ' stir random #
  PAUSE 5                                       ' loop pad
  timer1 = timer1 + 5 * PIR                     ' update pir timer
  IF timer1 = 100 THEN Run_Show                 ' run on 0.1 sec input
  timer2 = timer2 + 5 * Trigger
  IF timer2 = 100 THEN Run_Show
    GOTO Main

Run_Show:
  MoodLight = IsOff
  PAUSE 3000
  RedLight = IsOn

  timer1 = 0                                    ' reset timer

Rattle_Doors:
  Doors = 1 - Doors                             ' toggle status
  RANDOM lottery
  delay = lottery // 251 + 250                  ' 0.25 to 0.50 secs
  PAUSE delay
  timer1 = timer1 + delay                       ' update timer
  IF timer1 < 7000 THEN Rattle_Doors            ' 7 seconds?
    Doors = IsOn                                ' leave open

  PAUSE 10000
  Strobe = IsOn
  Extender = IsOn
  PAUSE 20000
  Extender = IsOff
  Strobe = IsOff
  PAUSE 20000
  Doors = IsOff
  RedLight = IsOff

  GOTO Reset                                    ' clear and delay


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


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


Jon McPhalen
EFX-TEK Hollywood Office

michilson

Can use some help here guys!!!

Reading over the help file and there kinda loosing me in the Bits and Bytes!!

Would someone be free to kinda help explain it down alittle more and give me a little more indepth walk threw of the basics On like a AOL chat or yahoo chat some night either this week or over the weekend!

Thanks guys For helping the newbie!

JonnyMac

November 03, 2008, 09:17:35 PM #5 Last Edit: November 03, 2008, 09:21:35 PM by JonnyMac
Start simple; we have a presentation on our Prop-1 page that goes into the most common keywords used in prop control -- that will get you going. 

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

If you want to be an embedded programmer you're going to have to get comfortable getting into the bits and the bytes; embedded programming is somewhat down and dirty (compared to fancy languages like VB), but a heck of a lot of fun once you get past the initial start-up curve.

And relax, Rome wasn't built in a day and you won't become a good Prop-1/2 programmer in a day, either.  But if you'll spend a little time everyday you will be really good by Christmas.
Jon McPhalen
EFX-TEK Hollywood Office

michilson

Here's a Final Question then I'll Actually purchase a Control to Play with and Learn this programing.

What is the Recomended Controlers that i need?

1st. I need 4 Controlers To Only Open a Air Valves for Air Canons ( Needs to have a Pre Delay, Hold the Valve Open for so long then, have a Retrigger Delay)

I think a Prop 1 Would be suited for this.

2nd prop is a Drop Panel
Needs to Open and close a Valve and Switch 2 Lights on and off (Use relays for this)
Prop 1?

3rd is a Door Again need to open and close a Valve Only
Prop 1?

4th is another set of doors Open and Close valve and turn on and off 3 Lights
Prop 1?

5th Was the Tomb Setup 2-3 Valves and 3 Lights
Prop 1?

6th and prehaps the most complicated is the Electric Chair.
5-6 Lights a Audio File, A Fog Machine, A Transducer, And if the ability is there Light Control VIA DMX
I believe this would be the Prop-sx. Audio will come from a looping MP3 Player

JonnyMac

I agree with your assessment of controller needs, though I would suggest dumping the DMX connection (it really complicates things) on your electric chair in favor of direct control of the lights with an RC-4 or FC-4.

Let me suggest that you purchase a Prop-1 Starter Kit and just get used to the idea of programming small micros.  The kit comes with everything you need except a Windows PC, and we're here to coach you.
Jon McPhalen
EFX-TEK Hollywood Office

michilson

That was the Plan i need a USB connection Over ther Serial tho (For eas of programing with laptop on location.

That could cause a issue with the lighting i want to do with the electric chair scene i think.

And the Guest get close to this I want the Light Above the Guy getting electricuted to Brighten and Dim to simulate the Surges of Elect threw his body.

I also want to blink and flicker 3 other lights that run on 12 v (2 Red lights and a Blue EL Wire from streetglow) to simulate Elec sparking across the Elec Terminators. If I can do that with 120 that will be Fine i'll use 2 wall wort Transformers to step it down to 12 v I think that will work!

The Relay for the fog Machine and the Relay to the Transducer i dont think will be a issue. Along with the MP3 Player would also be ran from a basic relay.

Would be nice to have a Add on Card that you can call up the Audio File from a SD Card to Play, Loop, or Pull Random sounds from a Playlist.
on a Trigger from a PIR with the output being a 1/8 Phone jack to supply any set of powered PC Speakers

JonnyMac

Add these items to your order:
  -- http://www.efx-tek.com/topics/usb-serial.html
  -- http://www.efx-tek.com/topics/usb_cable.html

The FC-4 will connect directly to a Prop-1, Prop-2, or Prop-SX and is cable of dimming control.

If your EL wire inverters will run at 12v and less than 200mA you can power them directly from the OUTx terminals.  If they won't tolerate 12v then you could use a zener circuit; I recently did this for a customer that wanted to power a laser pointer from a Prop-1.

We don't presently have an SD-based audio solution but have worked with vendors that do (e.g., Rogue uMP3 player).
Jon McPhalen
EFX-TEK Hollywood Office

michilson

Okay thanks.

Im sure i'll need help with the codes for that.

I have a few more questions on the controllers for you.

I'm going to be installing these in Controllers in enclosed boxes. I have a few questions about this.

I would like to add a interrupt switch into the PIR wiring that will take it out of the circuit so it will only trigger the controller when it's in the on position.

I want to have LED lights installed into the Box to show status of the trigger, Power,  Program EVENT (Basic flashing the led to show me the program is running) and a LED for each the outputs and a Push button to trigger event locally, And a Flashing LED when in Standby (Waiting to be Triggered)
So that walking up to the control I can see exactly what it's doing and up to (incase something isn't working I know what the issue is with looking at the box)

These need to be setup in a Plug and Play Fashion so I can quickly hook them up and take them down.  I want to make the control for addition add-on boards (Serial Connection) Threw a Phone Plug (4 Conductor) I also want to use this same connection for the PIR's Giving me a plug and play application that any add-on bard can plug into any Prop-1 / 2 controller!

Do for see any problems with any of these thoughts? Most Add-on Boards will be Next to the controllers. The PIR's will be at most 20' away. So I don't think I will see a large voltage drop.

I will be wiring all the Relays that will control Lights to a Power cord male plug to feed the setup and Multiple Female Plugs to do to the different lights.

I will need another Plug application for the Valves.

Do you see anything that may cause me Problems with this setup?

JonnyMac

QuoteDo you see anything that may cause me Problems with this setup?

Only your lack of experience with our products.  Again, I'm going to suggest that you buy a starter kit and start working with it.  You're going to find that writing a spec as you have is usually easy, implementing it exactly as you hope sometimes isn't -- all of us involved in product development face these challenges and you will with your desired P&P configuration.
Jon McPhalen
EFX-TEK Hollywood Office

BigRez

michilson -

Yes, you can do all that you are saying.  I too wanted to do something similar whereby I could quickly remove the "guts" of my prop at night and then put it back in place.  To do this, everything (PIR, 120vac connections, valve, power, etc) had to have connections which allowed this. In my case even the air to the valve was quick connect and mounted with the controller.

I didn't have status LEDs but I only had a few hours over a couple of weeks to learn and build everything. I can see how it would be easy to add them.  Jon is absolutely correct; the prop-1 kit was helpful to get things going quickly.

michilson

Thanks guys appreciate the patience with me.

This is incredibly help full. I'm glad to see that your helping me even though I have not purchased anything as of yet.

And being that im new to this and don't understand sometimes what all im reading on the Spec's and not knowing what these controllers can do and how they work has been defiantly helpful.

I do plan to order one soon and start learning how to write the code and how to wire it up for my P&P application. I'll try to post pictures of the Final Installed Setup's once im happy with it. And I'll post Video's Hopefully on Youtube of the controler being triggered how it all works. And if anyone else wants to build something like this i'll share the Build Specs.

I'm sure I'll be Asking lots of questions when this gets into full gear about how to correctly wire things up, and how to make the controller respond to what I want or need to do.

So far im vary impressed with your company's Tech Support and if anyone that I know is looking for a controller I will be referring them to you.