CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Over voltage protection
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
levettp



Joined: 07 Sep 2003
Posts: 17

View user's profile Send private message

Over voltage protection
PostPosted: Wed Dec 01, 2010 4:45 pm     Reply with quote

I'm using a PIC to interface with a 220V power supply.

Something went wrong and 220V flew through the PIC, blew my PICkit programmer and laptop that were connected to the PIC via USB.

I used simple voltage dividers to reduce voltage for A/D and the transistor I switch was directly connected to a digital output. Now I need to implement a fool proof over voltage protection method on the PIC.

My best plan at this stage is to use a 100V & 5.1V zener diode on the in/outputs to the PIC but I'm not sure if a zener will react fast enough.

Any good advice that someone can give me?
gpsmikey



Joined: 16 Nov 2010
Posts: 588
Location: Kirkland, WA

View user's profile Send private message

PostPosted: Wed Dec 01, 2010 4:50 pm     Reply with quote

You don't say exactly what you are doing, but I would consider using a transformer to step the mains down to a lower voltage (also provides isolation). Mains (110 or 220) can kill you and you want to avoid direct connect if possible - if your controller of some sort needs to talk direct, I would make sure any output from the controller was isolated. Letting the magic smoke out of you OR your laptop is not a good thing ...

mikey
_________________
mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3
levettp



Joined: 07 Sep 2003
Posts: 17

View user's profile Send private message

PostPosted: Wed Dec 01, 2010 5:07 pm     Reply with quote

gpsmikey wrote:
You don't say exactly what you are doing, but I would consider using a transformer to step the mains down to a lower voltage (also provides isolation). Mains (110 or 220) can kill you and you want to avoid direct connect if possible - if your controller of some sort needs to talk direct, I would make sure any output from the controller was isolated. Letting the magic smoke out of you OR your laptop is not a good thing ...

mikey


The 220V AC to DC power supply is a system that provides a 330VDC/40Amp pulse. It is used to create an electromagnetic pulse with a coil. The PIC switches the power supply on with a relay, measures the ripple of the 330V DC an control the transistor that pulses the 330VDC/40AMP signal.

Bottom line is .... I need to have OVP on my PIC in/outputs that can handle up to 330V
gpsmikey



Joined: 16 Nov 2010
Posts: 588
Location: Kirkland, WA

View user's profile Send private message

PostPosted: Wed Dec 01, 2010 5:40 pm     Reply with quote

That is what I would consider a somewhat "hostile" environment ! There are two issues here - one is measuring the ripple - if you use a simple voltage divider, it also divides the ripple down as well. If you use a 300v zener (or multiple zeners - I'm not sure just what the upper limit is on zeners), then you get 30 volts with the full ripple still on it that you can divide down. You still have the issue of the controller being directly connected though and where you really get into trouble (as you discovered) is when you hook something from outside (pic programmer/laptop) up. If you do need to get signals out from the controller, I would look at opto-isolators. Another concern is driving the relay - you need protection there from the inductive kick from the relay coil (you may already have done that). As far as the input on the PIC goes, a 4.7v zener should work as a clamp, but you need to make sure there is enough resistance in series with the zener so you are not driving too much current through it. 300 vdc is definitely enough to make your ears wiggle ....
Hopefully one side of the supply (negative) is ground referenced so that makes it easier to work with. If it is floating, the interface is definitely a problem with outside hardware.

mikey
_________________
mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Thu Dec 02, 2010 1:05 am     Reply with quote

Your description of your high voltage interface is too vague to understand possible problems. Having a voltage divider is one thing, it can safely reduce a high voltage if designed correctly, but it doesnt't solve the problem of a directly connected circuit grounds. It's not unusual that e.g. UPS converters or home appliances have microcontrollers directly connected to the mains supply. But then you can't touch the circuit or even connect a programmer to it. For development and test, a safety transformer must be used - or complete isolation of all measurement and programming equipment. A employer would be strictly required to occupy only qualified persons with respective activities and to provide correct instruments, otherwise he can be hold responsible for possible injuries.
Ttelmah



Joined: 11 Mar 2010
Posts: 19366

View user's profile Send private message

PostPosted: Thu Dec 02, 2010 3:14 am     Reply with quote

Seriously:
1) Why not use opto coupling?. If dealing with 'measuring ripple on 300+ volts', would consider this the 'first choice'.
2) If using any form of resistive divider, look carefully at the maximum voltage rating of the resistors, and consider always using two resistors, _each_ rated for the full voltage likely to be encountered, in series. Then no single resistor failure can directly couple the voltage through the circuit.
3) Similarly with capacitors, look at their 'failure modes'. This is why there are things like X2, ratings, where the capacitor is not only certified to handle a voltage, but the failure mode is also specified...
4) You talk about the PIC switching on a coil. You have the obvious voltages involved in your supply, but also the stored energy in the coil, when you switch this _off_. The thing most likely to lead to circuit damage, is the latter. If not properly clamped, you can easily induce 50KV with circuits like this. Start by ensuring that your peripheral circuits round the coil properly clamp this somewhere...
5) Remember you can measure 'ripple', by measuring 'from' a small capacitor charged to the average voltage. Use this as your reference point, and then a much simpler circuit can just measure the voltage relative to this point. You could even consider (for example), having a battery powered basic PIC like the 12F675, sending the measurement 'down' digitally as a pulse train across an opto-coupled interface. Cheap, and _safe_. If you don't want battery power, then a small DC-DC isolated converter could supply the rail to the high side circuitry. You can do it without the high side PIC using one of the isolated linear opto-coupler circuits, but these tend to be relatively costly.
6) Use 'belt and braces'. Have a simple Thyristor crowbar on the supply feeding your main processor, set to trigger at say 6v, and rated to handle significant power, with fusing in the supply line. That way if your isolation fails somewhere, and the PIC supply starts to get pulled 'upwards' by a spike, the whole circuit will short out, and kill the supply.

Best Wishes
wireless



Joined: 02 Nov 2003
Posts: 16
Location: London England

View user's profile Send private message

Off line hazards
PostPosted: Thu Dec 02, 2010 4:34 am     Reply with quote

Hi

I have used many PICs with simple capacitive dropper type 240VAC offline supplies. However, unless you use an isolating transformer you CANNOT go near or connect any programmer, scope etc to the cicuit!!

It is unlikely anything failed in you circuit and certainly adding zener diodes etc, will not help. If you are fortunate with all the wiring in your house, the side of your PSU you regard as 0v/GND will be connected to the mains neutral and even this can be 20-30 volts above real earth. Worse case is your 0V/GND will be at full mains potential above earth , this condition being indicated by smoke signals from any electronics like laptops unlucky enought to be connected through USB etc. Also, a severe danger of death by electrocution for anybody working on the circuit

Please take up the suggestions of using a low voltage transformer to isolate your processor etc from the mains. You can still sense the mains voltage but connect to your electronics through very large (HV rated ) resistors e.g.10Mohms. Personally I would use a cheap op amp with the +ve and -ve inputs going to the mains live and neutral resistors with a suitable feedback resistor to set the gain. You could do it with a potential divider and run the PIC with differential inputs.

Please buy a transformer.

Keep Safe

Regards Terry Exclamation
temtronic



Joined: 01 Jul 2010
Posts: 9173
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Dec 02, 2010 6:44 am     Reply with quote

Ttelmah is right, use opto-couplers ! Once you get the values right works like a charm and a whole lot safer for you and the PIC.
Did that with a multicoil(8) rail gun that shot 3/8" ballbearings few years ago. Sigh...time flies.
levettp



Joined: 07 Sep 2003
Posts: 17

View user's profile Send private message

PostPosted: Thu Dec 02, 2010 7:14 am     Reply with quote

Thanks a lot for the advice everyone ... I am really overwhelmed with all the ideas.

@Ttelmah: With regards to your point 4: I do clamp the back EMF of the coil. This voltage is actually what I am interested in. Don't want to bore you with irrelevant info but my application is a pulse induction metal detector where variation in the back EMF signal on the coil is analyzed.

What I am going to do as first order precautions are as follows:

1- Implement opto-couplers on digital outputs from PIC
2- Revise the specifications of my voltage divider resistors and use 2 in series as Ttelmah advised
3- For A/D protection either use a precision isolation amplifier (e.g. ISO122 form Texas Instruments) or add another PIC to do the A/D on high voltage board and send data with TTL signal via an opto-coupler to main PIC processor.

I am still investigating the other ideas but once again ... thank you!
Ttelmah



Joined: 11 Mar 2010
Posts: 19366

View user's profile Send private message

PostPosted: Thu Dec 02, 2010 3:53 pm     Reply with quote

How is your clamp done?
What is the voltage rating of the switching FET?.

There are two routes for the problem. One is through the voltage divider, the other is through the FET. It is surprisingly 'common' to see the FET going momentarily over-voltage, and conducting back from the drain to the gate, and then into the PIC, when the coil is switched off. Given you want to see the voltage, you must have a fairly 'soft' clamp. It is possible that this is the problem area. Remember also that there is very significant capacitance between the gate and drain, so that quite high currents can flow here....

Best Wishes
levettp



Joined: 07 Sep 2003
Posts: 17

View user's profile Send private message

PostPosted: Fri Dec 03, 2010 1:57 am     Reply with quote

@Ttelmah:

I use the Differential Diode Protection method as described in figure 4 - http://www.maxim-ic.com/app-notes/index.mvp/id/4035

R(limit)= 10MOhm
Diodes= 1N1418

I use 6 diodes in series (both directions).

With 12V pulses the back EMF reaches -400V. With 330V pulses I am not sure what it is but I expect it to be around -11000V. This is a concern to me! I am only interested in analyzing the signal when it is between -5V and 5V.

The switching FET is an IRF740 (400V, 10Amp continuous & 40Amp pulsed).

I'm pulling the gate down to 0V with a 1MOhm resistor and the PIC output then connected to the gate. On this signal I am now implementing an opto-coupler.
Ttelmah



Joined: 11 Mar 2010
Posts: 19366

View user's profile Send private message

PostPosted: Fri Dec 03, 2010 3:03 am     Reply with quote

Um.
This is not the answer to the question I asked....
This is showing input protection for things like your circuit reading the voltage.
You have a PIC, driving a MOSFET gate. The drain of the MOSFET, is presumably driving the coil. It is this point where the inductive spike is being generated.
Now, when the drive is released, this point shoots up. You are already talking about seeing 400v here (how is this being measured - unless you have a measurement system able to read this with many MHz frequency response, the instantaneous voltage here will already be past the '400v' you are referring to), The FET itself, only has a rating of 400v. You are then talking about the voltage possibly going to 10KV. Problem is that your FET, though turned off, is still across this voltage.

Realistically, why do it this way?.

The spike, is dependant on the energy stored in the magnetic circuit, and the voltage is limited by the first thing to break down, and the capacitance's across this point!. Why not clamp the spike, into a capacitor that is discharged while the coil is being energised. Choose the right value capacitor, and a diode with a good instantaneous current rating, and the voltage won't go above perhaps a couple of hundred volts, keeping everything 'inside' the rating of your FET. The voltage across the capacitor then becomes directly proportional to the energy in the magnetic circuit when the switch was released.

I think you are possibly confusing two things.

Back-emf, is the current flow produce in the coil, 'fighting' you as you energise the circuit. It is the inductive spike on switch off (which is _not_ back-EMF), which is the circuit killer.
Are you wanting to measure the back-EMF, or the inductive spike?.
Both _will_ change with the presence of other materials in the magnetic field.

Best Wishes
levettp



Joined: 07 Sep 2003
Posts: 17

View user's profile Send private message

PostPosted: Tue Dec 07, 2010 1:34 am     Reply with quote

"Why not clamp the spike, into a capacitor that is discharged while the coil is being energised" ... I am not sure what you mean by this. Is it similar to the first schematic on http://datasheetoo.com/search/inductive+spike+clamping only with a capacitor in series with the clamping diode?


"I think you are possibly confusing two things." ... Yes I did confuse terminology and thank you for correcting me. I want to measure both back-EMF and the inductive spike.

Thank you for your help
Ttelmah



Joined: 11 Mar 2010
Posts: 19366

View user's profile Send private message

PostPosted: Tue Dec 07, 2010 3:28 am     Reply with quote

Thing is you want to measure the energy stored in the coil when it releases.
Now, one standard way of clamping, is to have a diode feeding into a capacitor, and have this discharged by a resistor. However the problem with this from the measurement point of view, is that the voltage will depend on the rate of the spikes etc., and the timing after the release.
What I was suggesting, was having a standard clamp diode, feeding into such a capacitor, but instead of the discharge resistor, having perhaps a second FET. Then while the coil is energised, you turn on this second FET, to discharge the capacitor. Release this, then release the coil. The energy in the spike then gets transferred through the diode, into the capacitor, and you can measure this as a voltage, then discharge after measurement, before the next cycle.

Best Wishes
levettp



Joined: 07 Sep 2003
Posts: 17

View user's profile Send private message

PostPosted: Wed Dec 08, 2010 3:01 am     Reply with quote

Interesting idea. Will give it a try.

Thank you for your advice!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group