Go Down

Topic: RC low pass filter (Read 2992 times) previous topic - next topic



This is going to be it for a while.

In the attached picture I added a bidirectional TVS diode. (Pardon the incorrect symbol it was the best I could do)  Even though in the picture my source is only at 120 if I over drive it it limits the potential at the analog pin to 10 volts.  Pretty awesome.

I couldn't find a spice model of a optocoupler but I found a high linearity analog one that is intended for what I'm going. "precision high voltage measurements in a low voltage environment"  I'm planning on isolating the entire circuit using the optocoupler for the analog input and an additional optocoupler for the 5v rail.  I think this will be much easier then finding a coupler and/or transformer that will isolate 120v.  (A have intentions of going higher voltage)

When I get these 3 pieces added in I will come back and share with everyone.

Thanks again!!


Good luck, That didn't work for me when I tried it in 2004... Just a simple opto with TVS diodes, Zeners and hefty clamps Opto's still blew up on average line transients... I had 6 as sensors on pumps and I lost the first 3 I sent out in the field, with transformers I lost 1 of the next 10 I sent out... This was a center pivot controller used in Nebraska corn fields to control the irrigation machines and it was a "Rural Power Grid" VERY VERY Noisy. under better circumstances a transformer might work for you... I had to make my own optoisolators... with NE2H's and CDS photocells... it was I found later the fact that I wasn't totally isolated from ground that was my real issue. That donnybrook nearly cost me my job and taught me a great deal about isolation and surge protection. My best advice now would be to build it and learn.

--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard


I'd still add an 8K resistor at the analog input.  10V is way better than no protection at all, but the analog input pin is rated for -0.5V to 5.5V, and the bypass diodes are rated fro 1mA. 

optocoupler ... I found a high linearity analog one that is intended for what I'm doing.

Tell, dude.  Manufacturer and part number.


Good luck, That didn't work for me when I tried it in 2004...
Nothing like a big old vote of confidence.  I hope it works but I'll let you know either way.

it was a "Rural Power Grid"
Welp I'm an electrical engineer for a Rural Coop sounds like I have the optimum testing grounds.

I found later the fact that I wasn't totally isolated from ground that was my real issue.
My 5v rail is going to be isolated and my analog input is going to be isolated.  At this point the only that that will blow up is the "high voltage" board and if I keep em separate it should be easy to replace/fix.  Based on your previous suggestions it seems silly for me to get to the end and not be completely isolated so hopefully that will be my saving grace.

I'd still add an 8K resistor at the analog input.
I don't exactly understand where this should go?  Are you thinking between A0 and the circuit above? or A0 to ground? I'm confused.  Either way screws up the input analog voltage quite a bit.  Can you better explain where you think this should go so maybe I can redesign my circuit   Assuming I had 10k resistance into the input and I did have a 10V fault that puts 1ma exactly on the internal TVS so I might get saved!! :)

The coupler is the HCNR200

General info:



I'd put that resistor between the analog input pin, and R3, where R3 connects to C1,  The analog input pin is a high-impedance input - the datasheet lists its input resistance as 100 megaohms - so almost no current flows into it.  Consequently, almost no current flows through a resistor that's in series with it.  A resistor with no current through it has the same voltage at both ends.  So, adding a series resistor won't change the way the circuit operates under normal conditions.  See the section, "ADC Characteristics" in the chapter, "Electrical Characteristics," in the ATmega328P datasheet.

The analog input pins have clamping diodes to Vcc and ground.  See "I/O Ports," "Overview" in the datasheet.  They don't conduct unless they input voltage is out of range.  The current needs to be limited to about 1mA - I don't find that in the datasheet, but I did run across it in application note "AVR182: Zero Cross Detector," which describes how to connect a digital pin to the AC power line.  Regrettably, that appnote leaves TVS as an exercise for the reader.

And, I find a limit of 10K for the series equivalent series resistance for an analog input pin, in the section "ADC Noise Canceller," in chapter "Analog to Digital Converter."  The intent of that limit is to allow the sample capacitor to fully charge during the sample period, which is the first tick of the ADC clock in the conversion cycle.  That keeps you from going with, say, 100K at the analog input pin.

Something in the 8K-10K range, in series with the analog input pin, seems to meet all the requirements: no inpact on normal operation, and current limiting under transient conditions.


Jun 28, 2012, 05:11 pm Last Edit: Jun 28, 2012, 05:22 pm by michael_x Reason: 1
Why do you want to see the "true" analog signal ?
Whether you use a "heavy and expensive" transformer, a capacitor, or an optoisolator in between, you'll see some different waveform than what your other mains devices will see.

In my first experiments, I was rather interested in
  1) Is the mains signal there?
  2) What's the frequency ? ( compared to what my millis() says )

I soon was convinced that pulling the blue N to Arduino GND and the brown L to whatever smart circuit was not a good idea, as you can easily plug in the wrong way.

So forget about the 120V analog signal!

I found a standard optocoupler, which I combined with a reverse biased led and two decent resistors as the very minimal circuit.
In Europe, we have 230V 50Hz, which is equivalent to 325V peak. 150k resistors result in 2mA peak, which is just sufficient to activate led and optocoupler. They take one half wave each and limit the reverse voltage for each other.
The effective power burnt in the 100k resistor is less than its rated 1/4 W. If you want/need (?) a little more current, you might take care about the power rating of your resistors, or have more - smaller ones - in series. And of course, the resistors are not on the breadboard, but directly in the power line, well isolated...

edit: How to directly show pic ?

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131