November 21, 2024, 09:42:24 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.


Controlling a TCT

Started by jcarpenter2, April 15, 2007, 05:16:34 PM

Previous topic - Next topic

jcarpenter2

Hello all, i have owned a prop-1 for a couple of years but have never played with it until now. I am building a TCT but am not one to do it the simple way. I have all of the mechanical side of the prop done and most of the pneumatics (waiting on my 18" stroke to come in from ebay). Now comes the electrical/controller side.

My intent:
Prop-1 will be activated by PIR.
Prop-1 will turn on eyes of mask.
Prop-1 will turn on AP-8 with a mix of sound bytes.
Prop-1 will control RC-4 that gives power to 4 seperate outlets. These outlets will control Pneumatic Solenoid(s), Stobe light, amplifier for speakers.

My issues:
How to hook it all together
Programing the Prop-1
Still need to purchase the PIR and AP-8

I have tested the Prop-1 and it said "hello world" back to me, so it works:)
I've completed all the electrical connections with the RC-4 and 4 Cyrdom SSR's based off of a picture in a PDF file by EFX "Prop-1 Programming Basics".
Now i just don't know what else get hooks to what and where.
I think i literally need someone to tell me "connect P0 to SER with a hobby servo connector to control all of the SSR's", "Connect the PIR to P1 using a hobby servo", etc. All of the documentation i have read gives me to many options for to many circumstances - confusing, at least to me.

Any help would be greatly appreciated. Thanks

Jim



JonnyMac

Here is a list of things to do to get connect, then you can code away.

1. Replace the ULN2803 in your Prop-1 with a ULN2003 -- you need to do this so the Prop-1 can "talk" to the RC-4 and AP-8.
    -- see the Prop-1 Trainer docs for details
2. Remove the P7 SETUP jumper.
3. Remove the RC-4's baud and address jumpers.
4. Connect P7 to the RC-4 serial input with a servo extender cable (W = white, R= red, B = black -- mind the markings).
5. Remove the AP-8's baud and address jumpers.
6. Connect the second RC-4 serial header to the AP-8 serial input; again, mind the markings.
7. Move the P6 SETUP jumper to DN.
8. Connect P6 to the PIR using a servo extender cable.

When the PIR is active you can see this because P6 will go high (reading PIN6 will return a value of 1)

You can use SEROUT to send messages to the AP-8 and RC-4; both are set at address 0 (okay since they're different devices).  To start sound 0 on the AP-8, for example, you would use this line of code:

  SEROUT Sio, OT2400, ("!AP8", %00, "P", 0")

Note that Sio would have previously been defined as 7 using the SYMBOL directive.
Jon McPhalen
EFX-TEK Hollywood Office

jcarpenter2

Jon,
Super, and thanks for the quick response. Have you all gotten the AP-8's ready for shipment? I was going to make my purchase but they are out of stock.


JonnyMac

We think they'll be available to ship by the end of the week; I'll post an announcement here when they're ready.
Jon McPhalen
EFX-TEK Hollywood Office

jcarpenter2

I must admit i am moving a tad bit slow on this project, however, it is coming along and about ready for coding. I am curious though, I am using a PIR but is it possible to use a second trigger with the prop-1? I would like to have the option to turn the PIR off and use a remote control. Would it be as simple as adding a toggle switch to the PIR line so that would never send a signal to the prop-1When turned off? Then adding a line in the code to recognize a second trigger device on a seperate pin? Kind of like

Main:
      IF PIR = IsOff then SECTRGR         'Wait for PIR Trigger
      IF SECTRGR = IsOff then Main        'Wait for Secondary Trigger

What kind of remote would be best if it is possible?
Thanks for your time.

JonnyMac

Remember the the PIR simply provides a high input to the Prop-1 when active; you could, then, use a toggle switch to select between your PIR and something else, perhaps a mat switch or remote output that is electrically compatible.  The thing is that it's all external and you don't need to modify the code -- the Prop-1 really doesn't care where the signal comes from, just that it's there.  In my generic programs I tend to use the term Trigger instead of PIR; the result is the same.
Jon McPhalen
EFX-TEK Hollywood Office

jcarpenter2

Does parallax sell a "remote output that is electrically compatible"? I did see they had rf transmitters and receivers that worked with the basic stamp, however, where would they hook up to on the prop-1 (if they are the solution)? Or is there something easier and cheaper out there?

JonnyMac

They used to, in fact I've used one of them with a Prop-1; you press a button on a key-chain remote and a corresponding output on the receiver goes high (same output as the PIR).  These went out-of-stock some time ago and were never replaced.  Occasionally their are compatible devices on eBay, but I don't know any specifics.
Jon McPhalen
EFX-TEK Hollywood Office


JonnyMac

Please understand that we (EFX-TEK) can make NO GUARANTEES about anything except our own products. 

That said, I believe that you can make this work as the board has a relay output that is normally open.  To use, connect your Trigger.R pin to the COM relay pin or the receiver, then connect the N.O. relay pin to the toggle switch that allows you to choose between the receiver and the PIR.  The common of that switch goes to the Trigger.W pin

Use the receiver in momentary mode so that you don't get a stuck trigger input.  Also, you can power the receiver from the same 12v supply that drives the Prop-1; connect the Prop-1 V+ to the receiver 12v+ pin, and connect the Prop-1 GND pin to the receiver 12v- pin; you can now control receiver power with the Prop-1 power switch (position 2 will provide power to the receiver).
Jon McPhalen
EFX-TEK Hollywood Office

jcarpenter2

Jon,
I now have the AP-8 and have installed it in my project box. For power for the AP-8 i connected the + to the V+ on the Prop-1 (prop-1 is using a 12V power supply)and the - to the Out0 on the prop-1.

Earlier you stated  "6. Connect the second RC-4 serial header to the AP-8 serial input; again, mind the markings." even though that confuses me since i would think the AP-8 would be connected to the Prop-1 using a header pin. Additionally, i have noticed that when all connections are made and the project is turned on the lights on the RC-4 seem to get hung up on its initial test (versus when the AP-8 is not hooked up to the RC-4 serial the RC-4 goes all the way through its startup test).

Are these connections accurate? If so, now on to programing.

Thanks for the info on the additional trigger. I am getting price quotes now so hopefully i will get an RF trigger soon.

JonnyMac

You're going to use one Prop-1 pin, 7, to "talk" to the RC-4 and AP-8.  Using a 3-pin extender wire you go from P7 (WRB) to the serial input of the RC-4.  From the second serial header of the RC-4 you use a second cable to connect to the serial input of the AP-8.  The connections have to be in this order because the version of the AP-8 that you have does not pass power through the WRB cable and the RC-4 needs it; by putting the RC-4 in the chain first everything works fine.

We designed the serial system of our boards so that they can be on a buss and save the number of I/O pins required to connect to accessories.  Since the control message for each is different, the devices will ignore messages not intended for them.   For example to turn on relay one of the RC-4 while turning the others off, you'd send this message:

  SEROUT Sio, OT2400, ("!RC4", %00, "S", %0001)

And to start the audio in slot 0 of the AP-8:

  SEROUT Sio, OT2400, ("!AP8", %00, "P", 0)

You see, it's the message header that keeps things straight.

Jon McPhalen
EFX-TEK Hollywood Office

jcarpenter2

April 25, 2007, 07:32:35 PM #12 Last Edit: April 25, 2007, 08:31:42 PM by jcarpenter2
Well Jon after looking at this stuff for three hours i have come to the conclusion i will need much more help programing than i thought. This is all the further i got and then i doubt it is right. Do you mind giving a hand when you get the time? Thanks

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


' -----[ Program Description ]---------------------------------------------
This program will wait for the PIR to activate, then trigger the lid to open.
1/4 second later the popup will rise, the strobe will come on and sound clip will
play on the prop-8. Eyes will then come on as soon as sound starts.

Strobe will turn off, PopUp will go down. 1/8 second later lid will go down. Eyes will turn off.

Program will wait for 1 minute before it can start again.

' Prop-1 powered by 12V
' Prop-1 P7 jumper OFF/P6 jumper ON/DWN
' Prop-1 P7 is connected to RC-4
' Prop-1 P6 is trigger to start connected to PIR
' LED power from Prop-1 V+ and Out1
' AP-8 serial connected to RC-4
' AP-8 power from Prop-1 V+ and Out0


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


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

' Serial connections
SYMBOL  RC4Sio              = PIN7
SYMBOL  RC8Sio              = PIN7
SYMBOL  Trigger             = PIN6


' Devices on the RC4 controller
SYMBOL RC4Strobe = 1
SYMBOL RC4Lid = 2
SYMBOL RC4PopUp = 3
SYMBOL RC4Extra = 4

SYMBOL P1 = 250             ' delay 1/4 second
SYMBOL P2 = 125             ' delay 1/8 second
SYMBOL P3 = 5000            ' delay 5 seconds
SYMBOL Resettime = 60000    ' delay 60 seconds before prop reset

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

SYMBOL  Baud            = OT2400
SYMBOL  Addr            = %00

SYMBOL  IsOn            = 1
SYMBOL  IsOff           = 0


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



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

Reset:


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

PropSequence:
' Open Lid
' Wait 1/4 second
' PopUp activates
' Strobe On
' Play Sound
' Turn on Eyes
' Wait 5 seconds
' Stobe Off
' PopUp Deactivates
' Wait 1/8 second
' Lid Closes
' Eyes Turn Off
' Wait 60 seconds before restarting sequence


    SEROUT RC4sio, OT2400, ("!RC4", %00, "R", RC4Lid, IsOn)
    PAUSE P1
    SEROUT RC4sio, OT2400, ("!RC4", %00, "R", RC4PopUp, IsOn)
    SEROUT RC4sio, OT2400, ("!RC4", %00, "R", RC4Strobe, IsOn)
    SEROUT RC8sio, OT2400, ("!AP8", %00, "P", 0)
    ??????
    PAUSE P3
    SEROUT RC4sio, OT2400, ("!RC4", %00, "R", RC4Strobe, IsOff)
    SEROUT RC4sio, OT2400, ("!RC4", %00, "R", RC4PopUp, IsOff)
    PAUSE P2
    SEROUT RC4sio, OT2400, ("!RC4", %00, "R", RC4Lid, IsOff)
    ???????
    PAUSE Resettime



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

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


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


' -----[ EEPROM Data ]-----------------------------------------------------

JonnyMac

April 26, 2007, 07:39:15 AM #13 Last Edit: April 26, 2007, 02:45:29 PM by JonnyMac
You're pretty close -- and here's how I'd do it.  A couple notes: With Prop-1 programs you want to minimize the number of SEROUT commands as they take a lot of code space; use a subroutine when possible.  When using PAUSE you don't have to create symbols for the delay values as PAUSE is a very explicit command; creating symbols as you have actually makes your program a bit harder to follow -- PAUSE is the on place where "magic numbers" in a listing are okay.

Trick: You'll see that the first SEROUT is padded with a bunch of "!" characters; this helps the RC-4 and AP-8 get back into sync in case they were in the middle of receiving a command when the Prop-1 gets reset;  the "X" command works with both and clears them.

Finally, you didn't specify where the eyes were connected so I assumed (could be dangerous) that they're on K4 of the RC-4.


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


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


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


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

SYMBOL  Sio             = 7                     ' no SETUP, no ULN
SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  Eyes            = PIN0


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

SYMBOL  IsOn            = 1
SYMBOL  IsOff           = 0


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

SYMBOL  rc4Outs         = B0
SYMBOL  strobe          = BIT0
SYMBOL  lid             = BIT1
SYMBOL  popUp           = BIT2
SYMBOL  unused          = BIT3

SYMBOL  timer           = B2


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

Reset:
  PINS = %00000000                              ' clear everything
  DIRS = %00000001                              ' make eyes an output

  SEROUT Sio, OT2400, ("!!!!!!RC4", %00, "X", "!AP8", %00, "X")

  PAUSE 60000                                   ' inter-event delay
  timer = 0
  rc4Outs = %0000


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

Main:
  PAUSE 25
  timer = timer + Trigger * Trigger             ' debounce input
  IF timer < 10 THEN Main                       ' wait 1/4 second

Activate_TCT:
  lid = IsOn
  GOSUB Update_RC4                              ' rc4Outs = %0001
  PAUSE 250

  popUp = IsOn
  strobe = IsOn
  GOSUB Update_RC4                              ' rc4Outs = %0111

  SEROUT Sio, OT2400, ("!AP8", %00, "P", 0)

  eyes = IsOn
  PAUSE 5000

  strobe = IsOff
  popUp = IsOff
  GOSUB Update_RC4                              ' rc4Outs = %0100

  PAUSE 125
  lid = IsOff
  GOSUB Update_RC4                              ' rc4Outs = %0000
  eyes = IsOff

  GOTO Reset


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

Update_RC4:
  SEROUT Sio, OT2400, ("!RC4", %00, "S", rc4Outs)
  RETURN
Jon McPhalen
EFX-TEK Hollywood Office

jcarpenter2

Thanks Jon. I'll be giving this a whirl before the day is up.
The eyes will be powered by the Prop-1 Out1 and V+. I thought i could control the sequence of the Out1 with the prop-1. Am i missing something? Just like the AP-8 draws its power from the prop-1 Out0 and the V+. Wouldn't i need a command for that to activate?

Thanks again