Hi
Have spent some time reading posts related to this question…
I am using a Maestro 24 on a Hexapod with 18 Servos. using Arduino Mega for control.
When I an testing/Learning what the maestro can do I have noticed that the movement of a servo from centre to max gives me only 45 deg of movement and minus 45 deg in the other direction. Which = 90 Deg. Servos I am using are MG996R.
In the Arduino IDE I can use myservo.attach(7,500,2400); to get the full 180 Deg of movement.
How can I do this using the Arduino environment ?
I have read some ware that this can be done by adjusting the range by multiplying by 8, How is the Question and were ?.
Include my Arduino sketch.
#include <PololuMaestro.h> // Official Pololu Maestro library
#define maestroSerial Serial1// Choose the correct serial port for your Arduino board
MiniMaestro maestro(maestroSerial);// Create a Maestro object for Compact Protocol
int Acc = 0;// Acceleration: 0 = unlimited (fastest possible) 1 is very slow with a max of 255
int Spd = 0;// Speed: 0 = unlimited (fastest possible) 1 = very slow with a max of 127
int waiting_Time = 1000;
uint8_t moving;
void setup() {
maestroSerial.begin(9600); // Maestro default baud rate
Serial.begin(9600);
// Optional: set servo speed and acceleration to max
// Speed: 0 = unlimited (fastest possible)
// Accel: 0 = unlimited
maestro.setSpeed(0, Spd); // 0 = no speed limit 1 is very slow 127 is max speed
maestro.setAcceleration(0, Acc); // 0 = no Acceleration limit 1 is slow 255 is max acceleration
}
void loop() {
// Sweep servo between min and max stoping in centre to paulse
// Maestro positions are in quarter-microseconds (0.25 µs units)
// Example: 6000 = 1500 µs (center), 4000 = 1000 µs, 8000 = 2000 µs
maestro.setTarget(0, 4000); // Move to 1 ms pulse MIN
delay(waiting_Time);
maestro.setTarget(0, 6000); // Move to 1.5 ms pulse MID
delay(waiting_Time);
maestro.setTarget(0, 8000); // Move to 2 ms pulse MAX
delay(waiting_Time);
maestro.setTarget(0, 6000); // Move to 1.5 ms pulse MID
delay(waiting_Time);
}
The code above moves the servo -45 degrees then to centre then to +45 degrees and back to centre and repeats.
Regards Antony.
The Arduino command you mentioned from the Servo library, myservo.attach(7,500,2400);, is setting the range of the pulse width signal to between 500 and 2400 microseconds. The maestro.setTarget() commands from your Maestro Arduino code specifies the pulse width as the second argument in units of quarter microseconds (the first argument is the channel number). So, to get the same 500-2400 microsecond range your command should look more like this:
maestro.setTarget(0, 2000); // Set target to 2000 quarter microseconds, which is 500ms
delay(waiting_Time);
maestro.setTarget(0, 6000); // Set target to 6000 quarter microseconds, which is 1500ms
delay(waiting_Time);
maestro.setTarget(0, 9600); // Set target to 9600 quarter microseconds, which is 2400ms
delay(waiting_Time);
maestro.setTarget(0, 6000); // Set target to 6000 quarter microseconds, which is 1500ms
delay(waiting_Time);
However, please note that by default the Maestro is configured to restrict the range to the standard 1000-2000ms range. So, to allow for expanded pulse widths, you will need to configure the “Min” and “Max” setting for each channel as desired, which you can do from the “Channel Settings” tab of the Maestro Control Center software.
Hi Brandon.
I just adjusted the Code as you have surjected and it works fine. Also noticed that you can monitor the Arduino servo commands live by using the Pololu Maestro Control Centre. NICE.
Hi Sahlin.
Not quite understanding what you are referring too with. “Try setting Min to 4000 (1000µs) and Max to 8000 (2000µs).”
The min showing in the control centre is 992 as standard and 2000 for Max.
In the Arduino Lib will not accept maestro.setRange(channel, 4000, 8000); Shame…
So Goal scored for you both
Just another Question. In the Doc’s it shows that Mac speed = 127 and Max Acceleration = 255. Am I reading this correct ??
Thank you.
The Maestro will not limit the respective speed or acceleration setting when set to 0. A value of 1 is the slowest they can be set to, and they will get faster as the value rises. The maximum acceleration limit is 255, while the maximum speed limit is 3968. I typically find that a good place to start for each of them is usually in the 10-50 range, depending on your application.