Teensy 3.6 DAC noise

Status
Not open for further replies.

ffro

New member
Hi I m new to this forum, so please fogive me if the question is not well posed or as already been answered.
I m using a Teensy3.6 board to read data from an encoder and then write the estimated angular position to pin A21 using analogWrite.
I ve noticed a problem and I d like to know if it is a known behaviour and if there is any way to mitigate/solve it.
The problem is the following:

After 12h of working time the analog output started to be noisy (noise range +-0.2V) which make it unusable for the purpose.
I then tried to change the ouput pin from A21 to A22 and the noise is reduced to the original values (noise range +- 0.005V).

Since i only changed the output pin without altering the circuit i can assume the noise does not come from othersignals connected to the DAQ nor from the power supply.
Is there a way to solve the problem?

thanks in advance!

The connection layout is quite simple,
- Input TTL signal A+, B+ on digital pin 6 and 7
- Analog Output on pin A21 connected to a DAQ

The board is powered using 5V from a dedicated power supply.

i used the following script:

Code:
Encoder myEnc(6, 7);

const float MPI(3.14159265358979323846);
const int nSteps(4096*2);

void setup() {
  analogWriteResolution(12);
  Serial.begin(9600);
  Serial.println("Basic Encoder Test:");
}

long oldPosition  = -999;

void loop() {
  long newPosition = myEnc.read();
  if (newPosition != oldPosition) {
    float angleRad = 2.0*MPI*static_cast<double>(newPosition % nSteps ) / static_cast<double>(nSteps);
    if ( newPosition < 0 )  {
      angleRad += 2*MPI;
    }
    
    long analogAngle = (long)(angleRad/(2.0*MPI)*4096);
    analogWrite(A22, analogAngle);

    oldPosition = newPosition;
  }
}
 

Attachments

  • teensy_noise.jpg
    teensy_noise.jpg
    80.3 KB · Views: 35
Last edited:
Very mysterious...

I d like to know if it is a known behaviour

I can't really give you an answer, other than this question, where I can say this definitely isn't a known behavior. I especially can't see any reason (regarding Teensy) why it would work well for 12 hours and then unexpectedly become noisy.
 
Does it occur if you get rid of all the encoder hardware and software? How about with a constant analogWrite() value?
 
Status
Not open for further replies.
Back
Top