November 23, 2024, 01:35:21 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.


program help

Started by FAIR1, October 09, 2009, 01:29:29 PM

Previous topic - Next topic

halloweenrick

Are you certain that P6 is in the down posistion, because when the Prop1 has ever shipped to me its not.  Look at P6, and then to the left of it you will see UP and DN. The UP pin needs to be bare, with no jumper on it is what I think JonnyMac is trying to tell you.  The middle pin and DN need to be connected by the jumper. 

FAIR1

 Yes, that is what it looks like on both P6 and P7 and that is the way it was shipped to me. The out side left Pin is not connected and the center and right Pins are. They are both in the down position.

JonnyMac

Again, you have a false trigger.  I just ran that program on my bench with a servo and a push-button input -- it works as you want it to work.

You may just be setting off the PIR while working with it; this is easy to do.  You need to find a way to shield the PIR from your body while doing testing or, as I do, use a push-button trigger.  If you have another 14" extension cable you can cut off one end and connect a normally-open (N.O.) button between the red and white wires.  This will simulate the PIR without the problems of false activations because the PIR is not shielded.
Jon McPhalen
EFX-TEK Hollywood Office

FAIR1

 Here is another diagram. I have isolated the PIR in a box, there are no shadows or anything ells to trigger it, unless I place my hand in the box to do so. When the power is applied and the Prop 1 is turned on the Voice Module repeats every 15 seconds. The servo dose nothing and the PIR triggers nothing. I copied and pasted the program in to the compiler so I made no mistake trying to type it out.

FAIR1

 The diagram has a mistake on it . The PIR is on Pin 06 not 07.

JonnyMac

Well, since the diagram and code I gave you say to connect the PIR to P6 and you put it on P7, I am force to conclude that you've not followed one of our other directions or have erred elsewhere.  

Again, I downloaded the code I wrote for you (at the top of this thread) and ran it with a trigger (push-button to simulate the PIR) on P6, an LED (so I could see the pulse to the audio player) on P0 and a servo on P1.  When I press the button the LED on P0 blinks (which should start the audio player in your case) and the servo turns to the side.  After 10 seconds the servo turns back.

What does this mean?  It means that the program works and the problem is on your end.

The PIR port is an easy fix; move the connector to P6.

The audio player... well, that's on you.   In point of fact you don't need that transistor circuit; you can use the OUT0 terminal (goes where the collector is connected) and the GND terminal (goes where the emitter is connected).  The ULN is an NPN Darlington, the same transistor configuration as the TIP120.  There is no need to use the TIP120 in this circuit because you're not switching any appreciable current current.

One thing to check in your present circuit is that the emitter of the transistor is actually connected to the ground side of the audio player power supply.  If the connections are backward the protection diode in the TIP120 could allow enough current flow to force the player to loop; this might be what you're seeing.
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

Our replies crossed in cyberspace.

Okay, make a push-button circuit to test with -- PIRs are a big problem with testing, especially during the day when there are so many ways to provide a false trigger.  The controller doesn't care; all it wants is a high input on P6.W to start the program -- you can simulate this with a N.O. pushbutton connected between P6.W and P6.R.

Just one last thought on the PIR.... do you have it connected to the cable correctly?  The terminal marked "OUT" (assuming you're using the Parallax PIR we carry) goes to the white wire.

Giving us accurate information will speed the process; please be more careful with the diagrams you post.
Jon McPhalen
EFX-TEK Hollywood Office

FAIR1

  OK!!!! All is working.  You were right, I had the PIR connected in reverse at the PIR. Ran a test on the Servo I had hooked up, it came dead from the factory, so it has been changed out.

  Now can we tweak the program. The Servo needs to move 90> hold and back to start after 9 sec. The 45> movement is not enough to get the skull facing the spectators, and the return time is over kill.

  Thank you very much for your patience with me through this I have gained a lot of insight in to the Prop-1

JonnyMac

Excellent news! 

I don't know what servo you're using but if it's a Hitec check the package; many Hitec servos will do 180 degrees using 600 to 2400 microsecond pulses -- this works out to 60 to 240 with the Prop-1 using the PULSOUT instruction.

If possible, take pictures/video of your prop when it's done and post in the "Completed Projects" section.
Jon McPhalen
EFX-TEK Hollywood Office

FAIR1

 Changed PULSOT: from 150 to 100 and 100 to 150, to 160 to 65 and 65 to160 = 90> for Futaba S3003. Servo works perfect now. OK, "now how do I change the timing so the Servo only holds at 65 for nine seconds", then returns to160 in four seconds. If this works out timing wise, I will leave you alone. I do not think this Prop is going to make it this Halloween . I now have to get this all installed and the rest of the prop painted and airbrushed. I will post pictures when it's done though.

JonnyMac

October 30, 2009, 09:57:53 AM #25 Last Edit: October 30, 2009, 10:01:24 AM by JonnyMac
Did you read the program listing?  I wrote it so that changing the delay falls into the "no brainer" category!  ;D

  delay = 10000
 GOSUB Servo_Pause


Change 10000 (10 seconds) to 9000 (9 seconds) and you're set!

Adjusting the return time is a done right below that section:

Turn_Back:                                      ' turn in
 FOR pos = 100 TO 150
   FOR speed = 1 TO 2                          ' slow servo
     PULSOUT Servo, pos
     PAUSE 18
   NEXT
 NEXT


The marked line controls the servo speed -- you'll have to experiment with the end value (presently 2).
Jon McPhalen
EFX-TEK Hollywood Office

FAIR1

  I thought this was going to be the solution. I just could not make my self try it with out asking first. The last thing I needed to do was fry the Prop 1. Thank you again for all your help. You got me through this in 9hrs, it took 3 mo to get the program for the controller I was using up and running. You guys at EFX-TEK are the best. Have a great Halloween.

FAIR1

 As I have been installing this set up and testing and adjusting the program I realised it can be triggered over and over again. Can you show me an add on to the program and where to insert it to give it a thirty second delay before it can be re-triggered. Thank you.

livinlowe


right here:


Main:
  timer = 0                                     ' reset timer

Check_Trigger:

add this:



Main:
  timer = 0                                     ' reset timer
Pause 30000

Check_Trigger:
Shawn
Scaring someone with a prop you built -- priceless!

JonnyMac

You can't simply insert a PAUSE 30000 into this program as the servo needs to be updated every 20 milliseconds.  Here's an update that inserts that delay:

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


' -----[ Program Description ]---------------------------------------------
'
' Trigger :: Parallax-compatible PIR or N.O. button (mat switch, etc.)
'            -- connect N.O. button between P6.W and P6.R


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


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

SYMBOL  Trigger         = PIN6                  ' SETUP = DN
SYMBOL  Servo           = 1
SYMBOL  AudioStart      = PIN0


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

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

SYMBOL  Yes             = 1
SYMBOL  No              = 0


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

SYMBOL  timer           = B2
SYMBOL  pos             = B3
SYMBOL  speed           = B4

SYMBOL  delay           = W5


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

Reset:
 PINS = %00000000                              ' clear all
 DIRS = %00000011                              ' set output pins

 pos = 150
 delay = 30000
 GOSUB Servo_Pause


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

Main:
 timer = 0                                     ' reset timer

Check_Trigger:
 PULSOUT Servo, pos
 PAUSE 18                                      ' loop pad
 timer = timer + 20 * Trigger                  ' update timer
 IF timer < 200 THEN Check_Trigger             ' wait for 0.2 sec input

Slowly_I_Turn:                                  ' turn out
 FOR pos = 150 TO 100 STEP -1
   FOR speed = 1 TO 2                          ' slow servo
     PULSOUT Servo, pos
     PAUSE 18
   NEXT
 NEXT

 AudioStart = IsOn                             ' blip audio start
 delay = 100
 GOSUB Servo_Pause
 AudioStart = IsOff

 delay = 10000
 GOSUB Servo_Pause

Turn_Back:                                      ' turn in
 FOR pos = 100 TO 150
   FOR speed = 1 TO 2                          ' slow servo
     PULSOUT Servo, pos
     PAUSE 18
   NEXT
 NEXT

 GOTO Reset


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

' Create delay while refreshing servo

Servo_Pause:
 IF delay < 20 THEN SP_Exit
   PULSOUT Servo, pos
   PAUSE 18
   delay = delay - 20
   GOTO Servo_Pause

SP_Exit:
 RETURN

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


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