Hold motor position


I am using my BrickPi to control a stairclimbing robot. It uses technic link treads to lift up legs by rotating the motor. However, whenever the back leg needs to be lifted, it lifts to the required height (using a touch sensor) and then I set its speed to 0. However, after that it tends to roll back a large amount, causing the leg to drop significantly in height, completely skewing the robot. Now I understand this is probably because the leg is heavy. However, it does not have this problem when the legs are not moving, i.e. the motor can then hold the legs perfectly fine. It’s when it has just finished moving that it is somehow more susceptible to unwanted movement.

I tried using the motorRotateDegree function but even the example of GitHub did not work at all, and from what I gathered in some topics there still seem to be some problems with this function.

Now what my question is: what can I do to stop the motor from rotating back after I tell it to stop?


Hey FritsBricks,
There is no function call to actually make the motor keep its position after you issue it the stop command. What you can try instead is give the motor a very low speed, such as 10 (you’ll have to find the value that works for you by trying out various values). At this speed there will be some power in the voltage which will keep it in that position but the power won’t be enough to actually make the motor move. Can you try this out and let us know if it works for you.



This sounds like a reasonable idea (so as I understand, giving it a speed of 0 does not cause it to invest power in holding the 0 speed?).
Unfortunately, I have not been able to check it out, because when I came back from the weekend I experienced some difficulties.

If I power the BrickPi via the BrickPi headers (9V) it freezes or restarts consistently. I hooked it up to a variable power supply, with 9V and 3A to work with. Although it only used around 800mA the whole time, all of a sudden it still froze (it could be that for 1 second it all of a sudden used up 3+ A, but why would that happen?).
It is however working properly if I power the Pi via the micro-usb slot.
This is very strange to me, since I did not change anything in the setup and I’ve been working with it for weeks. I did however notice during last friday that nearing the end of the day it would sometimes also freeze up, but not as frequently as it was yesterday.

Any ideas on why this is happening would be greatly appreciated!


Things got even worse. The Motor port A stopped working. Using different motors on it does not give any output, while all the other motors and sensors still respond. When hooking up an oscilloscope to the SN754410NE, it showed that the pins connected to the motor A port gave no real response, while the pins for Ports B C and D did. So, we ordered a new SN754410NE and are currently replacing it. However, how could this have happened?

What I can think of: I used a 3S1P Lipo battery (max voltage of 12.5V). I read on this forum that this should not be a problem at all. However, I am using one of your first BrickPi’s (we got it via kickstarter), is it possible that the early models were not yet able to deal with these voltages?

What else could it be? Of course, I want to be able to prevent these type of things in the future.


As luck would have it, replacing the SN754410NE did cause the broken motor port A to work again.

HOWEVER, the brickpi/raspberry pi keeps restarting when powering 9V via the variable power supply, with the limit set at 3A. What could be the cause of this? I suspect that these things are related.

I am going to hold a demonstration this Friday, climbing the stairs of the Groothandelstrap in Rotterdam, the Netherlands. I am not able to work on it tomorrow or this afternoon, so I need answers fast! Please respond as fast as possible!


Hi Frits,
Looking at the things that you have tried and the fact that you have burnt the motor driver and the power supply also trips over 3A, it suggests that the BrickPi motors are drawing too much current for extended duration.

First can you check with your power supply how much current does the BrickPi draw when the motors are not being used but still connected. Then how much current does it draw when you use 1 motors,2 motors and so on.

Also, how many motors are you using and can you share a bit more information and pictures of the robot that you are building and the program that you are using.

We have not tried this but using a heatsink might help: https://www.bananarobotics.com/shop/image/cache/data/sku/BR/0/1/0/0/8/BR010087-Clip-On-Heat-Sink-for-14-and-16-Pin-DIP-ICs/Clip-On-Heat-Sink-for-14-and-16-pin-DIP-ICs-600x600.jpg since it would allow more power dissipation and allow the robot to work for extended duration at high current use. People have also tried soldering 2 SN7544 chips to get double the current current out of them: http://forums.parallax.com/uploads/attachments/47009/79242.jpg, but this come with no guarantees from our side.



Hi Fritz, do you mind posting a picture of the BrickPi you’re using? If it’s using an SN chip, it is a much older BrickPi. We replaced these motor controllers some time ago because they couldn’t handle some of the most severe back and forth (very violent back and forth on the BrickPi motors causes the chips to burn out). A picture of what you’ve got would be really helpful.


Hi John,

We definitely have an old version of the BrickPi. I cannot make a picture right now because it is build in, but it uses an SN chip indeed. What more info do you require to determine the model of the BrickPi?

I switched from a 3S lipo (max 12.5V, possible the old model cannot handle that) to a 2S lipo, and I’m powering the Raspberry Pi separately via the micro-usb port. This ‘solved’ the problem but it is not a very satisfying solution.

However, it did succeed and I had a fairly successful demonstration, as can be seen in this article (it’s in Dutch though) http://www.ad.nl/rotterdam/robot-steelt-de-show-op-rotterdamse-supertrap~a1e1af23/

Now, I’m working on the rest of my thesis, and I actually need more motors than only 4. Would it be possible to use the GPIO pins to drive two separate DC motors? As I understand you are not using all of the GPIO pins for the BrickPi.


WOW! I couldn’t read the article, but that is an awesome looking robot you have there!

If you have an SN version of the chip, it’s an older version. It might also have older firmware, which would not limit the motor change rate and make it more vulnerable to burnout. Just a heads up.

Not all of the pins are used on the BrickPi, indeed. In fact only the I2C and Serial lines are being used, so the other GPIO’s are available.