Jump to content

How to use hall sensor with a brushed dc motor

Recommended Posts


I have a question regarding how I can use the Hall effect sensor with a brushed dc motor to measure vertical distance? I'm using MSP430F5529 microcontroller and have tested the pwm. I will be using one latched hall sensor. The tip of the screw that is attached to the motor will have 4 magnets where 2 of the magnets will send a high signal and 2 will send a low signal. How will I be able to measure the count from the hall sensor so that I can signal mso430 to stop at a particular distance?


P.S I will be using C programming for this project and will try to implement PI controller after I figure this out.


Thank You

Link to post
Share on other sites

What type of hall sensor?




If it is a switch type (output is active if there is a field of the appropriate orientation): tie the output of the sensor to an input that can trigger an interrupt. Have a counter (global) that the interrupt routine increments or decrements (as appropriate based on direction) each time the interrupt is triggered. If the sensor needs to have a response, respond in the interrupt handler. The counter will need to be declared as volatile, and can be read anywhere in the code as a position.



If it is analog output, tie it to a comparator input and use the comparator to trigger the interrupt.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...