Offline
Newbie
Karma: 0
Posts: 41
|
 |
« on: April 15, 2012, 04:26:57 am » |
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
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Online
Brattain Member
Karma: 316
Posts: 35532
Seattle, WA USA
|
 |
« Reply #1 on: April 15, 2012, 08:36:51 am » |
I need that for position control of brushless controllers. What brushless controller? Most can be controlled using the servo library as-is.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 41
|
 |
« Reply #2 on: April 15, 2012, 08:58:31 am » |
This is the position control for a quadrocopter. At 200Hz, the system is much smoother than 50Hz.
How do I change the library?
Kay
|
|
|
|
« Last Edit: April 15, 2012, 09:00:55 am by Ketchup »
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 41
|
 |
« Reply #3 on: April 15, 2012, 03:59:05 pm » |
Does anyone know a solution?
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 219
Posts: 13896
Lua rocks!
|
 |
« Reply #4 on: April 15, 2012, 04:38:33 pm » |
What brushless controller? Link to datasheet please.
|
|
|
|
|
Logged
|
|
|
|
|
0
Online
Tesla Member
Karma: 50
Posts: 6554
Arduino rocks
|
 |
« Reply #5 on: April 15, 2012, 06:02:00 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 219
Posts: 13896
Lua rocks!
|
 |
« Reply #6 on: April 15, 2012, 06:12:55 pm » |
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).
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 41
|
 |
« Reply #7 on: April 16, 2012, 05:31:03 am » |
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
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 138
Posts: 19067
I don't think you connected the grounds, Dave.
|
 |
« Reply #8 on: April 16, 2012, 07:16:13 am » |
#define REFRESH_INTERVAL 2500 Or something along those lines? But that's awfully close to #define MAX_PULSE_WIDTH 2400
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 41
|
 |
« Reply #9 on: April 16, 2012, 12:22:38 pm » |
#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
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 138
Posts: 19067
I don't think you connected the grounds, Dave.
|
 |
« Reply #10 on: April 16, 2012, 01:02:31 pm » |
Because you didn't recompile it?
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 41
|
 |
« Reply #11 on: April 16, 2012, 01:46:24 pm » |
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
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 41
|
 |
« Reply #12 on: April 16, 2012, 02:21:41 pm » |
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
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 219
Posts: 13896
Lua rocks!
|
 |
« Reply #13 on: April 16, 2012, 04:35:28 pm » |
I got it to output at 400 Hz by changing the timer prescaler.
How did you do that? I used this: http://www.arduino.cc/playground/Code/PwmFrequency
|
|
|
|
|
Logged
|
|
|
|
|
|