Electronic – How to detect high current

current measurementdc motorsensor

I am working on the project which involves running a DC motor which is used to raise/lower window glass in the vehicle.

While running, motor draws about 1.5A of current. However, when the window reaches the end of the sliders and the motor can no longer raise/lower the glass, it starts drawing up to 15A until you release the button.

I want to use AVR microcontroller to control this motor and would like to stop the motor when the window reaches the barrier. I managed to come up with three solutions thus far:

  1. Use switches which will trigger and inform microcontroller when the window reaches the barrier. I'd like to avoid this because this means installing two switches per window and running extra cables to the microcontroller.
  2. Use timer function which will turn off the motor after a specific amount of time. This is not applicable because the voltage may vary and the motor might turn faster or slower than normal. Also, the window might be in an unknown position when starting the timer (all the way up, in the middle…).
  3. Use some kind of high current detector and route it to microcontroller's input, alerting the program when the current threshold is reached (say 5A). Something like a transistor, relay or similar device which can handle the current this high on the input.

I am pretty much a beginner when it comes to electronics, so I was thinking if there is a way to detect this high current (motor is running on ~12V) and provide this signal to microcontroller (which is running on 5V).

I'll appreciate any help. Thanks!

Best Answer

This should be pretty easy. You can detect the difference between 1.5A and 15A using a simple resistor. A value of 0.3 ohms will give 0.45v at 1.5A and 4.5v at 15A.

enter image description here

A digital input pin on the microcontroller will read 0 at 1.5A, and 1 at 15A.

You could wire this straight to the microcontroller's input pin, but it would probably be best to add a little filtering and protection.

RF and C1 provide a low-pass filter to make the voltage more stable.

D1 provides over-voltage protection in case the current greatly exceeds 15A.

Related Topic