Pololu Robotics & Electronics
My account Comments or questions? About Pololu Contact Ordering information Distributors

Unable to load zumo-shield-master to libraries


Win 10 Arduino 1.6.9

after downloading zumo-shield-master and changing name to zum-shield I have as yet been able to load the library. Everything I’ve tried says the file is not a valid library. If anyone can provide step by step procedures for install I would much appreciate it.
One set of docs I have says to import the library, I have no such"import" function to use.
Ihave tried to load the folder, the zip and files separately. No go.



You should move the Pushbutton, QTRSensors, ZumoBuzzer, ZumoExamples, ZumoMotors, and ZumoReflectanceSensorArray folders into the “libraries” directory, not into a sub-folder labeled “zum-shield”.

Please note you should restart the Arduino environment to refresh it so the Zumo Shield libraries and their examples will show up.

If changing that does not help, can you post a screen capture of the directory you have them in?



hello, I had the same problem, and now this reply helped me, too, but only after having done the following: I had to open the folder “ZumoExamples” and copy the subfolders to the “Libraries” folder (subfolders Compass, linefollower, etc.) or it would keep telling “invalid library”.
So I’ve been able to have no Invalid Library messages anymore, and to load the program to Arduino UNO R3.
I loaded the firmware by clicking on the Arduino file LineFollower, and this has added also all the other libraries to the sketch. Is this right? quite doubtful.
Result: the Zumo seems to be programmed, it starts searching for the black line by sweeping right and left in an apparently correct way, but then it stops, as if it didn’t find any line (the black line is within its range on a white surface).
What am I doing wrong?
Thank you in advance for your suggestion
Francesco (a pure beginner)

and this is the sketch I’ve got:

 * Demo line-following code for the Pololu Zumo Robot
 * This code will follow a black line on a white background, using a
 * PID-based algorithm.  It works decently on courses with smooth, 6"
 * radius curves and has been tested with Zumos using 30:1 HP and
 * 75:1 HP motors.  Modifications might be required for it to work
 * well on different courses or with different motors.
 * http://www.pololu.com/catalog/product/2506
 * http://www.pololu.com
 * http://forum.pololu.com

#include <QTRSensors.h>
#include <ZumoReflectanceSensorArray.h>
#include <ZumoMotors.h>
#include <ZumoBuzzer.h>
#include <Pushbutton.h>

ZumoBuzzer buzzer;
ZumoReflectanceSensorArray reflectanceSensors;
ZumoMotors motors;
Pushbutton button(ZUMO_BUTTON);
int lastError = 0;

// This is the maximum speed the motors will be allowed to turn.
// (400 lets the motors go at top speed; decrease to impose a speed limit)
const int MAX_SPEED = 400;

void setup()
  // Play a little welcome song

  // Initialize the reflectance sensors module

  // Wait for the user button to be pressed and released

  // Turn on LED to indicate we are in calibration mode
  pinMode(13, OUTPUT);
  digitalWrite(13, HIGH);

  // Wait 1 second and then begin automatic sensor calibration
  // by rotating in place to sweep the sensors over the line
  int i;
  for(i = 0; i < 80; i++)
    if ((i > 10 && i <= 30) || (i > 50 && i <= 70))
      motors.setSpeeds(-200, 200);
      motors.setSpeeds(200, -200);

    // Since our counter runs to 80, the total delay will be
    // 80*20 = 1600 ms.

  // Turn off LED to indicate we are through with calibration
  digitalWrite(13, LOW);

  // Wait for the user button to be pressed and released

  // Play music and wait for it to finish before we start driving.
  buzzer.play("L16 cdegreg4");

void loop()
  unsigned int sensors[6];

  // Get the position of the line.  Note that we *must* provide the "sensors"
  // argument to readLine() here, even though we are not interested in the
  // individual sensor readings
  int position = reflectanceSensors.readLine(sensors);

  // Our "error" is how far we are away from the center of the line, which
  // corresponds to position 2500.
  int error = position - 2500;

  // Get motor speed difference using proportional and derivative PID terms
  // (the integral term is generally not very useful for line following).
  // Here we are using a proportional constant of 1/4 and a derivative
  // constant of 6, which should work decently for many Zumo motor choices.
  // You probably want to use trial and error to tune these constants for
  // your particular Zumo and line course.
  int speedDifference = error / 4 + 6 * (error - lastError);

  lastError = error;

  // Get individual motor speeds.  The sign of speedDifference
  // determines if the robot turns left or right.
  int m1Speed = MAX_SPEED + speedDifference;
  int m2Speed = MAX_SPEED - speedDifference;

  // Here we constrain our motor speeds to be between 0 and MAX_SPEED.
  // Generally speaking, one motor will always be turning at MAX_SPEED
  // and the other will be at MAX_SPEED-|speedDifference| if that is positive,
  // else it will be stationary.  For some applications, you might want to
  // allow the motor speed to go negative so that it can spin in reverse.
  if (m1Speed < 0)
    m1Speed = 0;
  if (m2Speed < 0)
    m2Speed = 0;
  if (m1Speed > MAX_SPEED)
    m1Speed = MAX_SPEED;
  if (m2Speed > MAX_SPEED)
    m2Speed = MAX_SPEED;

  motors.setSpeeds(m1Speed, m2Speed);


Hello, francesco.

The #include statement signals the Arduino environment to link the specified library’s code when the sketch is compiled or uploaded, so yes, the code for the libraries included in the Zumo LineFollower sketch will be uploaded to the Arduino board.

With regards to your problem, it sounds like you did not press the user button a second time after the Zumo finished calibrating its sensors. I strongly recommend reading the comments in the LineFollower sketch to get a better understanding of how the example works.

By the way, for those who are following this discussion, I just want to add to Derrill’s post that the installation instructions for the Zumo Shield libraries can be found under the “Software” section under the “Getting Started” header on its GitHub page.

- Amanda


I am also having this same issue. Using a Zumo Prebuilt v1.2, and Arduino software v1.8.2 . My It worked once, I was getting library errors, tried to fix them, does not work now. Push the button once, it calibrates fine. Push it again, it plays the charge song, and then just sits there, no motion. Even after more button presses.

I did not change the program in any way. I did get some library errors, and I do not know how to fix those either. Below are a snip of the error and my library. If I fix those errors, will it work then? If so how?

Thanks. Appreciate the help!

l/2X/f/f241f0c546309cb16879b3e287a531812918c887.PNG" width=“597” height=“499”>



Thank you for posting that screen capture. From the screen capture it does not look like you have the Zumo libraries installed in the correct directory. My post above describes the correct directory to install those libraries.

Your other issue seems to be related to your batteries. It sounds like everything seems to be working up to the point that your motors should start, then everything stops. If that is the case, your batteries are probably dead and need to be either replaced or recharged. When batteries are close to discharged, you will get a significant voltage drop when you try to draw a large amount of current (like when your motors try to run). This can cause the voltage to drop to the point your Arduino stops working or resets. Can you try replacing or recharging those batteries and see if that helps?

If you try correcting your library installation and are still getting those errors, can you post a screen capture showing the directory you have your libraries installed in?



Thanks Derrill, but when I give it to one of my students, with the same libraries installed on their computer, and run the linefollowing sketch from the zumo examples folder, it works fine, but not on mine so I know the batteries are fine. I swapped them just in case, but to no avail; it still performs the sweep to calibrate, and when I push the button again to make it follow the line, I get nothing!

My libraries look just like theirs too! Downloaded from the same place… I put them here as directed, annd still nothing… Hmmm…


Thank you for the screenshots. I talked to some other people here and the invalid library messages you get at the end of uploading are not really errors and should not stop you from uploading programs. They have to do with updates that Arduino made to its library structure a few years ago that our older libraries have not been updated to follow. So, I no longer suspect this is a library issue.

Can you tell me what version if the IDE your student was running when they uploaded that example? If it is an order version of the IDE, can you try installing the same version on your system to see if that works?

Can you think of any other differences that there might be between how you tested and how your student tested that example (e.g. different course or conditions)?



Sorry Derrill… Same IDE, and I cannot put my finger on it. Has to be something with my computer.

Thanks for getting back to me! I will work with it this summer and see what I can do.