Servo Slower?


Closed Thread
Results 1 to 15 of 15

Thread: Servo Slower?

  1. #1
    actionplus's Avatar
    actionplus Guest

    Default Servo Slower?

    I am trying to slow down a servo. Let me explain.
    I am using a Futaba radio with a 3rd channel as a switch. When I turn the switch on, the receiver gets the signal and moves the servo to a certain position.

    What I want to do is to do the same thing but in a slower rate.SLOW MOTION!!

    Is there anyway to take the signal coming out of the receiver,feeding it into a PIC12F ro something and then to the servo?

    Thanks

  2. #2
    Join Date
    Jul 2003
    Location
    Sweden
    Posts
    237


    Did you find this post helpful? Yes | No

    Lightbulb

    Hi,

    This is what popped right into my head when i read your post. I haven't tried it but it compiles. All you need to do is declare Input and Output pins, you'll also need to find a "Samples" value that fits your application. I seem to remember that a normal signal from a radio idles low and pulses high at 50Hz. If i'm wrong and your radio outputs a low signal and idles high, you should change "ActiveState to zero and "LOW OutputPin" to "HIGH OutputPin".


    InputPin VAR GPIO.0
    OutputPin VAR GPIO.1
    ActiveState CON 1
    InputSignal VAR WORD
    FilteredSignal VAR WORD
    Samples CON 20

    LOW OutputPin
    PULSIN InputPin, ActiveState, FilteredSignal
    WHILE 1
    PULSIN InputPin, ActiveState, InputSignal
    FilteredSignal = FilteredSignal * (Samples - 1)
    FilteredSignal = FilteredSignal + InputSignal
    FilteredSignal = FilteredSignal / Samples
    PULSOUT OutputPin, FilteredSignal
    WEND

    .... this little program will slow your servo down. Increasing "Samples" will slow thing down even more, 1 will give no delay.

    /Ingvar

  3. #3
    actionplus's Avatar
    actionplus Guest


    Did you find this post helpful? Yes | No

    Default I shall try that

    Thanks

  4. #4
    actionplus's Avatar
    actionplus Guest


    Did you find this post helpful? Yes | No

    Default Codes

    I am trying to understand what code is doing.

    PULSIN InputPin, ActiveState, FilteredSignal
    '(receives the pulse from inputpin. What does Activestate do? You have it CON 1)

    WHILE 1
    PULSIN InputPin, ActiveState, InputSignal
    FilteredSignal = FilteredSignal * (Samples - 1)
    '(FilteredSignal =FilteredSignal multiplited by(20-1)

    FilteredSignal = FilteredSignal + InputSignal
    '(Then the same signal is added to the Inputsignal)

    FilteredSignal = FilteredSignal / Samples
    '(Then this signal is divided by 20)
    PULSOUT OutputPin, FilteredSignal
    '(results to outputpin)
    WEND

  5. #5
    actionplus's Avatar
    actionplus Guest


    Did you find this post helpful? Yes | No

    Default Duh!

    activestate is to set the idle high.
    Sorry, I missed that.

  6. #6
    actionplus's Avatar
    actionplus Guest


    Did you find this post helpful? Yes | No

    Default Calibration

    I am getting error when I try to program(ICprog) but getting error for internal osc.
    How can set it to use internal Osc?

  7. #7
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    FAQ Section... Presetting Configuration Fuses (PIC Defines) into your Program.

  8. #8
    Join Date
    Jul 2003
    Location
    Sweden
    Posts
    237


    Did you find this post helpful? Yes | No

    Arrow

    Hi Actionplus,

    Did you figure out how the program works?

    /Ingvar

  9. #9
    actionplus's Avatar
    actionplus Guest


    Did you find this post helpful? Yes | No

    Default Ingvar

    yes, kind of know what it is doing. just that it compiles fine. but when using ICprog to burn, it is saying that it cannot find calibration for it and if I want to replace with 3FFFF. I click ok, still nothing. says I have error.

    Try inserting a Define OSC 4 and still error.
    I am trying to get out of using a crystal for now. at least to learn how not use a xtal.

  10. #10
    actionplus's Avatar
    actionplus Guest


    Did you find this post helpful? Yes | No

    Default Melanie

    Do I have type in all of this?

    Example: Typical Settings for a 16F628…

    @ DEVICE pic16F628, INTRC_OSC_NOCLKOUT
    ' System Clock Options
    @ DEVICE pic16F628, WDT_ON
    ' Watchdog Timer
    @ DEVICE pic16F628, PWRT_ON
    ' Power-On Timer
    @ DEVICE pic16F628, MCLR_OFF
    ' Master Clear Options (Internal)
    @ DEVICE pic16F628, BOD_ON
    ' Brown-Out Detect
    @ DEVICE pic16F628, LVP_OFF
    ' Low-Voltage Programming
    @ DEVICE pic16F628, CPD_ON
    ' Data Memory Code Protect
    ' Set to CPD_OFF for Development Copy
    ' Set to CPD_ON for Release Copy
    @ DEVICE pic16F628, PROTECT_ON
    ' Program Code Protection
    ' Set to PROTECT_OFF for Development Copy
    ' Set to PROTECT_ON for Release Copy

    ********************************************
    This what I had on mine

    @ DEVICE pic12F629, INTRC_OSC_NOCLKOUT
    ' System Clock Options
    @ DEVICE pic12F629, WDT_ON
    ' Watchdog Timer

    Will this be fine? I was just trying to blink a LED to find out if it worked this way, but still the same message. On the programmer, what setting should I put.

    Example:
    IntGP4?Tried this
    RCGP4?Tried this
    XT? I am sure not this
    HS? I am sure not this

    Anything else I am overseeing?

  11. #11
    Join Date
    Jul 2003
    Location
    Sweden
    Posts
    237


    Did you find this post helpful? Yes | No

    Unhappy

    Sorry, i've never used ICprog. Perhaps you should start a new thread .......

  12. #12
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    >> Do I have type in all of this?

    No you don't, but if you miss out something important then you'll be stuck wondering why things don't work...

    >> This what I had on mine...

    and something important is the MCLR setting... I don't see it with what you had...

    It's no big deal setting up your device header PROPERLY once, and then you've got it for life. But if you want to save yourself those thirty seconds and spend a few hours wondering why your program doesn't work- hell, who am I to suggest any different.

  13. #13
    actionplus's Avatar
    actionplus Guest


    Did you find this post helpful? Yes | No

    Default No oscillator value?

    I am still getting the same error. Now I am really confused. It keep saying that there is no Calibrated Oscillator Value and if I want to replace from 3FFF.

    I typed in all the lines that you suggested Melanie. Anything else I should look at?

  14. #14
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Insert this at the beginning of your program...

    Define OSCCAL_1K 1

    See if this does the trick.

    The calibration value is located at address $3FF (3FFh) and the above statement loads it (see PBP manual 2.5.1 on page 13).

    I don't have ICprog, but find it strange that it causes you fail to program just because you've not loaded the Factory Calibration value which is pretty irrelevant at best.

  15. #15
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Wink

    Hi, Everybody,

    As i had this problem before ... here are some lines:


    '************************************************* ****************************
    'Lissage du mouvement - motion smoothing
    '************************************************* ****************************

    Echantillon = 0
    Servoposc = Servopos

    IF Servopos > ( Servoposold + 1 ) THEN

    Servopos = ( Servoposold + 1 ) MIN Servoposc


    ENDIF

    IF Servopos < ( Servoposold - 1 ) THEN

    Servopos = ( Servoposold - 1 ) MAX Servoposc

    ENDIF

    Limit:

    LOW Servo
    PULSOUT Servo,Servopos

    Servoposold = Servopos

    IF NOT ( Echantillon / 10 ) THEN

    Echantillon = Echantillon + 1

    PAUSE 20

    GOTO Limit

    ENDIF


    There are 2 Things there : first I limit the "growth" of the signal to be sent and second, I only send one pulse every 10 input pulse ...

    so, it's the minimum speed for "pseudo continuous" travel of the servo ... after, steps are too much visible.

    With a 20 Mhz Clock It would be better ( resolution is 5 times better ... )

    The "LOW" just before pulsout is to ensure a good "1" pulse ... just try to connect your servo with power on, and you'll understand ...

    Good luck
    Alain

Similar Threads

  1. More Servo Woes
    By chrisshortys in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 13th May 2009, 08:40
  2. Problem with 12F629, servo and EEPROM
    By Atom058 in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 1st March 2008, 09:53
  3. Servo does not move
    By ruijc in forum General
    Replies: 12
    Last Post: - 12th November 2007, 19:14
  4. Beginner + Servo
    By james in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 31st July 2007, 21:31
  5. Help with Servo Control Please!
    By wireman22 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 7th June 2007, 18:15

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts