I am designing an ADC front-end circuit that will accept a 230 Vrms mains connection. My goal is to measure the RMS voltage of the mains.

Though not really necessary, I think it would make sense to galvanically isolate the mains voltage from the rest of the board.

This entails using either digital isolation or analog isolation between the mains section and the MCU section of the board. I was just reading the National Instruments white paper on isolation types and am now wondering what the most cost-effective way of meeting my self-imposed isolation requirement would be.

Analog Isolation: enter image description here

Digital Isolation: enter image description here

For the gain amplifier section of the front end, I plan on using precision resistors to scale and offset the AC input:


simulate this circuit – Schematic created using CircuitLab

According to the white paper, the only real benefit of going with analog isolation is that the isolation barrier comes before the ADC, thus adding a modicum of protection to the ADC inputs. The downside is that this method introduces offset, gain, and nonlinear errors into the measurement and have a reduced operating bandwidth compared to digital isolation techniques.

According the white paper, digital isolation topologies also tend to be less expensive to implement than their analog isolation bretheren. I have been unable to confirm this, however, as I look through datasheets for the parts needed:

Parts common to both approaches:

  • $4.50 for Isolated power supply for isolated section (i.e. R1SE-0505-R )
  • $1 for Voltage reference for ADC gain/offset resistive adder (i.e. MCP1501T-33E/CHY)
  • $2 Precision gain/offset resistors

Parts for digital isolation:

  • $11 ADC with integrated isolated serial output (e.g. AD7402)

Parts for analog isolation:

  • $3 Isolation amplifier (e.g. LIA135STR)

  • $2 precision gain/offset resistors on MCU side of isolation barrier

or, in short: Digital = $20 | Analog = $12.50

I'm guessing that this whitepaper assumed digital was cheaper because there is not already an ADC available that can be used, however in my application I have an ADC available on the MCU.

I am hesitant to spend $20 to use a digitally isolated topology, especially since I already have an ADC that I can use. On the other hand, I am weary of spending $10 for an analog isolation topology that doesn't really have precision.

There has to be a less expensive way to do this, isn't there?

I am starting to think that perhaps I should just scrap the idea of having isolation, or perhaps that I need to start looking at simply using a step-down transformer from mains to MCU board for isolation and live with the fact that the signal I am measuring will have a different shape than the mains voltage. Thoughts?

UPDATE As @DanMills has pointed out, another option is to just use a 230VAC transformer on the incoming mains power to accomplish analog isolation. A search of Digikey shows that the least expensive transformer rated for 230 VAC is $6.80 (canadian):

So, still pretty pricey, but definitely a bit more palateable. The downside of this approach obviously is that it distorts the incoming waveform and wastes energy.

  • 4
    \$\begingroup\$ Be fair and choose an ADC with similar capabilities to your uC's ADCs (8 or 10 bit rather than 16, and 100's of kSa/s, not ~1 MSa/s). Then add a low-cost digital optocouplers, Digikey has them from $0.63 per channel. \$\endgroup\$
    – The Photon
    Dec 5, 2016 at 18:39
  • 1
    \$\begingroup\$ My hunch is that you can do the digital isolation cheaper [particularly per-channel, if you have multiple channels], if ADC and isolator are separate chips. In light of that, let me ask you... How many ADC channels? Are you sure one will be enough as your design evolves? How much data? How many samples? How many bits of depth? Do you have a preference for the digital interface (I2C, or SPI, or such)? \$\endgroup\$ Dec 5, 2016 at 18:39
  • 1
    \$\begingroup\$ If this is a solo project, I see no difference between $12 and $20. If this is a prototype for a mass produced design, these prices are insanely high anyway. Also, you didn't say how accurate do you want to measure the waveform, nor do you plan to capture fine details of amplitude shape and phase. \$\endgroup\$ Dec 5, 2016 at 18:45
  • \$\begingroup\$ @AliChen This is for a mass produced Design \$\endgroup\$ Dec 5, 2016 at 18:53
  • \$\begingroup\$ @NickAlexeev I'll be measuring DC (positive) signals with the ADC on-board the MCU. I assume I can only measure one AC signal per ADC (since they may be out of phase, thus requiring isolated grounds per signal). Looking at probably around 2500 samples/second at 12 bits resolution. Preference for serial comms would probably be I2C. \$\endgroup\$ Dec 5, 2016 at 18:57

5 Answers 5


As a general rule of thumb, AC mains voltage should always be isolated by a transformer or some type of isolation device. There should also be some way to limit both current (fuse) and voltage (TVS or MOV) on each line.

Depending on your plans for this application and where you intend to sell it, you will likely have to go through some type of UL or CE certification. Take a look at IEC 61010. That document covers many of the basic tests required.

When making decisions about required isolation, you have to consider the environment(lab bench, outside, can it get wet?), the enclosure, clearance distances, and what happens when things go wrong at a minimum. Say a resistor or diode in the design fails short, does your design start a fire? If something did catch fire, could the fire spread out of the box? Could someone be shocked by touching the box if a wire came loose? These are things you have to think about before trying to measure mains voltage. They also determine the amount of isolation required.

To answer the original question which was about cost. I've tried both approaches. Both work but I usually prefer digital isolation. In older products, isolation was usually done in analog space. The front end was typically a differential op amp with several large resistors in series with the inputs with protection diodes followed by an ISO124 for galvanic isolation. An ISO124 is not a cheap part ($19.85) but it is tried and true. It does have limitations such as bandwidth and offset voltage that have to considered. It is also bipolar. Many MCU AtoD's cannot handle any voltage below 0V. Since you are measuring an AC signal, you may have to use a seperate AtoD.

The really cheap isolation op amps are usually intended for measuring current across a shunt and have a small input range. Although you can divide down the input signal using precision resistors, signal to noise ratio will be impacted. Also gain may vary from channel to channel. This may or may not be an issue for your application. It depends on the accuracy you are trying to achieve. The small input range has usually been an issue for me so I haven't tried this approach although it could work.

I've also tried digital isolation. Digital isolators are plentiful and cheap. I've personally used digital isolators for CAN bus, I2C, and SPI. Typical front end is usually some type of filter circuit followed by an opamp, and then AtoD. The AtoD is isolated from the MCU using the digital isolator. Since the AtoD is upstream of the isolator, the quantization noise of the isolator does not have to be considered. This produces a more accurate measurement with a wider bandwidth.

One final point. Safety always trumps cost and should be your primary concern.


Given the ridiculously low prices of MCUs with decent on-board ADCs, the simplest way to do it would be to do digital isolation between MCUs. Simply treat a small single-chip microcontroller as a "custom" ADC and digital modulator in one. That way you have full flexibility in choosing the format of the isolated digital signal to match your requirements.

E.g. if you only need to measure the RMS value, you can run the ADC at maximum speed and calculate the average between zero crossings, and send only that value to the isolated side on a slow-speed link, using a cheap optocoupler driven directly from the MCU. The MCU and the optocoupler have very modest power consumption requirements, thus you can power them directly from the mains line you're monitoring using a series capacitor, resistor and a cheap shunt voltage regulator, perhaps just a Zener diode would do. The ballpark price of the high-voltage side could be just a bit over $10 in qty 100 or thereabouts.


Any reason not to just use a miniature PCB mount mains transformer at the input of the thing and measure the secondary? Instant isolation, no need for power on the non iso side of the barrier, readily available with any safety certification you like and cheap....

Now if you are trying to measure detailed harmonics or fast transient events this may not cut it, but for many applications a miniature PCB mount mains transformer is entirely appropriate, a modest load resistor on the secondary will help with performance in most cases.

As to the digital isolation, depending on the speed you need, a jellybean 6N137 will do 30Kbaud or so, and there are some very small micros these days to encode the ADC output into something async that will pass the opto...

On the analogue side, do not discount things like the IL300, old school but still very useful.

And yea, chip vendors tend to publish white papers favouring their solutions, in much the same was as the marketing department write the front page of the datasheet....

  • \$\begingroup\$ One quibble with this answer: National Instruments is not a chip vendor. Although the same principle holds for instrument vendors. \$\endgroup\$
    – The Photon
    Dec 5, 2016 at 18:43
  • \$\begingroup\$ @DanMills I think you are probably right to say that a PCB mount mains transformer is likely the best way to go for now. I don't think that I'll need to measure fast transients and harmonics at the moment, but I was hoping to have that option a bit further down the road. I guess the bottom line is that if I can build that future-proofness into the design for a reasonable price ($5, not $20!) then I'd consider it as money well invested instead of just using an isolation transformer. \$\endgroup\$ Dec 5, 2016 at 19:00
  • \$\begingroup\$ @DanMills It would appear that the cheapest mains transformer on DigiKey is $6.80 .... digikey.ca/short/3541pd \$\endgroup\$ Dec 5, 2016 at 19:22
  • \$\begingroup\$ @macdonaldtomw, You said this design is for mass production. Why do you care what's the price on Digikey? \$\endgroup\$
    – The Photon
    Dec 5, 2016 at 20:02
  • \$\begingroup\$ @ThePhoton I wasn't aware that sourcing parts for mass production from DigiKey was frowned upon, can you elaborate? When I say mass production, I am talking about 100 units. \$\endgroup\$ Dec 5, 2016 at 20:08

I'd suggest you center your design firstly on the required U/L certified isolation. Pick a really decent U/L rated optoisolator such as the OPI1268S: http://media.digikey.com/pdf/Data%20Sheets/Optek%20PDFs/OPI1268S_Brief.pdf
You already have a decent power supply selected.

Now you can let your whole measurement front end (micro and A/D) float at mains voltage. It would appear you don't need high speed A/D (from your selection), and if you can make do with a 10 bit A/D then you could use something as simple as an Arduino Nano for the frontend then driving the optoisolator to your backend.

Parts: $4.50 for Isolated power supply for isolated section (i.e. R1SE-0505-R ) (1 kV isolation U/L certified)
$2 Precision gain/offset resistors
$4 Arduino Nano (http://store.gravitech.us/arna30wiatp.html)
$6.60 OPI1268S (http://www.digikey.com/product-detail/en/tt-electronics-optek-technology/OPI1268S/365-1562-ND/2744562) (2 kV isolation U/L certified)


About the picture (do not understand ? ) with resistors R4 and R3 , @ 250V ac, peak 400 Vdc). Be aware that resistors are specified with a rating voltage (... 100V ?)... if you use SMD parts ... Verify that 2 resistors are enough.

Why not used a transmission throug nRF circuitry ? All problems are resolved about isolation.

  • \$\begingroup\$ You are digging up a lot of old questions and answering them. That's not bad if you have something new to add, but you are suggesting things for the person who asked the question to try out. That's unlikely to happen given that the question is 5 years old and the person who asked it hasn't been around for like 8 months. \$\endgroup\$
    – JRE
    Jun 11, 2021 at 13:48
  • \$\begingroup\$ You are right. But some responses are also being read by new users right now. It's also interesting to give the current solutions, isn't it, if they are ? \$\endgroup\$
    – user288518
    Jun 11, 2021 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.