I have DC motor with a gearbox to transforms the rotational movement to linear movement and movie a pin back and forward.

I need to know when the pin reaches the two positions: full back or full forward.

The motor is a simple DC brushed one (3V low speed, the current on free movement is around 11.8mA) and it will be driven by an ESP8266 through an H-Bridge.

There're no sensors to detect pin position (and nonot enough space to add them), so my idea is to measure the motor current and when I read a fast increment it means the pin is full forward/backward (motor close to stall).

How can I measure the current and read by a microcontroller to drive the motor via H-bridge?


1 Answer 1


Put your current sensor in one of the supply lines that feeds the H-bridge. Either put a high-side sensor in series with the positive supply, or put a low-side sensor in series with its ground connection. Regardless of which way the motor is turning, the current flows through these points in only one direction.


simulate this circuit – Schematic created using CircuitLab

The advantage of low-side sensing is that your feedback signal is automatically ground-referenced. But you can get ICs from several vendors that make high-side sensing just as easy.

I've shown resistors, but you could instead use a Hall-effect sensor in either position and also get a ground-referenced output.


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.