[Solved] Line follower Calibration Returns (-1, -1, -1, -1, -1)


I tried to use the Line follower calibration for the GoPiGo, but all I get in the background terminal window are never-ending lists of (-1, -1, -1, -1, -1), and I have to close the application each time. This happens whether I press the “Set Black Line Values” button, the “Set White Line Values” button, or the “Read Line Position” button. The line follower is connected to the I2C port, and I just had the GoPiGo recently updated. The red LED on the line follower blinks fine, and the green LED is working. All of the parts for the GoPiGo were recently purchased, including the Servo, Raspberry Pi 3 Model B. and the Line follower. Is there anything I could do to fix this problem?

[SOLVED] GoPiGo2 line follower not working (returns -1,-1,-1,-1,-1)

Hi @folke002,

Thank you for explaining your situation. Let’s see what we can do about it.

Before following the next suggestions, please make sure you have:

  • Connected the Grove Line Follower sensor to the right port (I2C port).

  • Running the latest Raspbian for Robots image.

From your Raspberry Pi, please open a terminal and enter the following commands:

cd ~/Desktop/GoPiGo/Software/Python/line_follower
sudo python check_line_sensor.py

After you do this, please post here a screenshot of what the console’s output.

Thank you!


Here’s my screenshot of the output:

Edit: And this is after I had to escape the lull:


Sorry for double post but here’s an update:

For line_sensor.py, I changed a line of code (from “address = 0x06” to “address= 0x08”) to help connect the line follower to the GoPiGo, and I ran the check_line_sensor.py program. Here are the results I got:

On each of the sensors, I’ve got 65535 out of 1023, which is too high a value and could be interpreted as -1 in binary (65535 = 1111111111111111 in binary form).

And here’s the results after trying to run the check_line_sensor.py program a second time:


Hi @folke002,

Line follower's sensor address is 0x06, whilst the GoPiGo's address is 0x08.
So, changing the addresses is not going to do anything good.

The good thing is that the line follower sensor is detected.
The bad thing is that nothing is displayed after the "Line sensor found" message when running the check_line_sensor.py - this is caused by the fact that the line sensor only returns a bunch of -1 values.

I’m going to run some tests and see where is the issue.
Then, I’ll come back with a reply to you.

Thank you!



It seems we have an issue with the line follower sensor at the moment.
We are working on solving the issue ASAP.

Until then, can you use the April 2017 image of Raspbian for Robots ?
It should work on your GoPiGo. Please try it out and see if it works.
Here’s a link to it:

Also, please don’t update the image with DI Update as it will make the line follower sensor unuseable.


Hey @folke002 after a little bit of troubleshooting, we think something in the Raspberry Pi Firmware updates may be preventing the firmware from properly reading a few functions. Since that’s controlled by the foundation, we’ll file a bug report to try to get it cleared up.

In the meantime, you may be able to repair everything without burning a new image (I think). You can roll back your firmware version to something working by running this command in the command line:

sudo rpi-update 52241088c1da59a359110d39c1875cda56496764

I would DEFINITELY copy paste as that 40 digit number is pretty hard to get right. Can you give it a shot and let us know if it works?


Quick update: yesterday I submitted a change to the update code that should do this automatically for you. You should now be able to run the update from the desktop with no need to run the command line. Can you give it a shot and let us know?


Yes, I ran the update and the line follower works perfectly. Thank you. :grin: