3pi is powered off during initialising to run maze solver


I tried to load the maze solving in example library to 3pi. The compilation to hex file is OK, transfering to 3pi is OK.

Getting isp parameter.. SD=0x03 .. OKOK
Reading FLASH input file.. OK
Entering programming mode.. OK!
Erasing device.. OK!
Programming FLASH ..      OK!
Reading FLASH ..      OK!
FLASH contents is equal to file.. OK
Leaving programming mode.. OK!

But when I press B to start it, the 3pi only turn halfway to the right (for calibration), then it stop, LCD off, blue leds on the bottom is off.
I try to load my ‘edge avoiding’ that I did yesterday, it worked well.
Any idea?


I think the most likely explanation for what you’re seeing is that the batteries are drained and either need to be recharged or replaced. The place at which it is shutting off is where the motors transition from turning rapidly in one direction to rapidly in the other, which briefly draws a relatively large amount of current (e.g. compared to what they might draw in your edge-avoiding program). If the batteries are low, they cannot supply this current and the voltage drops, which can cause the robot to turn off. What type of batteries are you using (NiMH or alkaline) and what battery voltage is the 3pi reporting?

- Ben


You are right. After replacing the batteries, it is working well now. My edge avoiding program run slowly backward and forward at (20,20) when calibrating, so it does not have the problem.
To answer your questions: I use NiMH. The voltage reported is about 48xx mV.


I’m glad your problem had such a simple fix. In general, if the 3pi shuts off while it’s driving, it’s very likely your batteries need to be charged (it can also shut off if it runs into an obstacle and the batteries are briefly jostled). I recommend you include code in your programs that displays the battery voltage when the start so you can tell when your batteries are getting low. You should avoid programming the 3pi while the batteries are very low as the 3pi can be permanently damage if power cuts out in the middle of programming.

- Ben

Lesson learned.
Perhaps, I can add a code like if (voltage < MinValue) RefuseToRunAndAlarm(); :smiley: