Horrible analog noise on Metro M0 Express

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
ericwertz
 
Posts: 93
Joined: Sun Jun 01, 2008 4:18 am

Horrible analog noise on Metro M0 Express

Post by ericwertz »

noise on cheapo CH-340G Uno clone
noise on cheapo CH-340G Uno clone
analogNoise-CH-340G-Uno.png (38.58 KiB) Viewed 2430 times
noise on Metro M0 Express
noise on Metro M0 Express
analogNoise-MetroM0Express.png (125.17 KiB) Viewed 2430 times
noise on Arduino Zero
noise on Arduino Zero
analogNoise-Zero.png (56.75 KiB) Viewed 2430 times
I've got an educational shield that I've been testing on the Metro M0 Express, with the hopes of using the MM0E with both Arduino and *Python.
I'm experiencing a large amount of noise on every analog channel that I've looked at (on both of my boards), well in excess of the noise that I see on the Arduino Zero, or even a $6 Uno clone with a CH-340G on it.

The noise is so bad that a pot dialed all of the way down to one end almost never returns 0 from analogRead(). I've never seen this on ~1000 SainSmart Unos that I've tested (that weren't DOA), genuine or clone Leonardos or Megas, genuine Dues, or my one Arduino Zero. Perhaps it's the case that the low-end of the ADC range is somewhat offset from zero for the SAMD21, but I don't see this same behavior on my Arduino Zero. None of the analog inputs are floating, they're all tied to something (LM34, pot, phototransistor, etc). I've used the same shield, same USB port on the same machine, and the same USB cable between the Zero and the MM0Es. The pot is a 50K linear pot connected between IOREF and GND on the shield, but I'm also seeing similar amounts of noise around the output of an LM34. So it's not like I'm starving the ADC for input current from whimpy sensors.

On all other than MM0E boards, I'll see only 1 ADC count diversions from an average value, but on the MM0E I can see numerous excursions as much as 10 ADC counts from average. Below/attached are three screenshots of the Serial Plotter on each of the CHeapo340G Uno, Arduino Zero and one of my two MM0Es.

The unimpressive code to reproduce these plots is also included.

I was really, really hoping to shift students over to the MM0E from Uno clones next semester so that we could move them to CircuitPython/MicroPython from C, but this is probably a showstopper.

Are/can others see the same behavior on their MM0E? Any stationary pot or voltage divider should be able to reproduce the problem. I haven't dug my o-scope out yet to see if the noise shows up on the power supply rail or the digital inputs also, but hope to do that soon.

Code: Select all

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  Serial.print  (analogRead(A0));
  Serial.print  (',');
  Serial.println(analogRead(A1));
  delay(20);
}
tia,
-eric

User avatar
adafruit_support_bill
 
Posts: 88037
Joined: Sat Feb 07, 2009 10:11 am

Re: Horrible analog noise on Metro M0 Express

Post by adafruit_support_bill »

Please post some photos of the test setup you are using.

User avatar
ericwertz
 
Posts: 93
Joined: Sun Jun 01, 2008 4:18 am

Re: Horrible analog noise on Metro M0 Express

Post by ericwertz »

It's just a shield. Same micro-B cable used for the Zero and MM0E. All graphs captured on the same laptop, same location, same few minute period. As mentioned earlier, the rotary wheel pot is connected between IOREF and GND. An LM34 (with a 0.1uF decoupling cap on its supply) is on A0 and the pot is on A1, both of which are plotted.
test setup
test setup
AnalogNoiseSetup-800.jpg (63.79 KiB) Viewed 2393 times
++tkx,
-eric

User avatar
adafruit_support_bill
 
Posts: 88037
Joined: Sat Feb 07, 2009 10:11 am

Re: Horrible analog noise on Metro M0 Express

Post by adafruit_support_bill »

Thank you for the details. I will have our analog specialists & design team look into it.

User avatar
adafruit_support_mike
 
Posts: 67391
Joined: Thu Feb 11, 2010 2:51 pm

Re: Horrible analog noise on Metro M0 Express

Post by adafruit_support_mike »

There's a strong chance the Metro M0 Express is showing you real noise that the other boards aren't fast enough to measure.

All ADCs act like low-pass filters. They have to capture a signal before they can measure it, and they do that by charging a small capacitor to the input voltage. Changes in the input signal voltage send current in and out of the sampling capacitor, so the final voltage across the sampling cap ends up being the average voltage of the input signal during the sampling period. That average filters out any noise (or real signal change) faster than the sampling frequency.

An ADC whose sampling window lasts 1ms can't see anything faster than 1kHz. An ADC whose sampling window lasts 100us will see noise in the 1kHz to 10kHz range that was invisible to the slower ADC. An ADC whose sampling window lasts 1us will see noise in the 10kHz to 1MHz range that was invisible to the other two.

People see the same kind of thing when they get a new, faster oscilloscope. They say things like, "my signals were nice and clean on the 50MHz scope, but now they're full of noise on the 200MHz scope." The answer is, "the noise was always there, you just couldn't see it before."

The ATmega328's ADC operates at a maximum sampling frequency of 15ksps for 10-bit resolution. The SAMD21's ADC maxes out at 350ksps, making it about 20 times faster, so it would be normal to see more noise based on that difference in speeds.

The best thing you could do would be to hook the input signal up to an oscilloscope and see how much noise is visible there.

The next best option is to send the input signal through an external filter so none of the ADCs are exposed to high frequency noise. Sending the signal through a 1.5k resistor and into a 1uF capacitor will attenuate frequencies faster than 100Hz, which is well below all the ADC sampling frequencies.

User avatar
ericwertz
 
Posts: 93
Joined: Sun Jun 01, 2008 4:18 am

Re: Horrible analog noise on Metro M0 Express

Post by ericwertz »

The problem is that I don't believe that any of this explains the marked difference between the performance of the MM0E and every other platform, especially the Arduino Zero which uses both the same MCU and (ostensibly) the same Arduino core code.

In the meantime I've also characterized the Feather M0 Express (FM0E), and it exhibits a bit of the same problem, but not nearly to the extent of the MM0E. I've also modified the hardware setup and even further simplified the software.

The hardware setup uses a 10cm run-of-the-mill Chinese wire jumper to connect A0 and the rightmost GND on the POWER header. I am powering and data dumping over the same USB cable and from the same laptop in every test, in the same location.

On all non-Express boards (elCheapo CH-340 Uno-clone, genuine Arduino Leonardo, genuine Arduino Zero), there's not a single non-zero value returned by analogRead(A0). On the FM0E there's both an offset of 2 ADC counts as well as 2 counts of p-p noise. Although there's (now) no offset on the MM0E, the noise is 11-13 counts p-p.

Previously I was seeing an offset of 8 ADC counts on the MM0E, but the test setup was different. The offset and noise were so bad that it would take many (hundreds, probably) samples to ever return 0 and exit my shield diagnostic sketch, which I've never seen in the past testing over 1000 Uno-clone boards. I originally found this problem by running my shield diagnostic program which (among many other things) has the tester turn the pot over its entire range to ensure that it analogRead() registers 0 and 1023 at the extremes. The zero value was sampled so rarely that the program would take a long time to ever finish -- which I'd never, ever seen before.

I see nothing suspicious of the layout and schematic of the MM0E that any obvious cause comes to mind. On the MM0E, no traces are even running under the header or the pads of the AnalogIn header, so that's not the problem. The filtering on VDDA seems reasonable. The only significant difference is that the capacitor values on +3V3 are substantially different on the output of the LREG (which is different) between the MM0E (0.1 and 47uF) and the Zero (4.7 and 10uF), IIRC.

Plots and test code are below. Oops, apparently I can only attach three attachments to one post, so I'm leaving the CH-340G and Leonardo out, but they're the same as the Zero (no noise at all -- "he's dead, Jim").

Code: Select all

#if defined(ARDUINO_SAMD_ZERO) && !(defined(ADAFRUIT_METRO_M0_EXPRESS) || defined(ADAFRUIT_FEATHER_M0_EXPRESS))
  #define Serial SerialUSB
#endif

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  Serial.println(analogRead(A0));
  delay(50);
}
MM0E
MM0E
AnalogNoiseA0GND-MM0E.png (69.46 KiB) Viewed 2352 times
FM0E
FM0E
AnalogNoiseA0GND-FM0E.png (68.19 KiB) Viewed 2352 times
Zero
Zero
AnalogNoiseA0GND-Zero.png (24.06 KiB) Viewed 2352 times

User avatar
adafruit2
 
Posts: 22111
Joined: Fri Mar 11, 2005 7:36 pm

Re: Horrible analog noise on Metro M0 Express

Post by adafruit2 »

we've got some spare cycles and will be looking at this shortly!

User avatar
danhalbert
 
Posts: 4613
Joined: Tue Aug 08, 2017 12:37 pm

Re: Horrible analog noise on Metro M0 Express

Post by danhalbert »

We've reworked the ground plane on the Metro M0, and the analog noise is much reduced: https://www.adafruit.com/product/3505#t ... ils-anchor. Thanks for noticing and reporting this problem.

User avatar
ericwertz
 
Posts: 93
Joined: Sun Jun 01, 2008 4:18 am

Re: Horrible analog noise on Metro M0 Express

Post by ericwertz »

That's great -- I'm glad that someone had a chance to look into it. Remaining question(s):

- will this work also show up in the new thru-hole version of the M0ME?
- has this same potential issue been looked-at in the context of the M4ME?
- will it be obvious when this change gets made (new version number and/or product number) ?
- when will the Eagle files show up in Github (I'm very interested in being able to compare the old and new versions, in the interests of science)

Thanks for taking a look at it.

best regards,
-eric

User avatar
danhalbert
 
Posts: 4613
Joined: Tue Aug 08, 2017 12:37 pm

Re: Horrible analog noise on Metro M0 Express

Post by danhalbert »

The through-hole version and the ground plane fix are coincident. From the product page. "As of April 27, 2018 we have updated the design to have lower analog noise, replaced the SMT DC jack and headers with through-hole headers and jack, and now ship with CircuitPython already loaded."

The simple answer is that there were some narrow places in the ground plane. Some re-layout improved that.

The M4ME is OK: we checked it.

The Eagle files will go up at some point, not sure when.

User avatar
sanotronics
 
Posts: 3
Joined: Tue Feb 19, 2019 1:53 pm

Re: Horrible analog noise on Metro M0 Express

Post by sanotronics »

Hi!

I am sorry to revive this post, but I am having a similar problem with a self made SAMD21 board based on the metro m0.

I can't seem to find the eagle files for the reworked version.

Is there any chance you could specify a bit what kind of areas were problematic as to the analog noise is concerned?

A sort of reccomendation for me?
I am in prototype phase and I need to reduce analog noise.

Thanks for any help you can give.

User avatar
kattni
 
Posts: 132
Joined: Fri Aug 18, 2017 6:33 pm

Re: Horrible analog noise on Metro M0 Express

Post by kattni »

The latest board/schematic files are now on GitHub. https://github.com/adafruit/Adafruit-Me ... xpress-PCB

User avatar
sanotronics
 
Posts: 3
Joined: Tue Feb 19, 2019 1:53 pm

Re: Horrible analog noise on Metro M0 Express

Post by sanotronics »

Thank you very much Kattni!

I see, looking at both versions at a time, that you managed to make a much cleaner and direct path to GND with the new board.

I have one question regarding the usb shield connection.

I see that you made a small ground plane for the usb shield, and connected it through a ferrite and a jumper to the board's main GND.
What is the purpose of the jumper there?

I have been reading a lot about what to do with the usb shield, and could not find a definitive conclusion, since the internet is divided about what to do.

Finally, i chose to follow the arduino zero's solution (https://www.arduino.cc/en/uploads/Main/ ... ematic.pdf), which is to place a capacitor to GND, but I'm still trying to understand which solution is to have the least amount of noise possible.

User avatar
adafruit2
 
Posts: 22111
Joined: Fri Mar 11, 2005 7:36 pm

Re: Horrible analog noise on Metro M0 Express

Post by adafruit2 »

hiya we just copied the style from earlier Arduino boards - we don't have any insight into which is better for your design

User avatar
sanotronics
 
Posts: 3
Joined: Tue Feb 19, 2019 1:53 pm

Re: Horrible analog noise on Metro M0 Express

Post by sanotronics »

so... you just copied and don't know what the purpose for that jumper is?

That doesn't seem to be very Lady Ada's style... not understanding what you copy...

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”