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

Pololu Forum

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.

You need a *.cpp and a *.h file. In ZumoExamples directory has no such files. Even you copy it to Arduino libraries directory. You will not be able to see File>Examples>ZumoExamples>………You need to create a dummy ZumoExamples.h and a dummyZumoExample.cpp so that Arduino sees it as a valid library directtory. After that you will see it under Examples.

Hello, Cookie.

Thank you for pointing out that solution. We are working on making a new version of the Pololu Zumo Shield Arduino library that will be in the library manager and not have these problems.


yHi Derrill, I have an old zumo (1.0?). After retirement, I finally have time to play around. I tried several examples without any problems. The line follower worked perfectly. However, I have problems with the maze solver example. It has no problem in following the line doing the left turn. But when it sees the right turn. It turns the right and does the right spinning and keep spining. I tried modifing the speed and turn speed parameters. The problem continues. Would you able to help me in finding a solution? Thanks!

If you have not made any changes to the maze solver example (and your Zumo works fine with the line follower example), it seems you might have some other problem. I suggest looking for sources of light contamination (e.g. proximity to either natural or fluorescent light sources). If you find a likely source of contamination, you might try moving the course, turning off the light or possibly create a light shield using something like electrical tape. Does this happen at every right turn in the course?


I didn’t make any change to the code. Yes, it happend every time when doing a right turn. . I think the light is ok because I also have tried my 3pi with its maze solver (luckly I have one in a box). It has no problem in doing right or left turn. Has this happened to anyone?

There might be differences in how the 3pi and Zumo are affected by lighting and the course material, so that does not rule out light contamination. I suggest testing the Zumo at different corners of the maze and try shutting down other light sources or moving the maze to verify that is not the case.

Additionally, you might try reducing the turn speed to see if that helps.

You could also try the “QTRRCRawValuesExample” in the Arduino library to see if all of your sensors are showing values indicating the sensor array is working properly or not.


I was thinking the same thing - a malfunctioned sensor array. I tried both QTRAExample and QTRARawValuesExample. It looks like sensor 1 (the 2nd sensor from left) is dead. Without coverning any sensors, there is a value on it in both programs while other columns are zero. If I cover this sensor with a black tape, the value will not change while the values on other sensors change if I cover them with black tape. Would you please confirm my finding? Thanks!

Hi Derrill, further testing of the sensors, I have found sensor A2 is dead. I understand from page 23 of the user guide, the maze solver can use 4 sensors 4, 11, A0 and 5. It further stated that “To configure the ZumoReflectanceSensorArray library to use this new configuration, call init with these arguments:
byte pins[] = {4, 11, A0, 5};
reflectanceSensors.init(pins, 4);

I replaced reflectanceSensors.init() with these two lines in maze solver setup(). Unfortunately, zumo just keeps doing the left spinning during the calibration stage. By the way, I didn’t cut the traces for A2 and A5. I assumed they will not be used after my declaration in setup().

Did I do anything wrong? Would you please help me to make it work?


The maze solver code pretty much relies on there being 6 sensors and some parts of the code check individual specific sensors (like the 2nd from the left, or the 6th or rightmost one); it might be possible to rewrite it to use fewer sensors but it would take more than just changing the init line.

Can you post some pictures of your soldering on the array and where the female header for the array is attached to the shield?


As shown in photo 2, I have soldered pins for RC control. It looks ugly because I tried to desolder and bend it after found out that there are not enough room for receiver connectors if I put the zumo blade back. Nevertheless, it worked. As shown on photo 3, after identifying problem on A2 , I have soldered It to ensure the trace is not broken.

By the way, I have tested the female header A2 on the shield Using a keyes 033 ir sensor with analogRead. It showed the value chaneged when detecting a black line. It shows the female header on the shield is ok. The problem is on the array side.


Thanks for the pictures. If you send your order information to support@pololu.com, we will see what we can do to help you get a replacement sensor array.