looking for transformer less circuit diagram & code to measure AC 220V

Started by hitronics, Jun 23, 2023, 10:05 PM

Previous topic - Next topic

hitronics

I am looking for transformer less circuit diagram & code to measure AC 220V
range of measuring from 130V to 350V can use 12F675 or 16F676

hitronics

I found on internet simple resistor divider connected to main line then rectify it then connect to mcu
on the other hand I found also another solution to use opamp connected to main line then output of opamp connected to mcu
so which one  is better to use to get better accuracy?

John Lawton

Unless you can accept hazardous LIVE PIC circuitry, possibly at 220-240V AC above ground (earth) then a simple potential divider won't do the job. If your circuit is grounded then measure both Live and Neutral (return) with respect to ground (using potential dividers yo ground with protection circuitry) and add the two values to give you the full line voltage. You didn't specify accuracy or how the PIC would be powered, so I can't advise further.

RGV250

Hi,
https://ww1.microchip.com/downloads/en/AppNotes/00521c.pdf
but as John points out, not the smartest thing to do.

Looking at the app note it is not going to do what you want due to the clamping diodes.

Bob

david

Transformerless powered mains circuits are usually only about 10mA and consist of a mains rated capacitor, a mains rated resistor and a shunt zener.  The capacitor value is chosen to provide a certain impedance at the mains frequency to provide a given current with surplus current being sunk by the zener. Some resistance is also necessary for limiting.  The device would have to be considered as a double insulated device and not present any metal parts to the user.
The theory is all quite simple but where things often come unstuck is when the product is presented for testing and they conduct IEC 61000-4-4 for electrical fast transient burst.  The capacitor that was chosen to present the required impedance at 50Hz (or 60) now looks like an almost dead short when a burst of very fast transients are fired at it.  This will often take out the zener, depending on the value of the mains rated resistor.
Yes it can be done but it does carry some risks and you can buy a finished product cheaper than you could buy the PIC for.

https://www.aliexpress.com/item/4000198972985.html?spm=a2g0o.productlist.main.97.17783a7fLN4XiG&algo_pvid=13aa1585-38aa-4bb5-b414-ae73d6f7d651&algo_exp_id=13aa1585-38aa-4bb5-b414-ae73d6f7d651-48&pdp_npi=3%40dis%21NZD%212.46%211.85%21%21%21%21%21%40211be3cd16876437876128248d07b1%2110000000756073550%21sea%21NZ%21916888149&curPageLogUid=nuUjdFvM7N3x

Cheers,
David

shantanu@india

Definitely doable.
We have literally manufactured thousands of IR controlled 12F675 based remote fan speed regulators based on David's concept of a mains capacitor , a bridge , a filter capacitor and a 5.1V zener diode. Use two 250V polyester capacitors in series if your main supply is 230V , otherwise increase the number of series capacitors to a safe value. Our circuit used two capacitors & never failed. PIC's are tough.
To measure AC voltage you need a zero crossing detector(easily done by connecting a 10MOhms resistance between the AC live & IOC pin of the PIC) & a voltage divider that gives approximately (2.5*1.414)V at an AC peak voltage of (350*1.414)V. This voltage needs to be connected to an ADC pin & the voltage sample is to be done at 5msec after a zero crossing interrupt occurs. This should provide a value proportionate to the mains peak voltage considering a mains frequency of 50Hz(10 msec half cycle time)
Regards
Shantanu

hitronics


ken_k

I found a copy of IEC 61000-4-4 on line it may not be the latest. http://dfv-technologie.com/doc_technique_dfv/normes_afnor/CEM/en61000-4-4%20TERS.pdf

Shantanu I guess you have a resistor in series with the capacitors as David suggested. It may be possible to use a suitable lossy ferrite bead in place of the resistor, one could run a simulation to see if it is easily doable.

hitronics Is this device going to simply display the voltage or transmit the information to another device?

hitronics

Quote from: ken_k on Jun 25, 2023, 10:20 AMhitronics Is this device going to simply display the voltage or transmit the information to another device?

I want to let 12F675 measure AC voltage value then send over bluetooth

ken_k

Quote from: hitronics on Jun 25, 2023, 08:19 PM
Quote from: ken_k on Jun 25, 2023, 10:20 AMhitronics Is this device going to simply display the voltage or transmit the information to another device?

I want to let 12F675 measure AC voltage value then send over bluetooth
Thank you for the additional information. Bluetooth sounds like a good plan. Some Bluetooth modules draw over 40mA when operating so this is another consideration. Low current Bluetooth modules are available. A power supply as described by Shantanu could be modified to suit the required current.

hitronics

can anyone help to provide circuit diagram & code to test?