Maestro acting crazy

Hi. I made a humanoid robot using maestro 24, 3 years ago… every thing worked fine till now.
But now when i make a script via control center in auto run and try to launch it without usb connected… my robot goes crazy … all the servos are acting totaly differently than they where programmed to. No matter what script i upload to the board, they always do the same unexpected movement. I have tried on win 10 and linux and got the same problem. Should a hard bootloader be an answer to solve that problem?

Hello.

I am sorry to hear you are having problems with your Maestro servo controller. From your description, it sounds like it is probably a power supply issue (so I would not recommend doing anything with the bootloader or firmware yet). Does it work as expected when you leave it connected to USB? When you power it separately from USB, are you powering both your Maestro and servos from a single power source? If so, could you post details about your power supply and what all it is powering (e.g. how many servos and any other devices)?

Brandon

Hi Brandon, I finaly found the problem… I was working on the script with two diferent set ups. One on linux and one on win10. Seems like the maestro disn’t like that at all. I’ve delete the script and sequences on the win10…then reset the maestro and then did the same on the linux…And ho miracle it works fine now.
However, I still have problems laucnhing the sequence trough the arduino, but I have a few thing to try out. The thing is that the arduino always start the first sequence, no matter what sequence number I set… So, I gess that if I figure out how to fix that I’ll ask for your help again;)
Anyway, thank you so much for the time you’ve spent responding to my post.
Pololu rules them all :wink:

For info… the set up consists of 10 mg996 servos, two tiny servos that i’ve forgot the name, and 12 sg90.
a maestro 24, a step up, an optional arduino nano with gyro when I need to have the feet making a kind of balancing trick, There is also a bluetooth, sd card and radio in the head, for some sounds :slight_smile: it is powered by an pc power supply or two 18650 batterys when I want it to be autonomous. There is also an external arduino mega 2650 conceted to an dfplayer and to the maestro via rx tx. The arduino is controled via ir remote… If think that’s all ;)Ho yes, it all fits in a 65cm tall ball jointed doll, 1/3 scale

I am glad you found the problem and were able to get it working. The script is actually saved on the computer you used to program the Maestro (it doesn’t get loaded from the Maestro directly when you connect it to the Maestro Control Center), so that could explain it.

That sounds like an elaborate project! If you continue to have trouble starting your sequence through Arduino and want help, you can post a copy of your Maestro settings file and your Arduino code, and I would be happy to look into it with you. You can save your Maestro settings file from the “File” drop-down menu of the Maestro Control Center while the controller is connected (using the same computer that you used to program it).

Brandon

Hi Brandon, here are the scripts , first one is arduino mega2650.
So Want I want to do (it worked 2 years ago but I had a D Drive crash and lost a part of my files, including the good scripts… :frowning: )… Wehn I hit button one and play on the arduino ir remote, it is supposed to start the first sequence on the maestro and also the dfplayer random , wehn I hit butto two and play , the second sequence and so on… But What I get is… thta any button I hit, 3 or 5 or anyone, it starts the first sequence.
I hope you can help, 'caus I’m lost…


#include <PololuMaestro.h>

/* On boards with a hardware serial port available for use, use
  that port to communicate with the Maestro. For other boards,
  create a SoftwareSerial object using pin 10 to receive (RX) and
  pin 11 to transmit (TX). */
#ifdef SERIAL_PORT_HARDWARE_OPEN
#define maestroSerial SERIAL_PORT_HARDWARE_OPEN
#else
#include <SoftwareSerial.h>
SoftwareSerial maestroSerial(19, 18);
#endif

/* Next, create a Maestro object using the serial port.
  Uncomment one of MicroMaestro or MiniMaestro below depending
  on which one you have. */
//MicroMaestro maestro(maestroSerial);
MiniMaestro maestro(maestroSerial);


// Include DFPlayer Mp3 library
#include "DFRobotDFPlayerMini.h"

DFRobotDFPlayerMini myDFPlayer;
bool dfMute = false;

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

#include "IRremote.h"

#define receiver 6 // Signal Pin of IR receiver to Arduino Digital Pin 11

/*-----( Declare objects )-----*/
IRrecv irrecv(receiver);     // create instance of 'irrecv'
decode_results results;     // create instance of 'decode_results'

char line[16];
int sequenceID = 0;     // Sequence Index
int prevSequenceID = -1; // Previous Sequence Index
bool runState = false;  // Script Run State
bool prevRunState = true; // Previous Script Run State

/*-----( Function )-----*/
/*

  void translateIR() // takes action based on IR code received

  // describing Remote IR codes
  {
  switch(results.value) {
    case 0xFFA25D: Serial.println("POWER"); break;
    case 0xFFE21D: Serial.println("FUNC/STOP"); break;
    case 0xFF629D: Serial.println("VOL+"); break;
    case 0xFF22DD: Serial.println("FAST BACK");    break;
    case 0xFF02FD: Serial.println("PAUSE");    break;
    case 0xFFC23D: Serial.println("FAST FORWARD");   break;
    case 0xFFE01F: Serial.println("DOWN");    break;
    case 0xFFA857: Serial.println("VOL-");    break;
    case 0xFF906F: Serial.println("UP");    break;
    case 0xFF9867: Serial.println("EQ");    break;
    case 0xFFB04F: Serial.println("ST/REPT");    break;
    case 0xFF6897: Serial.println("0");    break;
    case 0xFF30CF: Serial.println("1");    break;
    case 0xFF18E7: Serial.println("2");    break;
    case 0xFF7A85: Serial.println("3");    break;
    case 0xFF10EF: Serial.println("4");    break;
    case 0xFF38C7: Serial.println("5");    break;
    case 0xFF5AA5: Serial.println("6");    break;
    case 0xFF42BD: Serial.println("7");    break;
    case 0xFF4AB5: Serial.println("8");    break;
    case 0xFF52AD: Serial.println("9");    break;
    case 0xFFFFFFFF: Serial.println(" REPEAT");break;
    default: Serial.println(" other button   ");
  }// End Case

  delay(500); // Do not get immediate repeat
  } //END translateIR
*/

void setup() {

  Serial.begin(115200);
  // Setup DFPlayer
  Serial2.begin(9600);
  if (!myDFPlayer.begin(Serial2)) {
    Serial.println(F("Unable to begin:"));
    Serial.println(F("1.Please recheck the connection!"));
    Serial.println(F("2.Please insert the SD card!"));
  }

  myDFPlayer.volume(10);
  myDFPlayer.EQ(DFPLAYER_EQ_NORMAL);
  myDFPlayer.outputDevice(DFPLAYER_DEVICE_SD);
  myDFPlayer.play(1);

  // Setup Maestro
  maestroSerial.begin(9600);
  maestro.stopScript(); // In case a script was running while stating

  // Setup LCD
  lcd.begin(16, 2); // set up the LCD's number of columns and rows:

  lcd.print("Felicya control ");
  lcd.print("v1.0 Ready!     ");
  delay(3000);
  lcd.clear();

  // Setup IR
  irrecv.enableIRIn(); // Start the IR receiver
}

void loop() {
  if (irrecv.decode(&results)) // have we received an IR signal?
  {
    switch (results.value) {
      case 0xFF6897: sequenceID = 0; break;
      case 0xFF30CF: sequenceID = 1; break;
      case 0xFF18E7: sequenceID = 2; break;
      case 0xFF7A85: sequenceID = 3; break;
      case 0xFF10EF: sequenceID = 4; break;
      case 0xFF38C7: sequenceID = 5; break;
      case 0xFF5AA5: sequenceID = 6; break;
      case 0xFF42BD: sequenceID = 7; break;
      case 0xFF4AB5: sequenceID = 8; break;
      case 0xFF52AD: sequenceID = 9; break;
      case 0xFF02FD: // PLAY/PAUSE
        if ( runState ) {
          maestro.stopScript();
          runState = false;
        } else {
          maestro.restartScript(sequenceID);
          int M = sequenceID * 6 + random(6)+2 ;
          Serial.println(M, DEC);
          runState = true;
          delay(1100);
          myDFPlayer.play(M);
         
        }
        break;
      default: // Unknown / Unused code
        break;
    }
    irrecv.resume(); // receive the next value
  }
  if ( sequenceID != prevSequenceID ) {
    if ( ! runState ) {
      sprintf(line, "Sequence: %1d     ", sequenceID);
      lcd.setCursor(0, 1);
      lcd.print(line);
      prevSequenceID = sequenceID;
    } else {
      sequenceID = prevSequenceID;
    }
  }
  if ( runState != prevRunState ) {
    prevRunState = runState;
    lcd.setCursor(0, 0);
    if ( runState ) {
      lcd.print("Running:        ");
    }
    else {
      lcd.print("Select:         ");
    }
  }
  delay(100);
}

And the maestro code , I only made two sequences for the test, I’ll make the other sequences later, when everything is working fine.

<!--Pololu Maestro servo controller settings file, http://www.pololu.com/catalog/product/1350-->
<UscSettings version="1">
  <NeverSuspend>false</NeverSuspend>
  <SerialMode>UART_FIXED_BAUD_RATE</SerialMode>
  <FixedBaudRate>9600</FixedBaudRate>
  <SerialTimeout>0</SerialTimeout>
  <EnableCrc>false</EnableCrc>
  <SerialDeviceNumber>12</SerialDeviceNumber>
  <SerialMiniSscOffset>0</SerialMiniSscOffset>
  <EnablePullups>false</EnablePullups>
  <Channels MiniMaestroServoPeriod="80000" ServoMultiplier="1">
    <!--Period = 20 ms-->
    <!--Channel 0-->
    <Channel name="tetetrourne" mode="Servo" min="3968" max="10432" homemode="Off" home="3968" speed="100" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 1-->
    <Channel name="tetepenchedroite" mode="Servo" min="3584" max="6720" homemode="Off" home="3584" speed="100" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 2-->
    <Channel name="tetepenchegauche" mode="Servo" min="5824" max="8832" homemode="Off" home="5824" speed="100" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 3-->
    <Channel name="epauledroite" mode="Servo" min="2432" max="9984" homemode="Off" home="2432" speed="100" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 4-->
    <Channel name="avbrasdroit" mode="Servo" min="3968" max="7616" homemode="Off" home="3968" speed="100" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 5-->
    <Channel name="tournebrasdroit" mode="Servo" min="5888" max="9984" homemode="Off" home="5888" speed="100" acceleration="0" neutral="5888" range="1905" />
    <!--Channel 6-->
    <Channel name="pliebrasdroit" mode="Servo" min="3968" max="9984" homemode="Off" home="3968" speed="100" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 7-->
    <Channel name="epaulegauche" mode="Servo" min="3968" max="12800" homemode="Off" home="3968" speed="100" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 8-->
    <Channel name="avbrasgauche" mode="Servo" min="2816" max="6400" homemode="Off" home="2816" speed="100" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 9-->
    <Channel name="tournebrasgauche" mode="Servo" min="2176" max="6016" homemode="Off" home="2176" speed="100" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 10-->
    <Channel name="pliebras gauche" mode="Servo" min="1984" max="7616" homemode="Off" home="1984" speed="100" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 11-->
    <Channel name="ventre" mode="Servo" min="2816" max="4032" homemode="Off" home="2816" speed="25" acceleration="0" neutral="3584" range="1905" />
    <!--Channel 12-->
    <Channel name="hanchedroite" mode="Servo" min="5184" max="6400" homemode="Off" home="5184" speed="50" acceleration="0" neutral="6400" range="1905" />
    <!--Channel 13-->
    <Channel name="jambedroite" mode="Servo" min="1984" max="6016" homemode="Off" home="1984" speed="100" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 14-->
    <Channel name="genoudroit" mode="Servo" min="1984" max="5376" homemode="Off" home="1984" speed="100" acceleration="0" neutral="5376" range="1905" />
    <!--Channel 15-->
    <Channel name="chevillegauche" mode="Servo" min="6016" max="7232" homemode="Off" home="6016" speed="25" acceleration="0" neutral="6016" range="1905" />
    <!--Channel 16-->
    <Channel name="jambegauche" mode="Servo" min="4224" max="7616" homemode="Off" home="4224" speed="100" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 17-->
    <Channel name="hanchegauche" mode="Servo" min="3968" max="5184" homemode="Off" home="3968" speed="50" acceleration="0" neutral="5184" range="1905" />
    <!--Channel 18-->
    <Channel name="genougauch" mode="Servo" min="7232" max="9984" homemode="Off" home="7232" speed="100" acceleration="0" neutral="7232" range="1905" />
    <!--Channel 19-->
    <Channel name="pieddroit" mode="Servo" min="3968" max="6400" homemode="Off" home="3968" speed="25" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 20-->
    <Channel name="chevilledroit" mode="Servo" min="3776" max="8000" homemode="Off" home="3776" speed="25" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 21-->
    <Channel name="piedgauche" mode="Servo" min="1152" max="3200" homemode="Off" home="1152" speed="25" acceleration="0" neutral="1152" range="1905" />
    <!--Channel 22-->
    <Channel name="maingauche" mode="Servo" min="3968" max="8000" homemode="Off" home="3968" speed="152" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 23-->
    <Channel name="maindroie" mode="Servo" min="3968" max="8000" homemode="Off" home="3968" speed="152" acceleration="0" neutral="6000" range="1905" />
  </Channels>
  <Sequences>
    <Sequence name="hellotest">
      <Frame name="Frame 0" duration="500">6802 5396 5824 8715 7137 7499 8800 4402 3124 2585 6738 3414 5841 2314 2484 6903 7616 4675 9769 5114 4814 1999 8000 8000</Frame>
      <Frame name="Frame 1" duration="500">6802 5396 5824 7910 7137 9614 9984 4402 3124 2585 6738 3414 5841 2314 2484 6903 7616 4675 9769 5114 4814 1999 8000 4695</Frame>
      <Frame name="Frame 2" duration="500">6802 6205 5824 7910 7137 8322 9984 4402 3124 2585 6738 2816 5841 2314 2484 6903 7616 4675 9769 5114 4814 1999 8000 7289</Frame>
      <Frame name="Frame 1" duration="500">6802 5396 5824 7910 7137 9614 9984 4402 3124 2585 6738 3414 5841 2314 2484 6903 7616 4675 9769 5114 4814 1999 8000 4695</Frame>
      <Frame name="Frame 2" duration="500">6802 6205 5824 7910 7137 8322 9984 4402 3124 2585 6738 2816 5841 2314 2484 6903 7616 4675 9769 5114 4814 1999 8000 7289</Frame>
      <Frame name="Frame 1" duration="500">6802 5396 5824 7910 7137 9614 9984 4402 3124 2585 6738 3414 5841 2314 2484 6903 7616 4675 9769 5114 4814 1999 8000 4695</Frame>
      <Frame name="Frame 2" duration="500">6802 6205 5824 7910 7137 8322 9984 4402 3124 2585 6738 2816 5841 2314 2484 6903 7616 4675 9769 5114 4814 1999 8000 7289</Frame>
      <Frame name="Frame 1" duration="500">6802 5396 5824 7910 7137 9614 9984 4402 3124 2585 6738 3414 5841 2314 2484 6903 7616 4675 9769 5114 4814 1999 8000 4695</Frame>
      <Frame name="Frame 2" duration="500">6802 6205 5824 7910 7137 8322 9984 4402 3124 2585 6738 2816 5841 2314 2484 6903 7616 4675 9769 5114 4814 1999 8000 7289</Frame>
    </Sequence>
    <Sequence name="lefthnd">
      <Frame name="Frame 0" duration="500">6802 6205 5824 7910 7137 8322 9984 4402 3124 2585 6738 2816 5841 2314 2484 6903 7616 4675 9769 5114 4814 1999 8000 7289</Frame>
      <Frame name="Frame 1" duration="500">8392 6205 6847 9241 6479 8322 7148 9288 3124 2585 5607 2816 5841 2314 2484 6903 7616 4675 9769 5114 4814 1999 4100 7289</Frame>
      <Frame name="Frame 2" duration="500">7120 6205 6847 9241 6479 8322 7148 3968 3873 2176 2999 3747 5841 2314 2484 6903 7616 4675 9769 5114 4814 1999 4100 7289</Frame>
    </Sequence>
  </Sequences>
  <Script ScriptDone="false">

### Sequence subroutines: ###
# hellotest
sub sequ1
  500 6802 5396 5824 8715 7137 7499 
  8800 4402 3124 2585 6738 3414 
  5841 2314 2484 6903 7616 4675 
  9769 5114 4814 1999 8000 8000 frame_0..23 # Frame 0
  500 7910 9614 9984 4695 frame_3_5_6_23 # Frame 1
  500 6205 8322 2816 7289 frame_1_5_11_23 # Frame 2
  500 5396 9614 3414 4695 frame_1_5_11_23 # Frame 1
  500 6205 8322 2816 7289 frame_1_5_11_23 # Frame 2
  500 5396 9614 3414 4695 frame_1_5_11_23 # Frame 1
  500 6205 8322 2816 7289 frame_1_5_11_23 # Frame 2
  500 5396 9614 3414 4695 frame_1_5_11_23 # Frame 1
  500 6205 8322 2816 7289 frame_1_5_11_23 # Frame 2
  quit
# lefthnd
sub sequ2
  500 6802 6205 5824 7910 7137 8322 
  9984 4402 3124 2585 6738 2816 
  5841 2314 2484 6903 7616 4675 
  9769 5114 4814 1999 8000 7289 frame_0..23 # Frame 0
  500 8392 6847 9241 6479 7148 9288 
  5607 4100 frame_0_2..4_6_7_10_22 # Frame 1
  500 7120 3968 3873 2176 2999 3747 frame_0_7..11 # Frame 2
 quit
sub frame_0..23
  23 servo
  22 servo
  21 servo
  20 servo
  19 servo
  18 servo
  17 servo
  16 servo
  15 servo
  14 servo
  13 servo
  12 servo
  11 servo
  10 servo
  9 servo
  8 servo
  7 servo
  6 servo
  5 servo
  4 servo
  3 servo
  2 servo
  1 servo
  0 servo
  delay
  return

sub frame_3_5_6_23
  23 servo
  6 servo
  5 servo
  3 servo
  delay
  return

sub frame_1_5_11_23
  23 servo
  11 servo
  5 servo
  1 servo
  delay
  return

sub frame_0_2..4_6_7_10_22
  22 servo
  10 servo
  7 servo
  6 servo
  4 servo
  3 servo
  2 servo
  0 servo
  delay
  return

sub frame_0_7..11
  11 servo
  10 servo
  9 servo
  8 servo
  7 servo
  0 servo
  delay
  return
</Script>
</UscSettings>

Here are some pics of my robot

279527717_985226265461190_6973493999531070485_n
279515615_959496887976545_6714314676611147729_n

Neat project! I am sorry to hear about your harddrive crash; your current animatronic looks a little different than the one you posted about a few years ago now, but in case it helps, I noticed that you posted a copy of your old Maestro script and Arduino sketch in this post (which was a couple months after you shared your original animatronic).

It looks like your current Maestro script currently only has 2 subroutines that can be started using the restart script at subroutine command (i.e. restartScript() in the Maestro library) without problems, and those are sequ1 and sequ2. Since those are the first and second subroutine in your sketch, their IDs are 0 and 1 respectively, and I would expect sending the restartScript() command with an argument other than 0 or 1 to result in an error (indicated by the red LED on the Maestro and in the “Errors” tab of the Maestro Control Center). I do not see anything else particularly concerning in your Maestro settings.

Your Arduino sketch has a lot going on, but I did not notice anything obviously wrong. If it always runs sequ1 when you try to press play, it might be something with the switch case statement that is not working correctly to update sequenceID when you press the other buttons (especially since sequenceID is set to 0 when it is defined). It looks like you are using some kind of LCD, and printing out the sequenceID variable when it changes; is that updating as you expect when you press the other buttons on your IR remote? You might try also printing it out just before maestro.restartScript(sequenceID); too, so you can see exactly what value is being used.

If that does not help narrow it down, I recommend trying a much simpler test that just sends the restartScript() command followed by a delay in a loop that switches between calling sequ1 and sequ2. For example:

void loop(){
    maestro.restartScript(0);
    delay(5000); 
    maestro.restartScript(1);
    delay(5000); 
}

Brandon

Hi… again… sorry :frowning:
So… I hadded mores sequances, just to be sure. I test your void suggestion

void loop(){
    maestro.restartScript(0);
    delay(5000); 
    maestro.restartScript(1);
    delay(5000); 
}

And, it still plays only the first sequence.
I have double checked the ir remote and it prints 3 <when I press 3 , etc…
I also compared the old version of arduino script (the link you gave me for my old version) and the version I had… they are exactly the same…
I don’t know what to think
Could it be a kind of bad contact on the ground pin on the arduino ? But since it starts a sequence it should work anyway.
Honestly, I don’t understand at all.
Sorry to take so much of your time.

It is strange that running the simple loop I suggested still only plays the first subroutine. Could you try connecting your Maestro to the Maestro Control Center and unchecking the “Run script on startup” option in the Script tab (making sure to press the “Apply settings” button), and then try running that simple sketch I suggested again to see how it behaves?

Brandon

Hi brandon, I tryied that and it simply does nothing at all.
So far, this is what happen when I run my “normal” scripts:
Wehn I launch my seqence on the arduino, the maestro flsahes red led 3 times then flash yellow and run s the first sequence .
I need to push the play pause button again on the arduino to stop the sequence and beiing bale to select anoteher sequence, but xhaen I do that, the maestro start the sequence again.
Another bug is that the arduino doesn’t launch the mp3 file on the dfplayer…
So, my gess is that the problem comes form the arduino and not the maestro or the script.
What I will do is remove the arduino and rebuilding the hardware completly on a new arduino and see what happens, sounds to me that somewhere the arduibo is acting strange because of a bad compnent or connection, something must be make an electrical bug somewhere.
But fisrt pof all I am gonna try with a new connection wire between the maestro and arduino, that’s the onlfy thing I have tryied.
What do you think?
Hope you had a good we end :slight_smile:

HI again, I change the cable for the rx tx transimission, it didn’t help.
THe re is another little annoying tihng ,this time on the meastrp control center on linux, there are thoes pop up " use this slider to adjust…) always comming on and I can’t get rid of them. they come all over the screen… A bug in the linux version?

Ho ! It works!
Hum well, I think you are gonna willing to hit mae for being so stupid…
THe thing is taht when I first tryeid my scripts htere was a error, so I tryied multiple ways to power up the maestro, ending up thinking that it will be powered by teh arduino because it runned the sequence…
What I did was just powering the servos (not the marestro) then powere’d the arduino.
But what workes is : Powering up the servos AND the maestro then only powering the arduino.
So now everything is fine for teh sequences.
I just need to check the df player. and thos annoying pop ups on the control center
What was misleading me was the fact to the maestro launched weh it was only powered by the arduino…
It told you I was stupid lol
Thank you soooooooooooooooooooooooooooooo much for all your kind help, I will send you a video of the project working.
Just tell your boss you deserve a raise!

I am glad to hear you figured it out and got it working, and thank you for your kind words!

As far as the problem with the pop ups filling the screen in Linux, we were able to reproduce the issue here and have updated the Linux version of the Maestro software to fix it. You can use the download link in the Installing Linux Drivers and Software section of the Maestro user’s guide to get the newly updated version. Thank you for pointing that out to us!

Brandon

Thanks the problem is also solved on the control center on linux… really fast!
Now I gess ity’s time for some sequences coding.
And next year I’ll make a new version of the bot.
Have a nice day and thx again :slight_smile:

1 Like