Over Current Sensing by Microcontroller

Thread Starter

fastbike

Joined Dec 29, 2020
56
My googling skills have failed me ...

I need a microcontroller to detect when an AC load draws current in excess of 5A.
I've looked at using a Hall effect current sensor, something like TI's TMCS1100 with a 5V supply. This can be biased to output 2.5V with no current and using the part with 400mV/A sensitivity, would output 4.5v when the 5A AC current is flowing one direction, and 0.5v when the current flows the other.

My guess is that some type of comparator is required which will output a hi/low signal to the micro. But I'm not sure how to condition the output of the current sensor to feed into the comparator. As the sensor's output voltage is a sine wave centred around 2.5v can I somehow rectify it with a bridge biased at 2.5v ?

I can't see that I'm inventing anything new here so a little frustrated that I have not been able to find it by searching ! So any help especially with a link to a proven circuit is much appreciated.

Thanks
 

Thread Starter

fastbike

Joined Dec 29, 2020
56
The micro I'm using does not have any built in ADC. There are also 4 channels in the application, so my thought was 4 digital IO pins configured as interrupts, and handle the over current logic in the analog circuitry.
 

dendad

Joined Feb 20, 2016
3,781
Also, a current transformer feeding a rectifier bridge would work well, and may be cheaper than the Hall sensor.
 

crutschow

Joined Mar 14, 2008
26,736
If you use the Hall sensor then just rectify the signal (preferably with an op amp ideal rectifier circuit), and then to a comparator.
Do you need a circuit for that?
 

dendad

Joined Feb 20, 2016
3,781
You could have an active rectifier after the Hall sensor then feed the signal to a comparator to produce the digital signal to indicate the overload.
Or, add an external ADC, like this from Ebay...
ADS1115_ADC.jpg
 

dendad

Joined Feb 20, 2016
3,781
If you use an ADC, that will give you the ability to monitor the currents so detect open circuits, unbalanced currents (if that is a thing in your application) as well as overloads.
For instance, in my industrial control stuff, the 4-20mA inputs are actually 0-22mA so I can sense out of bounds fault conditions.
 

Thread Starter

fastbike

Joined Dec 29, 2020
56
The trouble with an ADC is the micro has to constantly do an analog read, as it will not know where in the 50Hz cycle the current is at maximum amplitude. A pre conditioning comparator triggering an interrupt on the micro allows it to concentrate on its normal tasks and only react in the exceptional times when current goes over design spec.
 
Last edited:

dendad

Joined Feb 20, 2016
3,781
The trouble with an ADC is the micro has to constantly do an analog read, as it will not know where in the 50Hz cycle the current is at maximum amplitude. A pre conditioning comparator triggering an interrupt on the micro allows it to concentrate on it's normal tasks and only react in the exceptional times when current goes over design spec.
You can use a zero crossing IRQ and a timer IRQ to sync the readings if you want. That is pretty standard.
But if you use an active rectifier, the time constant can be long enough to hold the signal.
 

Thread Starter

fastbike

Joined Dec 29, 2020
56
If you use the Hall sensor then just rectify the signal (preferably with an op amp ideal rectifier circuit), and then to a comparator.
Do you need a circuit for that?
The Hall sensor chip will be outputting a signal centred around the bias voltage (2.5v). How do I rectify that ?
 

Thread Starter

fastbike

Joined Dec 29, 2020
56
I think I will use a LM393 to condition the output of the TMCS1100 current sensor. I'll use two reference voltages, one for the upper and one for the lower bounds, and then feed the two outputs to some type of OR gate which drives the interrupt on the micro. Good old analog circuitry :)
I'm off outside to work on my garden, so will try to draw a circuit up in the day or two for some feedback.
Thanks for all your assistance to date.
 

dendad

Joined Feb 20, 2016
3,781
Adding a capacitor between the sensor and the active rectifier input will remove the DC offset, or bias it at the same level.
Have a play with a breadboard and some parts to see if you can get something working.
 

Thread Starter

fastbike

Joined Dec 29, 2020
56
Here's my first circuit schematic idea. Three reference voltages are created (resistors pairs R1.1 , R1.2 etc) which are used to:
  1. Bias the output of the Hall effect current sensor U1 to 2.5v
  2. Provide an upper bound for voltage comparator U2.1
  3. Provide a lower bound for voltage comparator U2.2
The outputs of the two comparators feed an OR gate so if either (or both) are high the Output signal will be high.
1617492388778.png
 

Thread Starter

fastbike

Joined Dec 29, 2020
56
I think I will need some pull up or pull down on the output
I don't see why you need two comparators.
What does the lower bound do?
The output of the Hall effect current sensor varies around the 2.5V ref. With the 200mV/A part, a 5A load will give a signal of (2.5 - .2*5) 1.5V when the load is in the negative part of the AC wave form, and 3.5V output when the load is in the positive part of the AC waveform. So I'm checking for both parts of the waveform.

I'm not sure it is safe to assume the load is drawing equal current on bothe sides of neutral.
 

dendad

Joined Feb 20, 2016
3,781
If you tie both LM339 outputs together with one pullup to 5V that will do as they have open collector outputs.
The gate is not needed.
 
Top