Broken Sensor?

Hey. I just received my 3pi yesterday, got everything set up on my computer (I’m running Ubuntu) and successfully loaded on the example line following program, but when I set up a line for my bot to follow it doesn’t stay on the line and instead veers off to the left most of the time. I’ve also noticed that when I’ve moved my bot over the line I’ve never been able to get the bars on the LCD screen to move over to the right, so I’m guessing I’ve got a faulty sensor… does anyone have any thoughts on what I should do?

Update: Ok so I loaded the demo program back on my 3pi and it seems like the sensors or working fine… as I move the robot over a strip of tape it reads it ok. the line following and maze solving however is still not working and the bot is still veering off to the left and spinning in circles. Both motors function okay as well… does anyone have any ideas?

Hello,

I’m sorry that you are having trouble with your 3pi. Can you confirm that you have read over the instructions given in the line-following section of the User’s Guide? You should first be pressing B to calibrate the 3pi, allowing it to turn its sensors left and right across the line. After calibration, there should be a bar graph of the sensor readings on the screen - do these readings make sense or not?

If you still can’t figure it out, could you try loading one of the precompiled .hex files included with the Pololu library? I want to make sure that there isn’t a problem with your particular choice of compiler. Please let us know if you need help with any of this or if you try everything and you are still stuck!

-Paul

Without everything in front of me I can tell you that I did go through the user guide and first built the example using make and make program from a terminal window I later downloaded and set up Arduino as well as the Arduino compatible version of the line follow code from sec 7b of the users guide and still no luck. It does start up and calibrates when I press the b button. one weird thing I did notice, however is that its giving me a ton of weird output where it should be giving me the battery voltage… I am using brand new AAAs because I didn’t have rechargables.

Mark

Update: I have avr-gcc 4.3.0, Avra 1.2.2 build 94, and AVRDude 5.5 along with the rest that are mentioned in sec 2 of the Pololu AVR C/C++ Library User’s Guide. I can probably upload a video of the bot later today if it would be any help

Hi Mark,

Do you get exactly the same strange behavior with the Arduino program and the C program? Have you tried the precompiled hex files yet? They can be found in the examples/hex-files directory of the Pololu AVR Library distribution.

-Paul

I do still get the same behavior with Arduino. I will try the Hex files today and update with the results

Loaded up the hex (after it took me 20min to figure out the path to my USB port :-/ ) and it worked great! Any idea what I should do to get my compiler working? should I be using a different version?

Thanks!
Mark

Hi Mark,
I have no idea why your compilers wouldn’t be working, especially since Arduino uses a different version (4.3.2, I think) of avr-gcc from the rest of your system. Did you upgrade anything or make any changes that could have possibly caused strange behavior like this? I’ve tested avr-gcc 4.2.2 and 4.3.3, as well as some other versions, and the only problems I have ever seen are small differences in the size of the compiled code caused by different optimization defaults. However, at this point, it might be worthwhile to try a different version.

Another thing you could try is recompiling and reinstalling the Pololu AVR Library from source, and then make absolutely sure that you don’t have any old compiled files lying around (there should only be test.c and Makefile) when you compile the test program. Then, if it still doesn’t work, you could try simplifying it by removing pieces of the program until you get to the shortest possible program that doesn’t work. For example, if the battery voltage is still printing out strange characters, does the following program work?

#include <pololu/3pi.h>

int main()
{
  print_long(5432);
  while(1);
}

Can you find any even simpler demos (e.g. led1) that don’t work? Once you can find the simplest possible thing that doesn’t work with your compiler, it would be interesting if you could make test.o, test.obj, and test.hex, and upload them all along with the Makefile and test.c in a zip/tar file to the forum so that I can take a look at them!

By the way, why did you have to spend 20 minutes looking for your USB port if you were already able to compile and load the other test programs?

-Paul

Sorry I’ve been out of touch. Got busy with some of my other courses (I’m using the 3pi for a final project in a robotics class) I will try out your ideas this week. I am also working on installing avr on my OSX machine to see if I have any more luck with that. It took me a while to find the USB port because I needed the path to enter the path to the port when using avrdude ("…/…/tty01USB" or something). Anyways I will update with my results.

Thanks for all your help so far

Mark

I finally got everything working great, but alas, with windows. Thanks for your help.

Mark