# How do I protect against voltage surges from sensors?

I'm attempting to use a CT to measure AC current. I got a lot of information in this answer to another question which led me to huge amount investigation.

I want to measure the current in use by an AC appliance from a 5V ADC chip (e.g. an arduino, but I've got a couple different things, so it might be an arduino itself).

My first attempt involved taking the output of a CT, hooking it up to a bridge rectifier, grabbing a 10k resister and measuring the value relative to 5V off the ADC. My test appliance is a lamp with a 75W bulb. It basically worked, but was giving me "off the chart" numbers when I turned on the lamp. This made me think something bad was happening.

The other poster suggested I put a 3300 Ohm resistor across the voltage of the output. The expectation was that I'd get 680mV. Doing this with my old DMM wasn't giving me much information, so I ordered an oscilloscope and decided to see what was really going on.

This is basically my story of attempting that.

While the voltage seems to go slightly negative, the difference between my minimum and maximum seems to be the predicted 680mV. However, you can see a giant spike of 7.12V when the device is actually turned on.

I'd like to not plug 7.12V into the 5V ADC, so how might I go about suppressing that?

(I'd also like to level out the results so I can get a solid read, but that's a different problem I'll try to solve after preventing chip explosions when switches flip)

A typical and simple solution is a schottky diode (low forward voltage drop) from your signal line to +5V (anode to signal, cathode to +5V) will limit the voltage spikes to a few 100mV above +5V.
Similarly a diode to ground (cathode to signal, anode to ground) can prevent negative swings.

For something like a CT that is capable of huge voltage spikes, a TVS (transient voltage suppressor) instead or as well as the diodes might be a good idea too.

I would suggest a buffer (e.g. non inverting opamp, unity gain) in between your CT output and ADC. This would add a stage of protection before your ADC. You can use the diodes on it's inputs to protect it, and if you power it from +5V it is guaranteed not to swing higher than the ADC can handle. Also you could add a few gain taps (e.g. 1,5,10,etc) to switch between for different current ranges - this way you will be able to use the full range of the ADC better.
For instance your 680mV signal is only using (0.68V / 5V) * 100 = 13.6 % of the ADCs range. For an 8-bit ADC this equates to ~35 out of 256, 680mV / 35 = 19mV per ADC step (e.g. 00000001 = 19mV, 00000010 = 38mV, etc). If you had a gain tap of 5 (e.g 0.68V * 5 = 3.4V) it would be more like 4mV per step.

• Thanks a lot for all your help. Now that I can actually see what I'm working with, I can start to understand why most questions I ask have people suggest I buy opamps. :) Nov 10, 2011 at 4:36
• Yes, an oscilloscope is a must for working with this kind of stuff. I think you made a good choice with the Rigol, they give decent performance for a very low price. Nov 10, 2011 at 6:34
• I haven't had the best luck with this so far. I can tell far more easily when the lamp is on or off using an opamp, but I can't quite make out "levels." You can see the difference between the lamp being off and on in the following screenshots: skitch.com/dlsspy/geba3/current -- probably good enough for my needs, but the numbers are bigger than I expected. Nov 12, 2011 at 4:50
• Hmm, looks like somethings not quite right there. Hard to know what without seeing your schematic. It could be the gain is too high, the bias is not right, the opamp is not suitable in some way or connected incorrectly, etc. It should look similar to your waveform in the question, but larger according to gain. As it's a bit off topic for the title, it might be worth starting a new question for this and posting the schematic (or adding to this one, maybe Kortuk or someone can advise which is preferred) Nov 12, 2011 at 5:04
• Yeah, I don't know what I'm doing. :/ I'm using an LM358M. I've got input- (pin 2), and Vee on the same ground, Vcc on 5V, and input- and input+ coming off of the CT. I'm reading pin 2 vs. pin1 (output). I also have the 3.3k resistor across the CT outputs (after the rectifier). I don't know how else I'd do it. What I find is that the RMS goes up with input amps, but any draw takes the max from ~0 to ~3.76. My Kill-a-watt reads an RMS over a volt. Lamp + soldering iron =~ 1A and gives me 3.7V RMS. Nov 12, 2011 at 5:49

@Oli Glaser did a good job covering how to protect yourself form the sensor's spikes. I will address why they are there in the first place:

The filament used in incandescent bulbs has a positive temperature coefficient. This means that as the temperature of the filament increases, it's resistance also increases.

Therefore, for a light bulb, the filament resistance has to be chosen so that the energy dissipated in the filament in the desired wattage when it is at operating temperature. As such, the bulb's resistance will be much lower when the filament is cold.

Therefore, immediately upon connection, the bulb will draw a lot more current then normal, until the filament has heated up to the point where the energy flowing into the filament is matched by the energy the filament is dissipating (as light and heat).
Any further heating results in less power, which causes the filament to cool, which results in more heat, etc. The system reaches equilibrium.

From Wikipedia on Bulbs:

The actual resistance of the filament is temperature-dependent. The cold resistance of tungsten-filament lamps is about 1/15 the hot-filament resistance when the lamp is operating. For example, a 100-watt, 120-volt lamp has a resistance of 144 ohms when lit, but the cold resistance is much lower (about 9.5 ohms). [...] For a 100-watt, 120-volt general-service lamp, the current stabilizes in about 0.10 seconds, and the lamp reaches 90% of its full brightness after about 0.13 seconds.