9
\$\begingroup\$

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!

\$\endgroup\$
1

4 Answers 4

6
\$\begingroup\$

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.

\$\endgroup\$
4
  • \$\begingroup\$ A 12V motor which stalls at 15A has an armature resistance of 0.8Ω so there will be about 3.3V across R1 which will dissipate nearly 36W! \$\endgroup\$
    – MikeJ-UK
    Commented Aug 9, 2012 at 11:48
  • \$\begingroup\$ @MikeJ-UK - How long for? The MCU will switch off the motor within a millisecond or two. The typical power dissipation will be only 0.675W. \$\endgroup\$ Commented Aug 9, 2012 at 11:59
  • 2
    \$\begingroup\$ True I suppose, as long as the OP doesn't set inconvenient breakpoints in his debugger! \$\endgroup\$
    – MikeJ-UK
    Commented Aug 9, 2012 at 12:05
  • \$\begingroup\$ @MikeJ-UK - Haha! Yes. I've burned out motors before because of breakpoints. But that problem is the same whatever is used to sense current. Don't forget that the motor dissipation will be 180W during stall! \$\endgroup\$ Commented Aug 9, 2012 at 12:21
11
\$\begingroup\$

Allegro has a number of current sensor ICs, based on Hall effect sensors. The ACS712 can detect currents up to 50 A.

enter image description here

The ACS712ELCTR-20A-T has a sensitivity of 100 mV/A, so you can use the microcontroller's ADC to detect when the 500 mV (5 A) threshold is reached, or better, use a comparator, which interrupts the microcontroller. Many AVRs have a comparator on-chip, with an interrupt exclusively assigned to it.

The ACS712 has a current sense path resistance of only 1.2 mΩ, so even at 15 A it will only dissipate 270 mW, which it can sustain forever. That's the main advantage over a more traditional current sense resistor as in Rocketmagnet's answer. There you need a relatively high resistance to get the high level at 15 A. Mike calculated that Rocketmagnet's sense resistor will dissipate 36 W when the motor stalls, so timing is critical there (for a moment disregarding the 131 W dissipation in the motor). Even so, a 5 W type is recommended for the sense resistor.

\$\endgroup\$
2
  • \$\begingroup\$ Timing is critical no matter what the solution. Everyone's focusing on the 36W dissipation of the resistor, but completely forgetting about the 180W dissipation of the motor! That motor is going to burn out pretty quickly. \$\endgroup\$ Commented Aug 9, 2012 at 16:45
  • \$\begingroup\$ @Rocket - I did mention the motor, only mine is 131 W, which is high enough. You're right though, that you should respond fast, but at least the Allegro sensor won't be a problem. I mention the 5 W because most resistors won't allow > 10 x nominal power, even for a moment. I think your sense resistor can be chosen smaller, since most controllers will see 0.7 Vcc already as high, and then at 15 A that's 0.23 Ω. \$\endgroup\$
    – stevenvh
    Commented Aug 9, 2012 at 16:58
1
\$\begingroup\$

There are these things called magnetic reed switches. Basically like a relay; a current causes a field which closes some contacts. If you throw one in series with the motor, you should be able to find one that will remain open at 1.5 or 2A, but close at 15A. Ground one of the switch contacts, pull the other end up to your logic +V, and voila, an isolated digital input signal.

\$\endgroup\$
2
  • 2
    \$\begingroup\$ Do you have a link for reed switches which can switch 15 A? \$\endgroup\$
    – stevenvh
    Commented Aug 10, 2012 at 12:03
  • \$\begingroup\$ the reed switch does not switch the 15A current. The 15A current activates the reed switch. The switch itself switches a very small amount of current at logic voltage. This provides the digital input to the micro that turns off whatever it turned on to supply the 15A in the first place. \$\endgroup\$
    – JustJeff
    Commented Aug 10, 2012 at 23:15
0
\$\begingroup\$

Not really an electronic solution but a mechanical: If you have control over the mechanics, you could use a switch solution at the motor, e.g. by transfering from a small to a large gear that will turn less than one time during the whole process. A dent on this gear could trigger a switch. (This is how our garage door opener does it.)

\$\endgroup\$

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.