## Motor Sensing Circuit help

BoydLabBuck
Posts: 6
Joined: Fri Feb 01, 2019 10:15 pm

### Motor Sensing Circuit help

I am trying to develop a circuit using a clamp-on current sensor to detect whether a motor is on or off. I don't need to know actual current draw of the motor. Looking to use a sensor such as this.
https://media.digikey.com/pdf/Data%20Sh ... 60_Web.pdf

When the motor is on, I want to detect that with a GPIO input.

What would this circuit look like? I'm assuming I would need a transistor and possibly an additional relay, but that type of design is a struggle for me.

Has anyone done something like this, or be able to point me in the right direction?

blimpyway
Posts: 445
Joined: Mon Mar 19, 2018 1:18 pm

### Re: Motor Sensing Circuit help

That probe outputs a voltage between 0V to 1V when current varies between 0 and 15A

So it needs an analog converter. Or a specialised circuit to switch between 0.0 and 3.3V output on a defined input voltage threshold between 0 and 1V ... it could be 1mV or 10mV - it depends on how much your motor is drawing

Posts: 861
Joined: Tue Dec 15, 2015 4:55 pm
Location: Detroit, MI USA
Contact: Website

### Re: Motor Sensing Circuit help

If it's simple on/off, you can bias a transistor with it. I wish I could easily post a sketch. There are different types of transistors...I'll talk about an NPN - which I always thought of as "supplies a negative" when biased with a positive. Basically the input from your sensor would go to the "base" (middle pin for a 2n2222, for example). The other two pins of the transistor are the emitter and collector. Wat matters is that one goes to ground, and the other goes to your gpio pin (with a current-limiting resistor along the way). When the current sensor voltage rises, it "allows a negative to flow." If your GPIO pin is set as an input and pulled up, when the transistor gets biased it will pull the gpio low.

Not the most academically accurate/complete description, but thinking of NPNs like that got me through a billion hobby projects back in the day. Just keep in mind that different transistors have different properties for when they are fully biased (fully biased is akin to a valve being open all the way. Think of a transistor as an electron valve) ...and PNPs are the opposite - bias with a negative and they "supply a positive." Of course, they just allow flow, but sometimes simplified thinking is plenty for a hobbyist.
Robotics tips, hacks, book extras https://youtube.com/practicalrobotics

JohnsUPS
Posts: 189
Joined: Fri Jul 06, 2018 2:13 am
Location: USA

### Re: Motor Sensing Circuit help

Does the motor operate at full on and full off or does it operate at variable speeds? Knowing the answers to those questions will help to identify how sensitive the sensing circuit needs to be.

Because the output of the CT transformer is 0-1V @ 0-15A, you could feed it to a comparator circuit, but not after the output of the CT transformer is conditioned (the CT output will be AC) so that the comparator won't switch at the line frequency. It appears as though the CT transformer has a resistor in it, because the output is given as a voltage and not a current. A simple resistor/capacitor filter would probably smooth the output well enough to reliably feed the comparator. A comparator such as the LM393 has an open collector output, so by using a pullup resistor on the comparator output to 3V3, the output will switch from very close to ground up to 3V3 and be able to be fed to a GPIO pin safely. This part will operate at 3V3 also.

Think of a comparator as a 1 bit AD converter. You can set the threshold voltage (the output of the filter connected to your CT transformer) so that the comparator will switch its output at the desired current draw of the motor.

Alternatively, the CT output could be fed to the base of a transistor (or gate of a MOSFET), and the switched output filtered/smoothed and clamped to not exceed 3V3.

Burngate
Posts: 6373
Joined: Thu Sep 29, 2011 4:34 pm
Contact: Website

### Re: Motor Sensing Circuit help

Does your motor take the full 15A this CT can handle, when it's running?
I would guess not, since I would not want to design anything without a bit of headroom, for safety.
If it takes rather less than 15A, then the CT will give less than 1v.

A single NPN transistor as described needs 0.6 - 0.7v on its base to start conducting, so you may find nothing much happens unless the motor takes a good proportion of that 15A - though since a motor can take a large current when starting, with the current dropping considerably once it's up to speed, you could get some wildly random results.

And also note, this is all AC - the motor current is AC, and so is the output of the CT - so there's negative voltages around as well as positive ones, and the Pi really won't like those.

Personally, I would feed the CT output into an amplifier such as a TL072; feed the output of that into a bridge rectifier; and use that to drive an optoisolator. That way, the Pi is isolated and kept safe.
That will need a separate power supply, with both positive and negative rails.

But before I did anything else, I'd want to know more about the motor!
JohnsUPS wrote:
Tue Aug 27, 2019 10:13 pm
... It appears as though the CT transformer has a resistor in it, because the output is given as a voltage and not a current ...
That page gives "Build-in sampling resistance（RL): 124Ω".
Given that it's supposed to give out 1v for 15A input, that's about 8mA through 124Ω, and we can guess at about 2000 turns in the CT

blimpyway
Posts: 445
Joined: Mon Mar 19, 2018 1:18 pm

### Re: Motor Sensing Circuit help

A way to detect a motor (or any other consumer) is powered or not is to sense its powering switch - being it either a manual switch or a mechanical or solid state relay. Across the switch you get full voltage when opened and zero when closed

That can be done with an optocoupler + resistor, and for AC a capacitor and a reversing diode are also needed.
Something like LED drivers but with octocoupler instead of LED