Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: Analog Readings Unstable On MIDI Projects

  1. #1
    Junior Member
    Join Date
    Oct 2020

    Analog Readings Unstable On MIDI Projects

    I am fairly new to the world of Teensy. I have discovered something very interesting regarding analog readings of the Teensy compared to those of Arduino UNO, Pro Micro and MEGA. I will use the very same code to read 4 different pots on the UNO, Pro Micro and MEGA and the readings on my MIDI output monitor is constantly changing. I upload that same code onto the Teensy 2.0 and the 3.2 and the readings are as stable as a rock. I have spent days and days trying to get the same solid, stable analog read results from the UNO, Pro Micro and MEGA. I eventually throw my hands up and just go back to the Teensy and then, problem solved - solid, stable results. Has anyone else observed the same thing? I am perplexed by what I'm seeing.
    By the way, I am using the following library: #include <ResponsiveAnalogRead.h>
    And here is the code for reading the pots:

    void getAnalogData() {
    for (int i = 0; i < A_PINS; i++) {
    // update the ResponsiveAnalogRead object every loop
    // if the repsonsive value has change, print out 'changed'
    if (analog[i].hasChanged()) {
    data[i] = analog[i].getValue() >> 3;
    if (data[i] != dataLag[i]) {
    dataLag[i] = data[i];
    usbMIDI.sendControlChange(CCID[i], data[i], channel);

  2. #2
    Senior Member
    Join Date
    Jul 2020
    I know that the ATmega processors have rock steady ADCs, I have data acquisition boards using the ATmega328P
    that are battery powered that show sub-LSB stability (for instance slowly changing voltages produce a clear even
    staircase when plotted over time, with short periods of jitter between neighbouring counts at the boundaries, and
    fixed output for most of the time, which is the best you can expect of an ADC in the real world)

    There are gotchas to avoid - the supply voltage should be clean, avoid driving varying/PWM high current loads
    from the same supply as those will modulate the supply voltage. Also the source you are measuring needs to
    be low-impedance, 10k or less. I suspect the difference between the setups is leading to the difference you

    I also note the T2.0 uses the same family of chips as the Arduinos, so will have the same ADC performance

    I'd suggest writing a test sketch to log raw analog values so you can see what the actual variation is

  3. #3
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Isle in the Salish Sea
    Any chance your code is pointing at a floating pin on the other boards? Get one pin number wrong and you will read garbage on every pass.

    The nature of the MIDI you consider 'wrong' should tell you something about the cause. Is it all four pots? Is it adjacent values or wild chatter? Is it a deluge or occasional flicker?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts