Teensy 3.2 Strange behavior when measuring AC voltage

Status
Not open for further replies.

teensy_ino

Active member
Hello forum,


I'm trying to do an AC measurement with the Teensy 3.2 with analogRead / analogReadResolution (16) on Analog PIN A1, and I came across very strange behavior ...

A test sinus of 30 Hz with 350mVpp (measured with Rigol 1054Z) is used. The Teensy 3.2 runs on 72 MHz, USB Type Serial. Powered by USB.
The bias voltage is tapped at the 3.3 V PIN (left of PIN 23) and then divided by a voltage divider.

Code:
/*
  AC /NF analog Read

*/

void setup() {

  Serial.begin(115200);
}

void loop() {

  int Value = analogRead(A1);
  float voltage = Value * (3.31 / 1024);

  //delay(250);
  { Serial.println(voltage);
  }
}

I wired PIN A1 differently for this purpose:
1)
0.5 x Ub is directly on PIN A1, signal (sine 30Hz 350mVpp) is fed in via 220nF capacitor:

The serial monitor shows values ​​between 0.16 and 3.16 V.


2)
like 1, but without capacitor:
The signal now lacks the negative half-wave (which is definitely the case would be desired).

The serial monitor shows values ​​between 0.00 and 2.84 V.


3)
completely without bias and without capacitor, signal goes straight on PIN A1:
Here, too, the signal lacks the negative half-wave. From over 404 mVpp Input signal, the positive half-wave is cut off at the top.

The serial monitor shows values ​​between 0.00 and 2.84 V ...


If I do the same measurements with analogReadResolution (16); the values ​​at 1) are the same.
At 2 +3) the serial monitor then shows 0.00V to 3.31 V.

Code:
/*
  AC /NF analog Read

*/

void setup() {
 analogReadResolution (16); // 16 Bit = 65536 
 Serial.begin(115200);
}

void loop() {

  int Value = analogRead(A1);
  float voltage = Value * (3.31 / 65536);

  //delay(250);
  { Serial.println(voltage);
  }
}

The difference between the input signal and what the serial monitor shows corresponds to a gain factor between 8.11 and 9.45 ...
How does this reinforcement come about?

So far I had assumed that a corresponding bias voltage (as under 1) is sufficient to measure AC voltages with Arduino / Teensy ...

I am also not aware that the signal is additionally amplified simply by using analogRead or analogReadResolution (16)?


Can someone explain this behavior to me?

I would be happy if someone could help!


regards
 
What do you get with DC voltages?

Hi jonr,

With a 1.5 V battery, I get exactly the right display, regardless of whether I use analogRead or analogReadResolution (16); use ...

The result is the same for all AC or DC measurements reproducibly at all analog PINs ...
 
What does a multimeter read (at the input pin) for both AC and DC?

Hi jonr,

My multimeter shows me the correct values for DC.
The smallest AC measuring range is 2 V. The display then shows 1,178 to 1,182 V (probably RMS).

My oscillator (AC coupling) shows me Ue = 352 mVpp / 123 mV RMS.

The signal generator used is a DDS SGP 1010s, LINK


@UhClem:

The problem also occurs when the signal is applied to PIN A1 without bias and without capacitor ...
Then the capacitor size cannot be the reason for the strange behavior ...

Does anyone of you have a Teensy 3.2 at hand and could test it?


Looks like the ADC limits the input signal to around 350mVpp on the one hand, but also amplifies it by a factor of around 9 on the other ...

Is this a bug, an undocumented feature - or did I just grill my ADC?



regards
 
> The display then shows 1,178 to 1,182 V (probably RMS).
> My oscillator (AC coupling) shows me Ue = 352 mVpp / 123 mV RMS.

I'll assume "oscilloscope". When a multimeter reads ~10x more than an oscilloscope, you haven't accounted for a 10x probe. Also note that the ADC can use different references.
 
Yes, right, it should of course be called Oscilloscope ... (Google Translator ...)
It looks like it was actually due to the wrong probe head setting ... really stupid mistake...

if I now compare the oscilloscope values (probe = x10) 3.52 Vpp / 1.31 Vrms are displayed.
The multimeter (AC) shows 1.313 - 1.317 V.


Which values do the serial monitor / plotter (IDE 1.8.12) display? --- Vpp, Vp or RMS?


Which probe head setting do I use correctly for which measurement?
E.g:
I want to measure the actual output voltage on my signal generator. (It can be set, but unfortunately it is not displayed there ...)

So far I assumed that "probe head x 1.0" is the right setting for it?


regards
 
Last edited:
I think your "problem" is, the Teensy just can't output negative voltages. But that's perfectly normal.
First - Don't set the multimeter or oscilloscope to "AC"-Mode. Use "DC".
 
I think your "problem" is, the Teensy just can't output negative voltages. But that's perfectly normal.
First - Don't set the multimeter or oscilloscope to "AC"-Mode. Use "DC".


I think your "problem" is, the Teensy just can't output negative voltages. But that's perfectly normal.
First - Don't set the multimeter or oscilloscope to "AC" mode. Use "DC".

Hi Frank B.

I already realize that Teensy / Arduino cannot output negative voltages.

I stumbled upon the behavior described by chance because the question was asked what the Teensy does when AC is connected directly to the Analog PIN ...

As expected, the result was that the negative half-wave was cut off. Actually a function that I wanted to achieve with an OpAmp as an active half-wave rectifier ...
So much the better if it works that way...

The only question is how high can a negative voltage on the analog PIN be without damaging the Teensy?


Since the output voltage is not displayed on my signal generator, I have to measure it with the Oszi.
What should I set the probe of my oscilloscope to ?
1: 1 / 10: 1 etc to measure the actual signal voltage there?


What type of voltage does the SerialMonitor actually show me in order to be able to compare it at all (Vrms / Vpp / Vp)?


If I set the probe head to DC 1:1, I measure, for example, 432 mVpp / 165 mVrms which then go to PIN A1 on the Teensy.
My multimeter shows me 1.59V in the 2V AC range - almost 10 times the RMS value.
The DC value displayed is around 570 mV.

Only the positive half-wave is displayed in the IDE plotter.
The serial monitor again shows values ​​from 0.00 to 3.31 V ... confused...


I hope I could make something clearer what I'm about?

regards
 
If you directly connect AC or a negative voltage to any pin on any CMOS chip, you'll risk blowing it up
if the signal goes below about -0.5V. Never do this.

A good protection circuit on an analog input is a series resistor of a few k, with schottky diodes to ground and
Vcc to prevent the voltage on the pin straying below -0.3V or above Vcc+0.3V.
 
Status
Not open for further replies.
Back
Top