November 23, 2024, 01:20:14 PM

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.


program help

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

Previous topic - Next topic

FAIR1

 I have a prop that runs continuously. I want to give the head a 45> turn and trigger a voice recording module. I hacked a Douglas Talking Fir and Radio Shack voice recording module together. The play button on the recording module has wires connected to the appropriate traces and go to a TIP120's out pins. the trigger pin on the TIP 120 is connected to a 220 Ohm resister and then to the pin of the old controller I was using. (I can no longer get support for this controller and am now using "PROP 1".) Is this set up still going to work with Prop 1?
I also want to control a servo (Futaba S3003) for a 45> head movement. All of the componets will have there own power supplies. Talking Fir, 7VDC, Recording module, 9VDC, Servo, 6VDC, Prop 1, 12VDC. The setup will all be controlled by a (Haunt Master Combo Flex ECT) haunt timer. I have all this stuff laying around and want to use it up.
I need a program to control the servo and trigger the voice module and a diagram as to where to connect to the pins on the Prop 1.

(1) Move the servo Smoothly 45> in 1 1/2 sec and hold there for 10sec.  (2) At 1 1/2 sec, trigger voice module. (3) At 10 sec, return servo to starting point smoothly and wait for the Haunt timer to re-trigger the Prop 1.
Thanks for all your help.

JonnyMac

You should be able to connect the upstream side of the 220 (that goes to the base of the TIP120) to a Px.W pin, and pulse it high to simulate a button start.  Note that the emitter side of the TIP120 has to connect to Px.B (ground) or the GND terminal. 

Give this program a try.

' =========================================================================
'
'   File......
'   Purpose...
'   Author....
'   E-mail....
'   Started...
'   Updated...
'
'   {$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


' -----[ 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 Main


' -----[ 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

FAIR1

  Are you saying I do not need the 220 resistor I have connected to the TIP 120? Just connect the TIP 120 directly to the Px.W pin.

  The Collector and Emitter Pins of the TIP120 are both connected to traces on the Voice Module. If I need to connect the Emitter side to Px.B then where do I run a wire from, the Emitter or from where it connects to the trace on the Voice Module.

JonnyMac

Leave the circuit as is.  Connect the "control" side of the 220 to Px.; the 220 will limit the current into the base.  As I already stated, the emitter must be connected to the Prop-1 ground otherwise the transistor will not turn on. 

Important Note: the TIP120 as a peculiar pin-out; please make sure you know which pin is the emitter before you connect it to the Prop-1 ground.
Jon McPhalen
EFX-TEK Hollywood Office

FAIR1

 I have connected the PROP1 to my computer and ran the (Hello World) program, all went smoothly. I then downloaded your program to the PROP1, all went smoothly.

I have the (TIP 120 BASE) connected to P6-W. I ran an extra wire from the (Emitter) to P6-B, it is now connected to ground on PROP1 and to the trace of the Voice Module.

I have the servo connected to (P1) at, (Control wire at P1-R) and ground wire from servo and power supply ground to (P1-B),

I have not turned the PROP1 on until I could check with you to see if this is the correct set up.

JonnyMac

Did you put a 220 between the base of the TIP120 and the Px.W?  If not, why not?

Please understand that we can help you with using our products but do not have the resources to teach you electronics -- if you don't know how this stuff works you're in danger of breaking something.  Please, we don't want that.  If you are interested interfacing projects like this I suggest you get a copy of "Getting Started in Electronics" -- it's a great intro to how basic components and circuits work.

Here's a general schematic for the external transistor interface.  I didn't mark the resistor as 220 because I would normally use 470 or even 1K.



Jon McPhalen
EFX-TEK Hollywood Office

FAIR1

 Yes I have the 220 resister between the Px.w pin and BASE on the TIP 120

FAIR1

 Sorry, comp chip fan died. Just to see if we are on the same page, I attached a diagram. I am sure the componets are wired right. What I don't understand yet is the Prop 1. As you can see the only things it will be controlling are the "Servo operation" and a "Trigger for the voice Module".

1. Dose the program you have given me hold true for this application?

2. Can you tell me which pins to connect to, (Servo ground pin, TIP120 Emitter with resister ground pin, TIP 120 Base pin, and Servo signal pin?

I would really like to finish this prop up even though I don't understand the Prop 1 as well as I though I did. I will go to parallax and download the Basic Stamp manual and read if that will help. Prop 1 is totally diffrent from what I had used in the past, I know I don't have time to understand it and it's programing before Halloween.

JonnyMac

October 23, 2009, 12:44:27 AM #8 Last Edit: October 23, 2009, 12:49:56 AM by JonnyMac
Did you ever see the movie Jerry Maguire?  There's a great line in the movie: Help me help you.

I can't see what's on that diagram as it's ridiculously small; please attach a larger version so I can see what you have.   You may have noticed the the schematics and diagrams I post in these forums are very easy on the eyes.  Got it?   ;D

Please... help me help you.
Jon McPhalen
EFX-TEK Hollywood Office

FAIR1

  I'm trying. Try this one.

JonnyMac

That's much better, thank you; I can see what's going on.

Get a few of our short extender cables (805-00035).  Cut one in half.  Connect the white wire to the free side of the 220-ohm resistor.  Connect the black wire to the lead that connects to the emitter of the TIP120.  The red wire is not used.  Plug the connector onto the P0 header -- be mindful of the color code (white goes to the left)

For one servo you probably don't need an external power supply; just plug it into the P1 header (again, watch the colors).  If you think you need the externla supply then take the other half of the wire from above and connect it to the servos white (could be yellow) and black (could be brown wires).  Again, the red wire is not used.  Plug the connector end into P1.

Connect a PIR or a N.O. button/switch to P6 and you're good to go.
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

I took you diagram and "drew" on top of it just to make sure my notes are clear.
Jon McPhalen
EFX-TEK Hollywood Office

FAIR1

 I have everything connected as per your additions to the diagram. The Servo and the PIR. do absolutely nothing and the voice module comes on every fifteen seconds. Should I try re-donloading the program?

JonnyMac

You have a false trigger -- make sure that P6 SETUP jumper is in the down position.
Jon McPhalen
EFX-TEK Hollywood Office

FAIR1

 Both P6 and P7 are in the down position, that is the way the Prop 1 came.