Go Down

Topic: Library Servo.h period change (Read 1 time) previous topic - next topic

Ketchup

Hello

Sorry for my bad English.
In the German forum could not help me.

I want to use the library Servo.h servo signals to generate 200Hz period.
I need that for position control of brushless controllers.

How do I change the library?

Thank you for your help.

Kay

PaulS

Quote
I need that for position control of brushless controllers.

What brushless controller? Most can be controlled using the servo library as-is.

Ketchup

#2
Apr 15, 2012, 03:58 pm Last Edit: Apr 15, 2012, 04:00 pm by Ketchup Reason: 1
This is the position control for a quadrocopter.
At 200Hz, the system is much smoother than 50Hz.

How do I change the library?

Kay

Ketchup


Nick Gammon

What brushless controller? Link to datasheet please.

zoomkat

Quote
I want to use the library Servo.h servo signals to generate 200Hz period. I need that for position control of brushless controllers.


Is your brushless controller compatable with this modification? You might get more info from the coptor forums.
Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   8)

Nick Gammon

I got it to output at 400 Hz by changing the timer prescaler. But that may be too fast. From what I read Servo motors expect pulses about every 20 mS (50 Hz).

Ketchup


I got it to output at 400 Hz by changing the timer prescaler.


How did you do that?
What I have to change the library?

Thank you for an answer.

Kay

AWOL

Code: [Select]
#define REFRESH_INTERVAL    2500
Or something along those lines?

But that's awfully close to
Code: [Select]
#define MAX_PULSE_WIDTH      2400
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Ketchup


Code: [Select]
#define REFRESH_INTERVAL    2500
Or something along those lines?



I changed this parameter of 20000 (50 Hz) to 5000 (200Hz).
The signal has not changed, why?

Thank you for an answer.

Kay

AWOL

Because you didn't recompile it?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Ketchup


Because you didn't recompile it?

?

I have the file Servo.h changed the parameter and then saved the file.
Then a small test program written and loaded fresh on the Arduino Uno.

Is not that enough?

Kay

Ketchup

It goes :-)

I am very stupid.
I've had the Arduino folder 2X, edit the file in the wrong folder Servo.h.
I'm sorry for my stupidity.
Thank you for your help.

Kay Gruss

Nick Gammon


Go Up