Running motor test or WiFi car reboots RPi

Using both Scratch and Python, I get fairly consistent reboots of the Pi. It seems to be after running forwards, then running backwards is the most reliable way to get it to reboot.

I get the same results using the Python LEGO motor test, Python Wifi Car, and the Scratch Car.

Hi, I assembled my kit a few hours ago and tested with the Python Wifi Car sample program.

When I go directly from forward to reverse, it reboots, but when I go from left/right/stop it does not.

Could it be that forcing two motors to reverse direction demands to much power? I’m using a standard non-rechargeable 9V battery.


I have the same boot-problem, but only when switching directly from forward (8) to reverse (2). Could it be due to insufficient power? I’m using a standard 9V non-rechargeable battery.


It could be that the BrickPi is drawing too much power from the 9V battery, and the voltage is dropping below the level the RPi can operate at. And thus rebooting.

I suspect from what I’m seeing on the posts today that batteries might be worn down or unable to deliver the amperage needed to change direction of the motors. When the 5V rail drops low, the RPi will turn off. This could be what’s resetting it.

Is there a way you can try with a fresh 9V battery (right out of the packaging) or a 6XAA adapter?

I got this the very first time I used it with brand new 6xAA adapter.

I used a fresh 9V battery.

Hey guys, in order to try to follow the problem I went ahead and setup a new configuration. I burned a new image, connected over WiFi, and ran WiFi Car, controlling it from the laptop. I was using 6XAA’s, that were about half full. Reading the voltage on the battery pack, I see 7.25 volts on my voltmeter while the BrickPi and the RPi are running.

I went ahead and ran it full blast forward, and full blast backward (I changed the values to 255 and -255 from 200 and -200 respectively). I had no resets on doing that.

I’m stumped about what could be causing the problem on your end. I have to think about this and see if there are any more questions I could be asking.

JimW, Again, I’m trying to recreate the problem and can’t seem to do it. I changed the code to set the motors to 255 and -255 (full blast) on the motor test. I’m running this over WIFI as well.

Do you have a voltmeter and can you measure the voltage on your battery pack?

I get 8.38v on my 6xAA pack

I get 7.977v now on my 6xAA pack.

I just tried this. I use a 1A USB power source on the RPi AND the 6xAA pack on the BrickPi, and it worked. I ran the Scratch Car at 255 forward and back, no problems. I stopped the motors, remove the USB power, hit the up arrow and it rebooted.

I was running over wired Ethernet, using VNC to access the Pi


Can you please check if the problem can be solved by using 2 batteries simultaneously(9V battery for RPi and 6xAA for BrickPi). This must solve the problem easily by dividing power and avoiding the surge.

Also, never use a single 9V battery to run RPi, BPi and also motors. I’m sure it wont provide that much amperage.

An alternate solution to this particular problem may be stopping the car for a second and then running it in reverse. This can also be implemented in the python code by using time.sleep() for a few milliseconds.

I’ll add an updated code soon, if you guys need it.

I don’t know Jaikrishna what you mean by powering the raspi with a 9V battery - as far as I know it runs on 5V. Anyway, I tried the same as JimW: I power the rapsi with a usb mobile charger and power the brickpi with a fresh 9V battery (I don’t have a 6xAA pack available).

I then runs smoothly…

My brickpi is without the power upgrade - does that mean that it requires more amperage? Do you at Dexter reproduce using a similar model?

Hey oystein,

Sorry about the last post. What I meant was, provide individual power supplies for RPi and BPi. (Just as JimW said)
Also, getting a 6xAA Pack is preferable. It definitely provides more power than the standard 9V battery.

Anyway, I just modified the python code a little bit (to add delays before running in opposite direction). I’ve attached the modified code to this post. I guess this code will be able to run it on a single battery without reboots.

Can you please check if this one works well on your model?
If it doesn’t work, try changing the time.sleep(.5) to give more delay. (ie. change .5 to .8 or 1 in line 62 and 70)

Edit: *.py attachment was not allowed. So here’s the pastebin link:

Sorry, The py file was not permitted and due to some reasons, editing doesn’t work.
Here’s the pastebin link for the file :

Hey Oystein and JimW, another question: I’m assuming you guys are using a Model B type RPi (is that right?).

Can I ask when you bought it, and what revision it is? I did some reading on the different revisions that have been launched, and I’m seeing that in late 2012, some changes were made to the reset circuit, and the fuses. I don’t know if this has implications or is linked, but I’d like to try something.

There’s a lot of information about finding your Pi version here:

If you could type in “cat /proc/cpuinfo” and let me know what you find under "Revision: "

So I checked the version I have on my desk, it’s rev 00f. Which according to the second link, should be PCB Revision 2.0. I attached a screenshot.

(And thanks a lot for your patience working through this!)

Hey Guys, more updates: my above solution might not be the issue. I tried out a modified WiFi Car example, with the power cranked up to 255/-255, and a BrickPi Basic board on an RPi board I found that’s Revision 0002. Didn’t crash. So I’m still not able to recreate the problem of crashing on full forward and reverse.

Relevant or not - my revision is also 000f.

But - I haven’t got any answer to my previous question: Are you using a brickpi with or without the power upgrade? Mine is without.

My Revision is 000d, which from the link you supplied is:
000d Q4 2012 B 2.0 512MB (Mfg by Egoman)

The delay proposed by Jaikrishna may work, but I’m sure will be problematic down the road.

Here’s some more details. I ran with separate power on both the RPi and BPi to avoid the reboot.

From the 6xAA pack:

Voltage at start of test, when idle 7.42v
Start two motors 255 forward the voltage drops for a fraction of a second to 6.9v, then stays at around 7.1v while it’s running. Switching between forward and back, etc. gives similar results with a dip to 6.9v then back to 7.1v when running.

I removed the separate power from the RPi the voltage is 6.55v on the 6xAA pack. When running the motors forward, it dips to 5.53v and the RPi reboots.

Lars, all of my testing for this thread has been in the BrickPi Basic power. I haven’t done anything with the BrickPi advanced power in a while now.