AC signal 15V max to 3.3V

Thread Starter

Toni Rodri

Joined Dec 3, 2023
49
Hey
I need to measure some signals that can be maximum 15-20V. But my MCU work only with 3.3V.
What is the best way to do that?
I thought about resistors divider. there are more ideas ?
I want that the samples will be clear without noise.
Thank you Very much
 

Reloadron

Joined Jan 15, 2015
7,893
AC signal 15V max to 3.3V
Something to consider is if your MCU is like many you will need to offset your AC signal before you feed it to most MCUs or uC. Many will not take an AC signal which goes negative below 0 volts. This holds true if your AC goes below 0 volts. Use a voltage divider followed by a simple offset circuit. Voltage divider to get the voltage down followed by an offset circuit to shift your AC above zero. This only applies if if your MCU or uC cant measure below zero volts.

Ron
 

schmitt trigger

Joined Jul 12, 2010
2,118
A 20v sinewave will swing roughly 28v positive and 28v negative, for a total of 56v peak to peak.
You’ll have to fit this within 3.3v, or a 16.97 divider ratio. For easy round numbers let’s assume 17 to 1.
As others have mentioned, the sinewave has to be centered on 3.3/ 2v, or 1.6667v.
Lastly, it is a good rule of thumb to feed the ADC from a source of 10k or less.

Therefore a pair of series connected 20k resistors between ground and 3.3v, and its center point connect a 160k resistor to which you’ll feed the higher voltage. From the center point feed the ADC pin. Make all resistors 1%, all the calculated values easily available on standard value resistors.

Now, for the filtering: you should have a corner frequency at least an octave above the highest frequency to be measured, which you didn’t mention.
 

meth

Joined May 21, 2016
304
So you need peak. Also is there a chance that the voltage exceeds 20V? Because the divider will go above 3.3V - you will need some protection.
 

Dave Lowther

Joined Sep 8, 2016
332
If the AC source you want to measure is floating w.r.t microcontroller ground you could do something like this. I use it to measure the voltage from a small DC motor that's being used as a generator.
1764669093734.png
The motor may spin in either direction so J3 pin 1 can be positive or negative w.r.t. pin 2. J3 pin 2 is connected to 1/2 Vcc. R3/R4 is a voltage divider to scale down the voltage from the motor so that the junction of R3/R4 never goes <0V or >3.3V. R5 isn't necessary, it can be shorted. D1/D2 clamp the voltage to Vcc / Gnd as further protection. R8 is to limit the current through the internal mcu diodes if the input range is exceeded. AN-MOT goes to the ESP32 ADC
 

meth

Joined May 21, 2016
304
He said it is not exactly AC, so the signal can be anywhere between 0 and 15-20V, so I am guessing it is some kind of a feedback from a sensor? On the other hand the freq is 100Hz but is it sine wave? Why dont you tell us what are you measuring exactly so we skip this guessing game.
 

ronsimpson

Joined Oct 7, 2019
4,712
I agree he wants to measure a DC voltage that varies from 15 to 20V at a speed of about 100hz.
Questions:
Can we connect the ground of the computer and the ground of the voltage source. (do you need isolation)
Do you want to measure from 0 to 20V or only from 15 to 20V. (0 to 20V is most common)

How often do you need to sample? Examples: You could put a 1 second low pass filter on the front and measure 1/second and get the average of the signal. (the filter does the averaging) Or you could measure at 1000/second and plot out the waveform and do some math on it. (average or peak or RMS in software) Maybe you need to measure at 10,000/second because a small bump is important. (this helps choose what type of filter to put on the front end)

We need to have a clear picture of what "noise" you want to not see. The noise might be from the switching power supply at 200khz and above. With the signal being at 100hz. That is a simple filter. If the sampling rate gets close to the noise frequency the filter gets complicated.
 

MisterBill2

Joined Jan 23, 2018
27,706
One additional question is if the "AC SIGNAL" is referenced to anything, or is it floating? Then another question is about the frequency: Is it stable, or is the signal actually some AUDIO signal. And if the signal changes, how rapidly?? In fact, HOW ACCURATE does the measurement really need to be??
 
Top