Maker Pro
Maker Pro

Current protection circuit

Logman7585

Oct 28, 2016
2
Joined
Oct 28, 2016
Messages
2
Hi everyone, I'm new here. I want to create a protection circuit for my system. I have a hall sensor that detects a magnet and turns on a relay which controls the load. That system works well so far. I also bought a cheap meter that uses a shunt to detect the current and display it on a screen. What I'm thinking I'd like to have is a chip of some kind that both the hall signal and the current signal would go to, and if the current were too high it would stop the hall signal from passing to the relay, effectively turning off the circuit.

I'm new enough to electronics that I don't have an idea of what chip to select or how to design a current sensor that said chip could interpret properly. Any resources or example circuits or other threads you could point me to would be greatly appreciated! Or of course if you have direct knowledge of how to do that I'd love to hear it. Thanks!
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,878
Joined
Jun 21, 2012
Messages
4,878
There are several ways to disconnect the hall sensor (why is that necessary?) and interrupt current to the relay coil when the load current exceeds a preset level. When the "trip point" is reached, the relay de-actuates, causing it to interrupt the load circuit. Problem is, that function needs to be latching, so once it "trips" it stays tripped, else the lack of current in the load would be a signal to turn everything back on again. Depending on other parameters (like relay contact-transfer speed), the circuit would rapidly oscillate on and off as long as the load fault existed and the Hall sensor was telling the relay to energize.

So, is a manual reset acceptable, or do you want a function that waits awhile and then re-enables the trip function again the next time the hall sensor activates the relay coil? And just how much current are the relay contacts switching? AC or DC? What voltage is being switched by the relay contacts, and what voltage at how much current does the relay coil require to actuate?

What you want to do is easily accomplished with an Allegro current sensor chip whose output is monitored by a PIC10F206 microprocessor. The PIC microprocessor can monitor the Hall-effect sensor output as well as the Allegro output (which represents current as sensed and isolated by the chip). The PIC would then control the power relay that services the load, turning the relay on when the Hall sensor detects the magnet if, in the process of doing so, the load current remains below a preset value. If a fault condition exists (load current exceeds trip point), the relay would be immediately de-energized within a few milliseconds and stay de-energized until reset. If everything starts up okay, but later the load current exceeds the trip value, the PIC firmware would de-energize the relay coil, regardless of the Hall sensor output, and await a reset condition.

After the PIC firmware has detected a fault condition, you have a choice of "automagical reset" after a programmed time delay, or manual reset with a push-button switch whose state the PIC firmware monitors. You could even do both, the push-button switch overriding the programmed delay. All this two-chip, ten dollar, circuit requires is a 5 V DC power supply capable of providing about a hundred milli-amperes of current to power the Allegro chip, the microprocessor, and the relay coil. Maybe less, depending on the relay coil. You could also use a solid-state-relay (SSR) in place of an electro-mechanical relay if your load requires high current. Most SSRs require only a few milli-amperes to actuate.

The Allegro chip functions in a way similar to your current meter. A short length of heavy copper is connected internally between terminals on the Allegro package. Passing an electrical current through this internal, low-resistance, connection creates a local magnetic field that an internal Hall-effect sensor detects. It is a linear sensor, so the Hall-effect output is linearly proportional to both the magnitude and the direction of the current passing through its current-sensing terminals. The output is a voltage the varies from zero to approximately the power supply voltage (0 to +5V) as the current varies from a maximum negative value to a maximum positive value. At zero current the Allegro chip output is one half the power supply voltage. That means you should AC-couple and then rectify and filter the Allegro output if the load is driven from an AC power source. Or you can easily do that function in software, thereby eliminating the need for a coupling capacitor, a diode, and a filter capacitor, looking for a peak value of the Allegro output corresponding to either a positive or a negative (or both) peak in the current being sensed. Programmer's choice, but I would opt for the software solution to eliminate the extra components.

The PIC I suggested has a built-in analog comparator function that allows you to compare a zero to +5V input with an external or internal reference voltage and respond accordingly. Or you could use a somewhat more sophisticated PIC, such as the PIC10(L)F320, which has a built-in analog-to-digital converter, obviating the need for a comparator. Either way, the cost of the two chips is small, even in onsie-twosie quantities. The Allegro chip is available in a ±200 A range, which may be way more current than your load would ever draw, but it has the advantage of through-hole leads which are easier to wire up. There is a surface-mount version, the ACS712, that has a range of ±50 A, which is probably what you would want to use.

If the above sounds doable for you, but you lack the circuit design or programming skills, we can help you with both. There is a rather lengthy thread here that describes how one former newbie successfully completed a similar Allergo-based design.
 

Logman7585

Oct 28, 2016
2
Joined
Oct 28, 2016
Messages
2
Thank you! That's a huge help. The load current Iimit I want will be 50A DC, but the 200A chip is probably the better one, especially with the through-hole leads. Would you by chance be able to link that thread? I'll search for it if you don't have it handy. I do believe I'll need help with how to program a chip like that, as I've never set up any sort of microcontroller chips in a circuit before.
 
Last edited:

hevans1944

Hop - AC8NS
Jun 21, 2012
4,878
Joined
Jun 21, 2012
Messages
4,878
Try this one. Should be available from distributors, or you could ask for a free sample from Allegro. Tell them you are a project developer and need a sample to test for proof-of-concept. Or just order the Allegro and the PIC from a distributor for fastest delivery. Samples can take forever to receive.

You will also need a genuine Microchip PICkit 3 programming pod that interfaces between a USB port on a PC (typically a laptop) and the PIC microprocessor. Avoid purchasing Asian clones. Some work, some don't. Buy from a Microchip authorized distributor or from Microchip.

An integrated development environment (IDE) can be downloaded for free from the Microchip website. Do that first and become familiar with it before your PICs and the PICkit 3 module arrive. It's something of a learning curve, but stick with it and join the Microchip Forum to ask questions. You use the IDE to write your program, and then use the PICkit 3 module to download the assembled and linked code to the PIC. I think for this project you should use the PIC10(L)F320 as there are a several people here (including me) who have used these and can help you over the rough spots. Be sure to purchase a few (in case you "brick" one while learning) and make sure they are in the dual-inline-package (DIP) so you can easily put them a socket on a prototyping board.

I didn't mention it, but you can also interface the Allegro chip directly with an Ardunio Uno, which you can program directly with a USB connection to your PC, downloading the code directly to the Arduino. Again, you need to download a free IDE to get started, but you don't need to invest in a PICkir 3 module. An Arduino is overkill for this application, in my opinion, but may be simpler if you know almost nothing about programming. The Arduino uses a modified version of C++ and has a HUGE base of support, as do the PICs and other microprocessors, such as the PICAXE which is a PIC that has a pre-loaded BASIC interpreter.

You don't have to commit to a microprocessor to get started using the Allegro chip. You could design an analog circuit that compares the Allegro output with a preset level and then sets a flip-flop that disables the relay if excessive current is sensed. A simple 555 timer could be used to "automagically" restore operation, or use a push-button switch to clear the flip-flop. There are many ways to implement the functionality you want, but the key item is the Allegro current-to-voltage converter that provides galvanic isolation between the load circuit and the remaining electronics, while placing virtually zero resistance in series with the load.

I personally favor the PIC approach because it requires the fewest components, but you should weigh your options and pick a path you think you can complete in a reasonable period of time.
 
Top