I am a beginner with electronics and RPi.

I have a Brushed DC Motor that runs at a constant 13V and draws about 4-5 A while running and about 18-20 A at stall. It also has a single Hall effect sensor (https://www.melexis.com/en/product/US1881/Hall-Latch-High-Sensitivity) built in so I can get the square waveform (0.4V-4.8mA at low and 3.9V-48mA at high). I am running the motor via a Regulated DC Power source.

I want to use the hall sensor output with the Raspberry Pi 3 B+ so that I can store a certain home position of the motor. The motor can also be operated manually to rotate Clockwise or Counter Clockwise. Once stored, I want to press a button so that the RPi can count the number of revolutions of the motor and if it is different than the stored position, it will run the motor in the required direction to returned to the stored position.

My question is,

1) Can I run the motor using a High Power Motor Driver like the one in the link below? Will there be any other issues with it? https://www.pololu.com/product/3751

2) As the motor will run both ways and I have only 1 hall sensor to work with, how can I distinguish a clockwise (CW) signal from a counterclockwise (CCW) one? Can I somehow have a switch and use 2 GPIO pins to record the CW and CCW counts separately (ex. positive for CW and negative for CCW)? And then program it so that when I press the button it will rotate in the appropriate direction to return to the stored count)

Also, I think I will have to limit the output voltage from the Hall sensor as GPIO would only take upto 3.3V.

I would appreciate any help regarding this. Thanks a lot.

  • Because the motor is used in automotive seats for memory function. So it can go to the stored location by rotating in the required direction.
    – pie123
    Commented Apr 22, 2019 at 5:29
  • You are correct. Edited the question.
    – pie123
    Commented Apr 22, 2019 at 6:11
  • you will require at least one end-of-travel sensor for the object that is being moved by the motor
    – jsotola
    Commented Apr 22, 2019 at 6:22
  • upvote for editing your post :) .... so many people do not do so
    – jsotola
    Commented Apr 22, 2019 at 6:24
  • The motor driver board seems fine. You are probably trying to solve the wrong problem. You first of all need to find out whether the motor needs to turn clockwise or counterclockwise.
    – joan
    Commented Apr 22, 2019 at 8:23

2 Answers 2


I am using motors with similar properties (14v aldi drill motors with a stall current over 10A) and am using the thunderborg motor driver for 5A motors. Unless you do silly things (I have done that .. twice :-/) The piborg motor drivers are amazingly robust, with over not just a thermal cut-out, but they reset themselves afterward. The result is that if the motor draws too much current there is an awful noise from the driver but you do not need to reboot the pi. I note https://www.piborg.org/ sell both their thunderborg and the Diablo so I would be tempted to ask them.

That said, without an electric brake, you will have trouble with the momentum if there is not quite a bit of gearing between the motor and the hall effect sensor. Give the motor a single "kick" and it will get to N rpm and continue for D degrees; give it a kick twice as long and it will get to N+M rpm where N!=M and how many degrees it turns will be a bit arbitrary.



User Requirements

DC Motor 13V 5A running 20 A stall, single Hall effect sensor built in

To store motor position

To manually change position, and press button to return to stored position

User Worries

OK for electronics and RPi beginner?.

Can run the motor using a High Power Motor Driver any other issues?

Can one Hall sensor distinguish CW signal from CCW?

Can have a switch and use 2 GPIO pins to record the CW and CCW counts?

Short Answer

This motor board is absolutely not suitable for newbies. This is a severe warning.

For newbies, I highly recommend to start with the RoboBuddy.

One motor status pin cannot determine the direction. You need two pins, or use software to remember which direction you have been moving, but that is less reliable.

Long Answer

The Motor Driver

Rpi HAT 6.5~30V, 18A cont, 50A limiting, 100kHz PWM

The motor driver python library


Uses 6 GPIO pins 4 GPIO PWM, 2 GPIO input,

External current sensing through-holes

Locked-antiphase - low duty cycle one direction, high duty cycle other direction, 50% duty cycle motor off

Pololus Warning

This motor driver has no over-temperature shut-off. An over-temperature or over-current condition can cause permanent damage to the motor driver. You might consider using either the driver’s integrated current sense output (with an external ADC) or an external current sensor to monitor your current draw.

This product can get hot enough to burn under normal operating conditions. Take care when handling this product and other components connected to it.

high power motor driver

Update 2019apr22hkt2254

Since the motor with only one Hall effect sensor cannot be easily replaced, we have to live with that and rely on software to memorize which direction it is moving. Actually quadrature rotary encoder does not seem to be any use in your situation, because you of course can easily memorize last time which PWM signal you use to rotate CW or CCW.

And I think you can consider using a regulated power supply with current limit set to say 10A. The motor when starting and stalling will take huge current, but the power supply can limit the current appropriately.

To play double safe, I think it a good idea to use external current sensor resistor and use ADC to monitor the current.

If your motor steady current is 5A, then using the Polous 18A steady, 50A peak is of course an overkill. Perhaps you can search for a smaller driver.

I have no experience in over 30V/3A DC/BLDC motors. So my suggestion is amateurish! :)

  • If overheating is the only concern, then I just wanted to point out that the motor will run for 10-20 seconds in a day. If it can still overheat for other reasons, which motor driver do you suggest I use that can handle this power?
    – pie123
    Commented Apr 22, 2019 at 5:32
  • @pie123 Ah, there are many concerns. I think you should consider a smaller current, lower speed, but much powerful geared DC or BLDC motor. Your position has no precision requirements, otherwise you should consider a geared stepping motor, ...
    – tlfong01
    Commented Apr 22, 2019 at 6:16
  • Thanks for the suggestion, but the problem is that I cannot replace the motor for this application.
    – pie123
    Commented Apr 22, 2019 at 6:31
  • No problem. Let me think again.
    – tlfong01
    Commented Apr 22, 2019 at 6:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.