Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to calculate resistance values

Status
Not open for further replies.

Hayee

Member level 2
Joined
Mar 4, 2022
Messages
43
Helped
0
Reputation
0
Reaction score
1
Trophy points
8
Activity points
404
Hi Guys
I want to measure AC voltages (220v-Neutral) in Microcontoller using ADC port. I want to use the following circuit.
1646395421703.png


Can you tell me how to calculate the values of resistance, so that when there is 220V AC at input, microcontroller should read 4v.
I know this is some basic question but I want to know how to do that.

Thanks
 

Is uC power supply floating against AC input? Otherwise the measurement doesn't work, you need difference/instrumentation amplifier.
 

What is meant by floating power supply? uC is powered by 5v regulator (LM7805)
 

Floating means floating, not grounded, even by Y capacitors, not connected to external devices. With equal divider resistors, uC circuit must be allowed to float to mains midpoint (110 V to ground), otherwise the voltage reading will be incorrect.
 

Dear FVM
My supply circuit and Sensing cct is as follows
1646462910585.png


I think it is not floating. What do you say?
 

Hi,

Safety first: mains voltage is dangerous. You need to follow safety regulations. Simply using (high ohmic) resistors rated for mains voltage gives no safety. Example: transformers (220V ones, like you use for power supply) usually are tested with 5000V AC between Pri and Sec.


From what we see your power supply is a floating one = isolating between Pri and Sec.
But we don't see the whole thing.

Your measurement needs a "very good " isolation between Pri and Sec.
Every wire (USB / RS232...), even a metal box (needs to be earthed) will cause some current to flow. Even if there is no physical connection there will be stray current even capacitive current ..

Thus - I agree with FvM - this is no good method to measure the mains voltage.
It's rather difficult to calculate the part values. How much measurement current is allowed, what max DC voltage ripple do you allow....

So basic questions are:
* what precision do you expect (please give a value, no text).
* what resolution do you want?
* where does the DC value go to?

There are several solutions (assuming to use a microcontroller with ADC):
1) my vavourite is using two ADC inputs in "differential mode".
From each mains: R1 --> C1 --> R2 --> ADC_Vref/2
R2 --> ADC
Simple hardware. Precise math. But needs interrupt controlled ADsampling and a bit of software to calculate RMS.
--> perfect results, even with distorted sine.

2) INA --> precision rectifier --> 2nd order LPF (DC) --> ADC --> (x 1.11).
A lot of hardware effort. But you get a DC value and need only one ADC input. The ADC result represents the "rectified average" value, thus it needs to be multiplied with 1.11 to get the RMS value.
--> simple software, good only for non distorted sine. But suppresses noise.

3) use your power supply transformer. If the load current is stable, then you may just use the bulk capacitor's voltage.
If load current varies, then maybe use single side rectifier. Positive halfwave for power supply, negative halfwave (D, R, C, R, Opamp) for voltage measurement.

4) use an extra transformer just for measurement.

Others)There a lot of them. Many of these solutions suffer from problems with isolation. Many of them suffer from noise pickup (especially those "peak" measurement solutions)

Klaus
 

Oops. So this small circuit have so many considerations.
I have no idea what to consider and what not. So it is better to start with Op-amp circuit as you guys are suggesting.
Are you guys are talking about the following circuit?
1646479813395.png
 

Hi,

this is just a difference amplifier. It´s not as good asn an instrumentation amplifier (INA), but it works.

The OPAMP_output is "+5V+AC"

So if you have clean and stable +5V available as well as 12V, then use it.
You sitll have to do the "interrupt controlled samplig" + software math to get the RMS value.

Sadly you come with a new situation, but don´t tell us about precision, accuracy, microcontroller.
So our help is limited.

Klaus
 

My bad.
Microcontroller I am using is PIC18f452. It has an 10-bit ADC
1646555460625.png


I want microcontroller to detect 1V variation of AC voltage. e.g 230VAC --> 231VAC -->232VAC

Yes the output of the above mention circuit is "+5V AC" which requires some more math's in microcontroller and the routine will be interrupt base and I don't want that. What I want is ADC port should read DC volt then I apply some formula to convert it into AC Volts.
 

Assuming your 18F452 circuit draws fairly steady current so the loading on the transformer doesn't fluctuate, your easiest solution is just to scale then measure the voltage at the input of the regulator. It is already DC, ground referenced and proportional to the line voltage. If you need a faster response to voltage changes, use a single diode and smaller capacitor in parallel to the + side of the bridge.

Brian.
 

I think it is not floating. What do you say?
No, it is indeed floating.

The top three ground points are not connected to mains side. You have a transformer that provides the floating supply.

The three ground points (near the top half) and the three ground points are connected. That is important because the bottom half of the circuit is not isolated. The diodes are not very effective in providing isolation.

You already got several ideas: you need to select one.

I like Klaus's solution #1: use 2 ADC in differential mode. You should be able to get 100 readings every 20 ms.

But you do not like that. Yes, you need more programing.

How about Brian's solution?

But you have not fully specified your requirements.

Yes, you can measure 1V out of 220/230V with a 10bit ADC. But you will not get rapid updates.

Good luck!
 

It would require some independent measurement to find the exact voltage drop but if the temperature is fairly stable, you can drop some of the DC using a Zener diode and measure the remainder. For example, if the voltage at the input of your regulator is nominally 10V, you could drop say 5.1V in a Zener and read the remaining 4.9V through the ADC. It expands the scale at the expense of some temperature drift but may still give more resolution than a simple resistor divider. You can calibrate in software afterwards.

If you do use a resistor divider, take note of the data sheet, it explains how you should keep the impedance at the measurement point low to avoid other problems.

Brian.
 

I prefer total isolation for the measurement, such as using the transformer suggested by Brian.
That avoids having dangerous 220Vac anywhere but at the transformer input.
 

Hi Guys,
Thanks you for your valuable suggestions and support.
Let me explain what I am going to do.
I brought a kit from market which is called 3 phase protection device. If any phase from the 3 phase get too high or too low it will turn OFF the relay. The relay is connected to the external Magnetic Contactor and is driving the load.
Following is the picture of this protection device
Front Side:
1646656272816.png


Back Side:
1646656334748.png


In this Circuit, Voltages of 3 phase are measured by mentioned bridges as I showed you in circuit diagram.
Microcontroller Name is not written as the manufacturer removed its name.
Power supply is created by only 1 phase, not from 3 phase.

Following is the circuit which i have trace and understand so far
1646657447529.png


How this circuit is working? is it very badly designed or properly designed?
It is some low cost solution and i want to develop this using microcontroller and want to add LCD and keypad to set some parameters.

So guys guide me about this. I know you already have guided me.
If it is not the perfect solution then i will go for the solution which you guys are telling me.

waiting for your kind response
 

Due to having multiple parallel "differential" resistor/rectifier networks, you get crosstalk and modified scaling.
 

Hi,

I´m not sure... Did they really use 0805 (or in best case 1206) size resistors for the high voltage dividers?
They may be rated for 150/200V but without any safety margin.

There are different values: [nominal operating voltage] and [safety (test) voltage]

I can´t see how two 0805 (1206) resistors in series can fulfill safety regulations regarding creepage distance and clearance.

They used milled slots between N and L (not safety relateed, just operational) but used tiny chip resistors on saftey critial paths. I won´t use it.

It`s not clear to me how this PCB is used, whether it is capsulated in a plastic box, or wheter there are other parts that provide safe isolation...
But even at the relay and the transformers I don´t see true safety isolation.

Klaus
 

Can you guys guide me how to start with the Instrumentation Amplifiers?
Is there any document which is related to AC measurement with Amplifiers?
 

Hi,

Did you do a search?
I guess there are million documents that explain how to set up and use an instrumentation amplifier.
I recommend to read through a couple of them and then tell us what you exactly need to know.

But an instrumentation amplifer does not give a DC output from an AC input.
Only you know about waveform about timing and what you mean by "AC value".
(RMS value, amplitude of fundamental, rectified average, or some undefined "peak to DC" or something inbetween.

There are many applications ... and many possible solutions.

If you mean "RMS value" from a random input signal, then you need to use an RMS-to-DC converter
(as said: I´d write a couple of ISR lines instead)

......
Some examples:
I guess you talk about mains voltage. In some areas of the world there is rather clean, undistorted sine. Stable amplitude, stable frequency. In other regions the wavefrom is more distorted, more noisy and the RMS voltage as well as the frequency is not stable at all.

In my region the frequency is 50Hz +/-0.1Hz. The waveform looks like sine on an oscilloscope but one may detect a slightly flattened top. The voltage is nominally 230V RMS and is regulated by the distribution site.
Usually a noise and distorted sine has some peaks. So if you measure the "AC Voltage" with a diode-capacitor you get a bit higher output value than with a clean sine.

But in our region - due to the flat top and low noise - the diode-capacitor output gives lower values than with a clean sine.

So you say you want to differ between 230V and 231V. This means you want a "precision" that is better than 1V.
But if I do understand right, then "accuracy" is not that critical.
If you want an 1V precision, I recommend to target for at least 0.25V resolution.
accuracy = absolute value
precision = repeatability
resolution = step size

In detail it´s not that easy. And if you don´t want you don´t need to understand all the details.
But you need to tell us about your application. Why you want to do aal this. What do you use with the AC value, what timing do you need. .. no solutions. Just your idea about the overall function of your device.

Klaus
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top