Hi,
recently I just bought Mini Maestro24 to use with my Arduino Mega2560 to control multiple servo. I am wondering if the function SelectMultipleTargets is applicable for arduino and do you have any sample for that?
Daniel
Hi,
recently I just bought Mini Maestro24 to use with my Arduino Mega2560 to control multiple servo. I am wondering if the function SelectMultipleTargets is applicable for arduino and do you have any sample for that?
Daniel
Hello, Daniel.
It sounds like you are asking about using the Set Multiple Targets command (which is described in the “Serial Servo Commands” section of the Maestro user’s guide) with an Arduino. Is that correct? If so, you should be able to use that command by calling the setMultiTarget
function provided by our Maestro library for Arduino.
- Patrick
Thanks Patrick. I manage to get SetMultiTarget to work but I run into the same issue as this guy.
Sometimes the servos will go to the desired position and jitter and sometime just jerk but cannot go to the desired position.
let me explain how I wiring my Mini Maestro ,Mega2560 and Servo.
#include <PololuMaestro.h>
#include <SoftwareSerial.h>
SoftwareSerial maestroSerial(10, 11);
uint16_t BeginArray[]={4000,4000,4000,4000};
uint16_t EndArray[]={7000,7000,7000,7000};
//MicroMaestro maestro(maestroSerial);
MiniMaestro maestro(maestroSerial);
void setup()
{
pinMode(10,INPUT); //set rx (or pin 0) as input
pinMode(11, OUTPUT); //set tx (or pin 1) as output
maestroSerial.begin(115200);
maestro.setSpeed(0, 100);
maestro.setAcceleration(0,60);
maestro.setSpeed(1, 100);
maestro.setAcceleration(1,60);
maestro.setSpeed(2, 100);
maestro.setAcceleration(2,60);
maestro.setSpeed(3, 100);
maestro.setAcceleration(3,60);
}
void loop()
{
maestro.setMultiTarget(4,0,BeginArray);
delay(4000);
maestro.setMultiTarget(4,0,EndArray);
delay(4000);
}
Hi,
For more information. if I change the code to move servo 1 by 1 all servos work properly. here is my new code. Any idea?
#include <PololuMaestro.h>
#include <SoftwareSerial.h>
SoftwareSerial maestroSerial(10, 11);
uint16_t BeginArray[]={4000,4000,4000,4000};
uint16_t EndArray[]={7000,7000,7000,7000};
//MicroMaestro maestro(maestroSerial);
MiniMaestro maestro(maestroSerial);
int pos =0;
void setup()
{
pinMode(10,INPUT); //set rx (or pin 0) as input
pinMode(11, OUTPUT); //set tx (or pin 1) as output
maestroSerial.begin(115200);
maestro.setSpeed(0, 100);
maestro.setAcceleration(0,60);
maestro.setSpeed(1, 100);
maestro.setAcceleration(1,60);
maestro.setSpeed(2, 100);
maestro.setAcceleration(2,60);
maestro.setSpeed(3, 100);
maestro.setAcceleration(3,60);
}
void loop()
{
/*maestro.setMultiTarget(4,0,BeginArray);
delay(4000);
maestro.setMultiTarget(4,0,EndArray);
delay(4000);
*/
pos=4000;
maestro.setTarget(0,pos);
delay(400);
maestro.setTarget(1,pos);
delay(400);
maestro.setTarget(2,pos);
delay(400);
maestro.setTarget(3,pos);
delay(4000);
pos=7000;
maestro.setTarget(0,pos);
delay(400);
maestro.setTarget(1,pos);
delay(400);
maestro.setTarget(2,pos);
delay(400);
maestro.setTarget(3,pos);
delay(4000);
}
This sounds like a power supply issue since each servo seems to be working when there is a 400 ms delay between their movements, but will not work when you try to move them all at the same time. To confirm that, can you try your program that uses setMultiTarget
with only one servo connected?
- Patrick
it work almost perfect with setMultiTarget with only 1 servo attach. but sometime it still jitters a little bit. Say 1-2 minute once.
Daniel
Can you post more information about the power supply and servos you are using, such as datasheets or links to where you got them? I also suggest you try monitoring your system with an oscilloscope so you look at what is going on. If you have a power supply that can handle more current, can you test it out?
- Patrick