November 22, 2024, 04:06:23 AM

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.


Electric Chair

Started by HomeHaunter1, September 15, 2013, 05:30:59 PM

Previous topic - Next topic

HomeHaunter1

I am in need of a program to control my Electric Chair. I have built an Electric Chair that I will have trick or treaters sit in before I give them candy.

I have attached a picture to try and make it easier for you. Once someone sits in the chair it will trigger the pressure mat on out 7. Upon being triggered I would like to wait for 1/2 second and trigger the solenoid on out 5, followed quickly by the flash cracker on out 4. 1/2 second later I would like to activate Out 3, and Out 2 for 7 seconds. After that I would need to trigger out one to return the solenoid.

I have never done any programming so I really appreciate your skills and willingness to help me. I hope I have included enough information.
Thanks a lot. Damon.

JackMan

Damon,
   Welcome to the forums. First off, DO NOT connect power to the Prop1 the way you have it wired. The step mat connections need to be an INPUT. You have the step mat connected to OUT7, OUT0 thru OUT7 are OUTPUTS ONLY. The way you have it connected would cause a direct short if OUT7 was active. I'll try to write you a program tonight unless someone else does before I get to it.

JackMan

September 15, 2013, 07:05:22 PM #2 Last Edit: September 18, 2013, 07:25:46 PM by JackMan
Here's a pretty simple program based on the info you provided. Make sure any connections you make to the Prop1 are the same voltage as the power supply connected to the Prop1 (usually 12vdc). If any of your devices are a different voltage you'll need relays or some other means of isolation.




'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  StepMat         = PIN6            ' Step mat connected to P6.W and P6.R   SETUP jumper = DN
SYMBOL  CylinderOut     = PIN5            ' V+ and OUT5 to "out" solenoid
SYMBOL  FlashCracker    = PIN4            ' V+ and OUT4 to FlashCracker
SYMBOL  Strobe          = PIN3            ' V+ and OUT to Strobe (needs relay if 120v)
SYMBOL  OUT2            = PIN2            ' not sure what you have connected here?
SYMBOL  CylinderIn      = PIN1            ' V+ and OUT5 to "in" solenoid

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

SYMBOL  IsOn                   = 1                   ' for active-high in/out
SYMBOL  IsOff                  = 0
SYMBOL  FlashCracker_MIN       = 75                  ' min delay
SYMBOL  FlashCracker_MAX       = 250                 ' max delay


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

SYMBOL  delay           = W3                    ' allow long delays (>255)
SYMBOL  timer           = W4                    ' for event time
SYMBOL  lottery         = W5                    ' random #

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

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

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

Main:
  timer = 0                                     ' reset debounce timer

Check_Trigger:
  PAUSE 5                                       ' scan delay
  IF StepMat = IsOff THEN Main                  ' check trigger input
    timer = timer + 5                           ' update timer
  IF timer < 200 THEN Check_Trigger             ' wait for .02 second trigger

  timer = 0                                     ' reset timer
  PAUSE 500
  CylinderOut = IsOn                            ' extend cylinder
  FlashCracker = IsOn                           ' Flash Cracker is on
  PAUSE 500                                     ' pause 1/2 second
  Strobe = IsOn                                 ' Strobe is on
  OUT2 = IsOn                                   ' not sure what OUT2 is?

Flash_Cracker:
  RANDOM lottery
  delay = FlashCracker_MAX - FlashCracker_MIN + 1
  delay = lottery // delay + FlashCracker_MIN
  TOGGLE FlashCracker
  PAUSE delay
  timer = timer + delay
  IF timer < 7000 THEN Flash_Cracker             ' randomize flashcracker for 7 seconds

  CylinderOut = IsOff
  FlashCracker = IsOff
  Strobe = IsOff
  OUT2 = IsOff
  CylinderIn = IsOn                             ' retract cylinder
  PAUSE 1000
  CylinderIn = IsOff
  GOTO Main

JonnyMac

September 15, 2013, 07:07:09 PM #3 Last Edit: September 15, 2013, 07:09:12 PM by JonnyMac
Many of us are happy to help with programming, but as Jerry Maguire said in the movie.... "Help me help you."

To Jack's point (above), the green terminal blocks are outputs. To connect a mat switch to the controller you need to use one of our WRB (white-red-black) extender wires (you can also hack a servo extender that can be procured in a local hobby shop). Cut off one end and connect the mat switch between the white and red wires. Move the P7 SETUP jumper to the DN position. Make sure you plug the connector end into the P7 header

What does the solenoid on OUT5 do? Is it simply on or should it be randomized? How long does OUT4 need to be on? And what is the behavior of OUTs 2 and 3?

The hardest part of programming is accurately describing the behavior desired to another person. I'm sure you have a very clear picture in your head -- now you have to get that picture into the minds of those that could/would help you! Do not take any piece of information for granted; it's all important.

I've attached a graphic to show you how to connect a mat switch to P7.
Jon McPhalen
EFX-TEK Hollywood Office

HomeHaunter1

I very much appreciate the help. I don't know the full capability of the prop 1 yet.
Lets see if I can give a little more info.
When starting this project I imagined and attempted to build a large switch that would be controlled by a pneumatic cylinder. I have had a hard time figuring out how to attach the cylinder to the switch. I have since given up and my father in law has claimed he would help. He is brilliant, but very busy. So in the program I would like an option of controlling the cylinder via a 12 volt solenoid. I imagine that upon someone sitting down the solenoid would activate the cylinder and look as if the switch being thrown is controlling the power to the chair.(I am unsure how to connect a 5 port 4 way solenoid to the controller though.) Upon the switch being thrown, I would also like it to look like its broken and acting weird with the sound and flashing from the flash cracker. So randomizing the flash cracker would be nice. 

Out 1 is hooked up to my 12 volt relay. My relay is controlling a 120 volt power strip. I have three motors and a sound system plugged in to the power strip. So upon being triggered it should power on the sound and vibration.
Out 2 currently does not have a use.

HomeHaunter1

Out 3 will provide power to the strobe lights which are built to strobe randomly by themselves. So all that needs to happen is power needs to be provided to them while the chair is running,

JackMan

Couple of questions:
Is your 5 port 4 way valve a single or double solenoid?
Is your strobe light 12vdc or 120vac?

HomeHaunter1

My solenoid is double acting, and the strobe lights are 12 volts.

HomeHaunter1

I have disconnected the mat switch from out 7 and I am now trying to figure out how to attach it to pin 7. I see that I need a connector, that's easy enough. I am stumped on what you mean when you say "Move the P7 SETUP jumper to the DN position. Make sure you plug the connector end into the P7 header". Also does my mat switch need/get power this way? Sorry for so many questions but I dont know of anyone locally who has the time to show me how to do this in person. Thanks.

bsnut

Quote from: HomeHaunter1 on September 18, 2013, 08:51:01 AM
I have disconnected the mat switch from out 7 and I am now trying to figure out how to attach it to pin 7. I see that I need a connector, that's easy enough. I am stumped on what you mean when you say "Move the P7 SETUP jumper to the DN position. Make sure you plug the connector end into the P7 header". Also does my mat switch need/get power this way? Sorry for so many questions but I dont know of anyone locally who has the time to show me how to do this in person. Thanks.
The setup jumper is right next to Pin 7 on the servo header where your mat switch was plugged in at and   your mat switch gets its power from this header on the center row of pins, which provides 5 VDC to your mat switch.
William Stefan
The Basic Stamp Nut

JackMan

Actually, a mat swich doesn't need power to operate, it's simply an open set of contacts, much the same as a simple button switch. The program I wrote for you has P6 as the Step Mat connection, so use P6 or change the program code to P7. If your valve is dual solenoid then it will have 2 sets of wires, one set will activate the valve for air pressure to extend your cylinder and the other set of wires will activate the valve to retract the cylinder. You'll have to follow the diagram on the valve as to which ports (air lines) go where.

JonnyMac

QuoteI am stumped on what you mean when you say "Move the P7 SETUP jumper to the DN position. Make sure you plug the connector end into the P7 header".

If you look on the board you will set two columns of 3-pin male headers. Above the left-most column you'll see the word SETUP and right below it UP DN. The jumper may already be in the down position (see the image I posted above). The mat switch will connect to the top-most pins on the right-side group. In fact, next to the correct pins you'll see P7 on the board.

The easiest way to connect anything to those headers is to use take one of our three-pin extenders and cut it in half. This gives you two connection ends to use with TTL devices. For the mat switch you'll use the red and white wires.

If you want to make your own connections the Molex part #s are in the Prop-1 documentation.
Jon McPhalen
EFX-TEK Hollywood Office

JackMan

HomeHaunter1,
      I revised the previous program to randomize the Flash Cracker per your request. Let us know how things work out for you.

HomeHaunter1

My Electric Chair is working wonderfully. I haven't actually installed the flash cracker or the solenoids. So I am just using the strobe, relay, and mat switch, but I am so pleased with it so far. My wife, who is always a skeptic of my work until completion, was amazed. And the best part was that after seeing the program run my chair I was able to go in and adjust it. I extended the run time to 12 seconds, and the pause to 10 seconds.

Thank you so much. Of the entire build process programming the prop controller was the part I was most concerned with, and you guys made that easy. Even though you still speak a foreign language to me I feel like I am catching on. Thanks again. I will send you video of my chair in action after Halloween.

JackMan

Glad to hear that things are working for you, and glad that you've impressed your wife, (maybe she'll be a little less skeptical on the next project!)  ;)