Electronic Design
Measure Your Floating DC Voltages

Measure Your Floating DC Voltages

Measuring a floating dc voltage using a microcontroller’s analog-to-digital converter (ADC), with the dc+ to dc– ranging from 2.5 to 30 V and the low side able to float as high as 120 V above logic ground, presents a major challenge.

Connecting the dc low side to the microcontroller’s reference risks ground loops. Using a resistor divider to reduce the offset would also scale down the voltage of interest, making it difficult to read accurately. Analog isolation ICs tend to be an expensive solution.

To solve these problems, start by transformer-isolating the dc voltages (Fig. 1). Then, create an ac waveform by using a spare general-purpose I/O (GPIO) line from the microcontroller to control an optoisolator (Q1) that switches the dc on and off.

Connecting a diode (D1) in reverse bias across the transformer’s primary will suppress the inductive kickback when the optoisolator turns off. Rectifying the transformer output converts the signal back to dc. Using R2 and C1 to create a low-pass filter creates a dc voltage proportional to the original ac.

The circuit uses two additional resistors, R3 and R4, for two reasons. First, they bleed charge off the capacitor that has no other path because the ADC has a high-impedance input. Second, they divide the voltage to a level within the ADC’s range. The zener diode (Z1) provides protection for the ADC.

A few notes on transformer selection and circuit layout: To protect against the possibility that the microcontroller goes astray and leaves Q1 turned on, the transformer primary’s winding resistance should be high enough to limit the input current to a safe level. In layout, take care to allow sufficient clearance distances in the isolation areas of the transformer and the optoisolator.

Test results for this circuit show that the output is quite linear (Fig. 2). A simple linear equation in the microcontroller allows dc measurements to within 2% accuracy.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish