# [SOLVED]AC Voltage sensing - Adding DC bias

Status
Not open for further replies.

#### vishweshgm

##### Member level 4
Hello,

I want to do a simple task. Sense 230V50Hz input via micrcontroller ADC. First I will use step-down transformer to get corresponding 5Vpk-pk.
Now I want to sens this 5V sine in range 0 to 3.3V. I understand I have to have DC bias at 0V (1.5V) . To achieve this, I found 2 circuits online

1st One: 2nd One: I need your help to understand how the above circuits work. I understand that the voltage divider decides DC bias 1.5V. But what determines the peakvalue?
Which is the better circuit

Solution
Hi,

to post#3:

lowest circuit = my recommendation. Correct.

****
Upper circuit: There is no voltage divider to step down transformer voltage.
Big transformer node is high impedance for low frequencies, thus prone to pick up low frequency noise.

****
Middle circuit:
May work. 100k is for analog range adujst.
Big transformer node is high impedance for low frequencies, thus prone to pick up low frequency noise.

***
My circuit uses less parts while I expect it to be less prone for errors / noise.

Klaus

How I'd do it:
* [GND] --> transformer --> C1 --> R1 --> [ADC]
* also: [3V3] --> R2 --> [ADC] --> R3 --> [GND]
(All three resistors are connected at the ADC node.)

You use a small transformer, maybe just 1W (short circuit proof) to step down voltage.
Mind that the 5V are for full load. Unloaded they may go up to 8V RMS, meaning about 23Vpp

How the circuit works .. and values:
R2 = R3 = 10k, they generate a voltage divider, making 3.3V/2 = 1.65V to center the ADC values.
R1 = 30k, act as the input part of a voltage divider to step down 23Vpp to 3.3Vpp. (The "GND part" of the voltage divider is R2||R3 = 5k Ohms)
C1 = 4u7, acts as 1Hz high pass filter to enable DC offset at the ADC

I recommend to add [ADC]--> 33nF --> [GND] to suppress high frequency noise and transient signals
Also: [3V3] --> (K) D1 --> [ADC] --> (K) D2 --> [GND] as overvoltage protection. Use schottky diodes like BAT85

Klaus

Oh Sorry, I forgot to mark it. Here I update it.  So from your suggestion, circuit would be like this, Am I right?

1. If I am right, The function of C1 is just for the purpose of filtering. say, If I used 1uF, It's High Pass filter with fo = 5Hz.
2. R1 decides headroom for AC and if I want to calculate Maximum Voltage that adc point in circuit can reach for 15VPk (30Vpk-pk) transformer output: Also It would be great if you can help me understand the other 2 circuits as well, as to see which components decide the headroom

Hi,

to post#3:

lowest circuit = my recommendation. Correct.

****
Upper circuit: There is no voltage divider to step down transformer voltage.
Big transformer node is high impedance for low frequencies, thus prone to pick up low frequency noise.

****
Middle circuit:
May work. 100k is for analog range adujst.
Big transformer node is high impedance for low frequencies, thus prone to pick up low frequency noise.

***
My circuit uses less parts while I expect it to be less prone for errors / noise.

Klaus

### vishweshgm

Points: 2
There is a previous thread about using small mains transformer.......it could well be inaccurate.....the thread is from approx somewhere 2018 to 2019 on edaboard

The attached is an accurate way to measure mains voltage......using an InAmp....or you can use a diff amp if you want instead if you want cheaper.

#### Attachments

• Mains voltage logger.zip
16.3 KB · Views: 69

Status
Not open for further replies.