Author Topic: Servos running slowly  (Read 4587 times)

0 Members and 1 Guest are viewing this topic.

Offline Mad MIRTopic starter

  • Jr. Member
  • **
  • Posts: 32
  • Helpful? 0
Servos running slowly
« on: September 16, 2011, 12:17:39 PM »
Hey guys im new to arduino C and I've recently experimented using servos. I used the built in servo library and used it to control the position of the servo.

I saw the "knob" example, loaded the code etc and decided to mess around. I have used servos before in model aircraft and RC cars and noticed that the servo i was controlling was moving slow compared to the ones i used on normal RC models.

I was wondering whether this is just the way it is when it comes to arduino OR if there is something in the code OR if ive modded my servo for cont. rotation improperly.

btw: - spins slowly in both directions
       - the pot (which i pulled out from inside the servo and stuck on the outside) is cenetered such that there is no movement when input is 0.
       - I used standard output pins and have not modified the example code whatsoever.

Thanking you in advance,
-MAD_mir

Offline mstacho

  • Supreme Robot
  • *****
  • Posts: 376
  • Helpful? 10
Re: Servos running slowly
« Reply #1 on: September 18, 2011, 10:45:50 AM »
As a first guess, you're not powering the servo right.  Are you drawing power on the arduino only from the USB?  Or does it have another power supply?  Either way, the Arduino can only give you max. like 5 volts, so if you're used to RC, which typically runs at 7.2 to 9V and above, the servo will move slower.

Other than that I'm not sure.  Another possibility is that the servo signal you're generating with the arduino isn't going to its full limits, but I imagine you're just using Arduino servo code, so it shouldn't matter.

MIKE
Current project: tactile sensing systems for multifingered robot hands

Offline ChrisW

  • Jr. Member
  • **
  • Posts: 12
  • Helpful? 1
Re: Servos running slowly
« Reply #2 on: September 18, 2011, 11:14:10 PM »
is the pulse form signal changing properly to the servos (if not a power issue)


not sure if ths helps you out at all but here is some of the code from my HC11 project from way back when... can't say the variations in forward roll worked as i was having issues. (got the pass from making the robot do a perfect square and the follow it with a figure eight. let loose some of the magic smoke and cooked the A-to-D on the IC a few days before final test. the A-to-D was where the sensor inputs were going. instructor knew 'bot worked but had to grade me for something :P)

here's the skeleton to get the jyst. (sorry its Motorola assembler) you would add some code to instigate a change to servo speed in the main before the BRA . command (branch always? been a while)

.TITLE SERVOTEST
; THIS PROGRAM IS TO TEST THE SERVO OUTPUTS ON THE E2 BOARD

;                       EQUATES
        TCNT    =       0x100E  ;16 BIT TIMER COUNT REG
        TOC1    =       0x1016  ;TIMER OUTPUT COMPARE 1
        TOC2    =       0x1018  ;TIMER OUTPUT COMPARE 2
        TOC3    =       0x101A  ;TIMER OUTPUT COMPARE 3
        TOC4    =       0x101C  ;TIMER OUTPUT COMPARE 4
        TCTL1   =       0x1020  ;TIMER CONTROL REG 1
        TCTL2   =       0x1021  ;TIMER CONTROL REG 2
        TMSK1   =       0x1022  ;TIMER MASK REG 1
        TFLG1   =       0x1023  ;TIMER FLAG REG 1
        TMSK2   =       0x1024  ;TIMER MASK REG 2
        TFLG2   =       0x1025  ;TIMER FLAG REG 2
        RAMHI   =       0x00FF  ;LAST ADDRESS OF INTERNAL RAM
        REGBAS  =       0x1000  ;REGISTER BASE ADDRESS
        BPROT   =       0x0035  ;OFFSET FROM BASE FOR BPROT
        PPROG   =       0x003B  ;OFFSET FROM BASE FOR PROG
        EESTRT  =       0xF800  ;FIRST ADDRESS EEPROM ON 811E2
        RSETVEC =       0xFFFE  ;ADDRESS OF RESET VECTOR
        ERSRAM  =       0x0000  ;ADDRESS IN RAM THAT ROUTINES
                                ;WILL BE COPIED TO

        .AREA SERVOTEST(ABS)
        .MODULE SERVOTEST
        .ORG    EESTRT


MAIN:   LDS     #RAMHI  ;SET STACK POINTER
       
        LDAA    #0x55   ;ENABLE TOGGLE FOR 0C2, 0C3, 0C4, 0C5
        STAA    TCTL1

        LDAA    #0x78   ;ENABLE INTERRUPTS FOR OC2, OC3, OC4, OC5
        STAA    TMSK1

        CLI             ;ENABLE ALL MASKABLE INTERRUPTS.

        BRA     .

;       OC2     CENTER SERVO    SIGNAL AT 1.5ms
;       @50% DUTY CYCLE -> 750us
;       750us/500ns = 1500
OC2_ISR:
        LDAA    #0x40   ;CLEARS OC2 FLAG
        STAA    TFLG1

        LDD     TOC2    ;SET NEW CONTROL VALUE IN TOC2
        ADDD    #1500
        STD     TOC2

        RTI

;       OC3     SERVO REVERSE  (SLOWER SIGNAL)  3ms
;       @50% DUTY CYCLE -> 1.5ms
;       1.5ms/500ns = 3000
OC3_ISR:
        LDAA    #0x20   ;CLEARS OC3 FLAG
        STAA    TFLG1

        LDD     TOC3    ;SET NEW CONTROL VALUE IN TOC3
        ADDD    #3000
        STD     TOC3

        RTI

;       OC4     SERVO FORWARD  (FASTER SIGNAL) 750us
;       @50% DUTY CYCLE -> 375us
;       375us/500ns = 750
OC4_ISR:
        LDAA    #0x10   ;CLEARS OC4 FLAG
        STAA    TFLG1

        LDD     TOC4    ;SET NEW CONTROL VALUE IN TOC4
        ADDD    #750
        STD     TOC4

        RTI

;       OC5     SERVO FORWARD (RUSH)    375us
;       @50% DUTY CYCLE -> 187.5us
;       187.5us/500ns = 375
OC5_ISR:
        LDAA    #0x08   ;CLEARS OC5 FLAG
        STAA    TFLG1

        LDD     TOC1    ;SET NEW CONTROL VALUE IN TOC1
        ADDD    #375
        STD     TOC1

        RTI


        .ORG    0xFFE6
        .DW     OC2_ISR

        .ORG    0xFFE4
        .DW     OC3_ISR

        .ORG    0xFFE2
        .DW     OC4_ISR

        .ORG    0xFFE0
        .DW     OC5_ISR

        .ORG    0xFFFE
        .DW     0xF800

Offline Mad MIRTopic starter

  • Jr. Member
  • **
  • Posts: 32
  • Helpful? 0
Re: Servos running slowly
« Reply #3 on: September 20, 2011, 04:45:02 AM »
Hey i think its because im running my servos on 5v from the arduino, I think if I run the servos off'f an external 6V source it should make it run at a decent speed. Do you think i can do it just like that or do I need to connect the ground of my 6V supply to the ground of my 9V battery??

Offline mstacho

  • Supreme Robot
  • *****
  • Posts: 376
  • Helpful? 10
Re: Servos running slowly
« Reply #4 on: September 20, 2011, 07:08:10 AM »
You have to connect the grounds.  This is one of my key lessons that set me back about two days worth of work :-P

MIKE
Current project: tactile sensing systems for multifingered robot hands

Offline ChrisW

  • Jr. Member
  • **
  • Posts: 12
  • Helpful? 1
Re: Servos running slowly
« Reply #5 on: September 20, 2011, 07:44:34 PM »
yup must have one ground, otherwise it will get 'interesting'.

servos can be separately powered just make sure the signal comes from the micro. the good news is your servos roll, try the second power source and make sure it is isolated from the micro's supply. otherwise magic smoke

Offline Mad MIRTopic starter

  • Jr. Member
  • **
  • Posts: 32
  • Helpful? 0
Re: Servos running slowly
« Reply #6 on: September 21, 2011, 02:00:42 PM »
when you say isolated you mean the second power source's +ve should not be connected to my arduino's postive?

Offline ChrisW

  • Jr. Member
  • **
  • Posts: 12
  • Helpful? 1
Re: Servos running slowly
« Reply #7 on: September 21, 2011, 07:17:10 PM »
when you say isolated you mean the second power source's +ve should not be connected to my arduino's postive?


correct. two separate power packs with a shared ground.

i ran my servos with a 7.2 volt NiMH pack i stole from an RC car and my BotBoard was running off of 4 AA batteries. the micro was connected to the signal wires of the servo while the servos got there own source of juice. (+ive from the 7.2 pack)

this is done mainly to prevent brown outs to the micro. consider servos motors as a couple of inductors, they will tend to pull a lot of current when starting. if the batteries are getting low the initial pull of current will cause a reset to your micro, shouldn't cause damage in most cases but is a huge annoyance when trying to figure out the issues.

when trying to figure out problems take an old repair techs advice, check the power supply first. measure battery pack under load. if you can, add in a multimeter to see the current draw. (start at the 10A range, no need to pop the 400mA fuse).

hope this helps, post a pic of the bot if you can.
« Last Edit: September 21, 2011, 07:31:04 PM by ChrisW »

Offline Mad MIRTopic starter

  • Jr. Member
  • **
  • Posts: 32
  • Helpful? 0
Re: Servos running slowly
« Reply #8 on: September 24, 2011, 02:55:27 AM »
Thanks a lot, im sure that advice will come in handy!
I will definately post a pic soon!

thank you everyone!

Offline Mad MIRTopic starter

  • Jr. Member
  • **
  • Posts: 32
  • Helpful? 0
Re: Servos running slowly
« Reply #9 on: October 03, 2011, 11:36:27 AM »
Hey guys check it out!
The pics are on my blog: http://madmirblog.blogspot.com/

This is just the first prototype of the base for my line following robot!

Offline Mad MIRTopic starter

  • Jr. Member
  • **
  • Posts: 32
  • Helpful? 0
Re: Servos running slowly
« Reply #10 on: October 03, 2011, 12:10:49 PM »
And dont forget to follow me if your on blogger! I'm going to upload some of the generative art I've made over the past few weeks!
 

 


Get Your Ad Here