Shop OBEX P1 Docs P2 Docs Learn Events
Pulsin with RC receiver — Parallax Forums

Pulsin with RC receiver

ProfessorwizProfessorwiz Posts: 153
edited 2008-09-01 04:10 in General Discussion
When reading the stick position from an RC receiver.· Am I supposed to use a resistor inline?· I setup a SX chip so it reads in the pulsin from the channel.· What is happens most of the time is that it makes a camera take a picture when the stick is at a certain position.· If the stick is high it takes 3 pictures in rapid succession.· If it is mid stick, the camera takes a picture every 1 second.· If the stick is low it doesn't take a picture.· The other stick on the controller moves a pan and tilt mechinism.
The problem comes up when it's attached to the pan and tilt with the other channels driving servos.· It works fine in low, and mid stick, but when I select High stick it will do the 3 rapid pics once, then seems to shut off.· Disconnecting the unit and reconnecting it doesn't work unless I wait a couple minutes.·
My thoughts were, either I'm stressing the servos and the battery pack for the servos is going too low in voltage so that it doesn't create pulses for the sx chip to see or the motors when speeding up and slowing down are sending spikes back though the receiver and into the sx chip.· The SX chip is only connected to the pulse line, and the ground so I didn't see how that would effect this.
Of course on the bench without the other stuff it works fine.

Russ
·

Comments

  • ZootZoot Posts: 2,227
    edited 2008-08-30 04:43
    A 220 to 470 resistor is always good for *any* input -- this way if a programming error ever makes the pin an output, you won't get short circuit. Regardless, can you post your code and/or a wiring diagram of how you have the camera and such hooked up?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • ProfessorwizProfessorwiz Posts: 153
    edited 2008-08-31 19:22
    Ok Here is the program, thanks again to JonnyMac for the previous help.

    ' =========================================================================
    '
    '·· File...... pwidth2
    '·· Purpose... Trigger a camera shutter
    '·· Author.... Russell Wizinsky
    '·· E-mail.... Russw@professorwiz.com
    '·· Major Revision and program redone by JonnyMac - SX Forum / Parallax
    '·· Started...8/1/08
    '·· Updated...8/31/08
    '
    ' =========================================================================
    '
    ' Program Description
    '
    ' The purpose of the program is to trigger a the shutter of a camera
    ' dependent on the movement of a remote control for Airplanes / Helis
    ' Down position will be camera off / standby
    ' Midstick will be single shot
    ' Top Stick will be 3 round bursts
    ' After all camera shots there will be a 1 second delay

    '
    ' Conditional Compilation Symbols
    '


    '
    ' Device Settings
    '

    DEVICE········· SX28, OSC4MHZ, TURBO, STACKX, OPTIONX, BOR42
    FREQ··········· 4_000_000
    ID············· "CLICKS"


    '
    ' I/O Pins
    '

    Led7··········· PIN···· RC.7 OUTPUT
    Led6··········· PIN···· RC.6 OUTPUT
    Led5··········· PIN···· RC.5 OUTPUT
    Led4··········· PIN···· RC.4 OUTPUT
    Led1··········· PIN···· RC.0 OUTPUT

    Camera········· PIN···· RB.4 OUTPUT
    Receiver······· PIN···· RC.1 INPUT


    '
    ' Constants
    '

    IsOn··········· CON···· 1
    IsOff·········· CON···· 0


    '
    ' Variables
    '

    pWidth········· VAR···· Byte


    ' =========================================================================
    ' INTERRUPT
    ' =========================================================================


    ' RETURNINT


    ' =========================================================================
    · PROGRAM Start
    ' =========================================================================


    '
    ' Subroutine / Function Declarations
    '

    DELAY_MS······· SUB···· 1, 2

    PIC1··········· SUB···· 0
    PIC3··········· SUB···· 0
    CLICKS········· SUB···· 0


    '
    ' Program Code
    '

    Start:
    · PLP_A = %00000000
    · PLP_B = %00010000
    · PLP_C = %11110011


    Main:
    · PULSIN Receiver, 1, pWidth

    · IF pWidth > 200 THEN
    ··· PIC3
    · ELSEIF pWidth > 100 THEN
    ··· PIC1
    · ENDIF

    · DELAY_MS 1000
    · GOTO Main


    '
    ' Subroutine / Function Code
    '

    ' Use: DELAY_MS duration
    ' -- shell for PAUSE

    SUB DELAY_MS
    · IF __PARAMCNT = 1 THEN
    ··· __WPARAM12_MSB = 0
    · ENDIF
    · PAUSE __WPARAM12
    · ENDSUB

    '

    SUB PIC1
    · CLICKS
    · ENDSUB

    '

    SUB PIC3
    · CLICKS
    · CLICKS
    · CLICKS
    · ENDSUB

    '

    SUB CLICKS
    · Led4 = IsOn
    · Led5 = IsOn
    · Led6 = IsOn
    · Led7 = IsOn
    · Camera = IsOn
    · DELAY_MS 300
    · Led4 = IsOff
    · Led5 = IsOff
    · Led6 = IsOff
    · Led7 = IsOff
    · Camera = IsOff
    · DELAY_MS 200
    · ENDSUB


    '
    ' User Data
    '
  • JonnyMacJonnyMac Posts: 9,215
    edited 2008-09-01 04:10
    How much current are you LEDs using? Maybe you need to buffer them with transistors (or a ULN to make things easy). You could always reduce the BORxx setting if you thing your batteries are getting a little low. Also, if your servos and SX are on the same power supply you might want to drop some extra filter caps on the power line.
Sign In or Register to comment.