Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 23, 2024, 05:38:24 17:38


Login with username, password and session length


Pages: [1]
Print
Author Topic: Three servo tester with potentiometers  (Read 7347 times)
0 Members and 1 Guest are viewing this topic.
Deimos
Newbie
*
Offline Offline

Posts: 31

Thank You
-Given: 1
-Receive: 14


Whatever...!!!


WWW
« on: November 22, 2007, 04:37:47 16:37 »

You can prove your servos with potentiometers, it shows in the lcd the current position of the servomotor.



Code in PBP for Pic micro:


DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTB
DEFINE LCD_RSBIT 5
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 4

Define ADC_BITS 8
Define ADC_CLOCK 3
Define ADC_SAMPLEUS 50

adval var byte
b0 var byte
b1 var byte
b2 var byte
b6 var byte
b7 var word
mover var word

TRISA = %11111111
ADCON1 = %00000010

pause 250

lcdout $FE,1,"SRV1 SRV2 SRV3"


start:
 lcdout $FE,$C0,dec3 b0,"  ",dec3 b1,"  ",dec3 b2
    PORTC = 0
    pulsout PORTC.0, b0
    pulsout PORTC.1, b1
    pulsout PORTC.2, b2
    b7 = b0 + b1 + b2
    b6 = b7/100
    b7 = 15 - b6
    pause b7
 Adcin 0, b0
 Adcin 1, b1
 Adcin 2, b2
    goto start
end


I think it is useful to study the positions of the servos to make a simple robot.

I hope that simple example will be useful.

Enjoy  Grin
« Last Edit: November 22, 2007, 05:44:51 17:44 by Deimos » Logged

Saludos desde Ecuador
Deimos
Newbie
*
Offline Offline

Posts: 31

Thank You
-Given: 1
-Receive: 14


Whatever...!!!


WWW
« Reply #1 on: November 25, 2007, 03:22:53 03:22 »

Here's a video of this project, im usin three hitec HS-311 servos:

http://www.youtube.com/watch?v=DRM2oxue3Dc
Logged

Saludos desde Ecuador
frasenci
Translator
Active Member
***
Offline Offline

Posts: 171

Thank You
-Given: 142
-Receive: 84


« Reply #2 on: November 25, 2007, 03:56:04 03:56 »

nice video !

would you show in detail how you made the opening/closing clamp ??

greetings
Logged
Deimos
Newbie
*
Offline Offline

Posts: 31

Thank You
-Given: 1
-Receive: 14


Whatever...!!!


WWW
« Reply #3 on: November 27, 2007, 04:58:14 16:58 »

you can buy the grip here:

www.lynxmotion.com

here is an image:



Logged

Saludos desde Ecuador
robban
Senior Member
****
Offline Offline

Posts: 265

Thank You
-Given: 34
-Receive: 38


Warrior


WWW
« Reply #4 on: November 27, 2007, 10:02:24 22:02 »

What kind of servos are You using? The normal servo signal is a 2 ms spike and 20 ms period...
Logged

Code Warrior
frasenci
Translator
Active Member
***
Offline Offline

Posts: 171

Thank You
-Given: 142
-Receive: 84


« Reply #5 on: November 28, 2007, 12:08:05 00:08 »

What kind of servos are You using? The normal servo signal is a 2 ms spike and 20 ms period...

Good point robban.

Maybe , deimos forgot an important step in his/her code wich is the scaling of the value obtained from ADC , to fit standard pulse length used by RC servos like the one shown on foto.

For info , a standard RC servo like Hitec , Futaba will use :

Far left : pulse length  = 1000 ms
Center   :                  = 1500 ms
Far right :                  = 2000 ms

by all means , pulses must be fed into servo electronics at least every 20 ms ( 50 hz ) . Otherwise , servos willl shutter

my 10 cents

greetings
 
Logged
robban
Senior Member
****
Offline Offline

Posts: 265

Thank You
-Given: 34
-Receive: 38


Warrior


WWW
« Reply #6 on: November 28, 2007, 12:46:20 00:46 »

That's correct Fracenci. Myself, I use a PWM(sort-of)-signal so I can gain full control from the RC-control:
' Program to move RC servo using potentiometer(Proton)


//for the 16f628 or whatever; the smaller the better and don't forget to use as low freq as possible for battery longevity

' Define ADIN parameters
      ADIN_RES = 10         ' Set number of bits in result
      ADIN_TAD = FRC         ' Set clock source (3=rc)
      ADIN_STIME = 100                   ' Set sampling time in uS

      Pos     Var     Word      ' Servo position
      Symbol Pin = PORTB.3      ' Alias servo pin


      Input TRISA         ' Set PORTA to all input
      TRISB = %11110000      ' Set PORTB.0-3 to output
      PORTB = 0         ' Set PORTB.0-3 low
           ADCON1 = %10000010                   ' Set PORTA analog and right justify result


' Main program loop

   loop:
   Pos = Adin 0         ' Store value of analog input in pos
        Servo Pin , 1500 + Pos                          ' start with center
        Delayms 20            ' Servo update rate
        Goto loop            ' Do it all forever

        End
« Last Edit: November 28, 2007, 12:50:21 00:50 by robban » Logged

Code Warrior
Deimos
Newbie
*
Offline Offline

Posts: 31

Thank You
-Given: 1
-Receive: 14


Whatever...!!!


WWW
« Reply #7 on: December 05, 2007, 04:50:44 04:50 »

I'm using HS-311 servos.
Logged

Saludos desde Ecuador
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC