4
\$\begingroup\$

I'm trying to design a circuit where it is essentially a motor controlled by a microcontroller with some feedback. The motor will have its own isolated power supply and the actual on/off switch will be a relay + transistor.

What I'm looking for is to have some sort of feedback if the motor side is not working (power supply is dead or wire break, etc), as currently if the controller switches the transistor/relay, there is no way of telling if there is current going to the motor. The motor may also be far away (let's say a meter or two) as well, increasing the chance of a wire break.

Currently, the only way I can think of doing this is to use an optocoupler with a current divider in parallel with the motor line. I have no idea if this a proper way, but I have gotten it to more or less work (with some guess work + trail and error on the resistor values). An issue is though that it is not perfect as I'm guessing when the motor is turned on/off (spinning up or spinning down or stall), the current draw changes which affects the reading a bit.

What would be a better/proper way to do this? Or what should I look up, as trying to search this in google just returns many results on how to measure current using a meter or using the continuity test.

schematic

simulate this circuit – Schematic created using CircuitLab

Side note: My knowledge in electrical engineering is pretty limited and my schematic is pretty rough just to get the idea across: I've omitted some parts, like the diode across the relay coil/motor and the transistor might be wrong one, etc.

\$\endgroup\$
11
\$\begingroup\$

Another way to do it would be to use a hall effect sensor. These sensors basically give you a measure of current through a wire. You will need to find one which fits in to your current range. One example of such sensor is the ACS712T by Allegro. You can even find these sensors ready on breakout boards (at low prices) making it very easy to use.

\$\endgroup\$
  • 2
    \$\begingroup\$ I'd suggest this, too, because it allows to actually measure current, not only detects its presence. Just one note: A Hall (effect) sensor is a sensor to measure magnetic fields. The sensor you linked is a "hall effect based current sensor", i.e. it measured the field of the flowing current and gives a linear response. \$\endgroup\$ – sweber Jun 5 '16 at 14:59
  • \$\begingroup\$ I do happen to have one right beside me (A3144) and I've tried it in the past but couldn't get it working. I had forgotten about it entirely until now. I'll give it another try, even though it says it needs more then 3.3v, but it does seem to offer the most feedback. I think with the measured current, I could potentially infer if the motor is running or has stalled as well. \$\endgroup\$ – mitim Jun 6 '16 at 4:32
  • 1
    \$\begingroup\$ The A3144 (I have several) is a binary switch, indicating presence of a north (or south, I forget) pole near the sensing plane. It does NOT give any indication of strength of magnetic field and it is not sensitive enough to detect current flow in a nearby wire. It's a bipolar magnetic switch, not a current sensor. FYI \$\endgroup\$ – lornix Jun 6 '16 at 5:26
  • 1
    \$\begingroup\$ I have never tried with less voltage. You might have to find a different one to fit your needs. One example is ACS711. However this does have a wider current range and thus you will loose detection resolution; but for the purpose of detecting a wire break it should be sufficient. \$\endgroup\$ – Adam Z Jun 6 '16 at 7:55
  • 1
    \$\begingroup\$ At first glance, that seems to be exactly what I need. I will poke around in that family of chips to see others anyhow and now that I know what to search for, there seem to be one or two other similar chips. Thanks for your help. \$\endgroup\$ – mitim Jun 6 '16 at 8:00
8
\$\begingroup\$

If you're only concerned with an open, try this:

enter image description here

Wind enough turns around a reed switch so that there'll be enough of a field to hold it closed when there's current through the motor, and use a wire size that won't starve the motor.

\$\endgroup\$
  • \$\begingroup\$ This is an interesting idea. I don't have a reed switch at the moment to play with, but it does seem like a nice and simple solution. By wire size, I just presume you mean to use a large enough gauge wire? \$\endgroup\$ – mitim Jun 6 '16 at 4:39
  • \$\begingroup\$ @mitim Yes. Garden variety reed switches are rated to close and open in terms of ampere-turns, so if you used one which was rated to close at 10 ampere-turns and your motor drew 100mA when it was running, you'd need at least a 100 turn coil around the switch in order to get it to close when the motor was running. And, of course, the winding's resistance shouldn't impact the series resistance of the wiring between the supply and the motor very much. \$\endgroup\$ – EM Fields Jun 6 '16 at 17:59
4
\$\begingroup\$

The best way to do this is to get a motor with an optical encoder attached to its shaft. As the motor turns the A and B quadrature waveforms from the encoder can be fed back to the microcontroller to detect that the motor is turning. You can also detect the direction the motor is turning and also the motor rotational speed.

\$\endgroup\$
  • \$\begingroup\$ Well the motor take 9V, I doubt the motor is big enough to easily install an optical encoder on the shaft. \$\endgroup\$ – MathieuL Jun 5 '16 at 19:52
  • \$\begingroup\$ @MathieuL -- perhaps an encoder wheel from an old ball-mouse could be repurposed? \$\endgroup\$ – ThreePhaseEel Jun 5 '16 at 21:11
  • \$\begingroup\$ I'm not sure I can do this as it would involve running another (possibly long) wire to carry the signal from the encoder. Then I'd probably need a wire check for that wire. =b It's still a good idea though as it's a mechanical based method -I'll have to keep this idea in the back of my mind too. \$\endgroup\$ – mitim Jun 6 '16 at 4:42
  • \$\begingroup\$ No, if either wire breaks you will lose the feedback signal. \$\endgroup\$ – JDługosz Jun 6 '16 at 8:55
1
\$\begingroup\$

You've answered your own question already.

The best way to do this is to monitor the current. I'll go so far as saying this is the only way you should consider doing it (being an engineer of 20 years standing working on electronics and embedded software, including fault detection on automotive systems). Of course there are numerous other ways you can detect faults in the system, but the gold standard is monitoring current.

You've even mentioned this in your question. But then you've asked people "please can you help me, because Google has told me the answer already. What should I do?" Answer: you should follow the answer you already got out of Google!!! ;)

You may actually be trying to ask "Google has told me how to measure current using a resistor and a meter. How do I use that technique to get the current measurement into my microcontroller?" For that, I'll give you a Google search with several hits for useful tips. I will note that you also want to add diodes on the ADC input to protect against voltages higher than +V or lower than 0V.

\$\endgroup\$
0
\$\begingroup\$

You can put a relay with two contacts. When the motor is off and the circuit is OK you will get a signal from optocoupler. In this way, when the motor is on the optocoupler circuit will not interfere with motor.

In your design the optocoupler diode and R2 are troubling since diode will "steal" up to 2,5 V from motor's power supply and R2 will additionally decrease motor voltage.

However, in my modified design you cannot detect if something happens while the motor is running, only when relay is switched off.

I've calculated R1 based on LTL-307EE and 9V power supply, with condition R1>>Rmotor. And it is roughly 250ohm. In order for this circuit to work, R1>>Rmotor must be satisfied. I guessed 10ohm for motor, but you need to measure it.

Also, around 30mA of current will flow through motor when test circuit is on. That current must not be enough to spin the motor.

Modified scheme

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.