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:
- 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.
- 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...).
- 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!