Noise on A0 when using 5V

I’m probably doing something dumb here, but does anyone know why I’m getting all this noise on A0 while using the 5V pin to power some LEDs? The readings are as expected when the 5V connection is removed.

fritzing_adc_noise_question.png
Screenshot 2015-09-07 01.28.07.png

interesting. is this the same when using external psu instead of usb?

Yes - at least when plugged through the DC barrel w/ 12v while USB is also plugged in to read the serial output (otherwise I can’t check for the noise).

2 Points to try:

(1) Have you tried running the LEDS from a separate 5v supply? If you've got 48 LEDS running (I assume that's what the "(48)" is implying in your diagram then you have the potential of 48*20mA of current which may be well outside of the Dues 5v regulator.

(2) If you have wired the diagram exactly as shown then the Analogue wire physically crosses your voltage supply to your LEDs. This may act like an antenna, picking up the noise from the close together wiring. Try to spread your wiring out and keep signal paths short.

Another thing to try might be a small capacitor on the Analogue read line to try and filter out your noise. My passive device knowledge isn't great so you might have detrimental effects to your accuracy or (more likely) sample rate.

Good Luck,

JW

JWScotSat - thanks for the suggestions!

(1) Does this suggestion mean sharing GND? If so, the same noise exists. Not sharing ground w/ the Due leads to somewhat unpredictable LED behavior. I'm not 100% sure whether the latter should work.

(2) I have a hunch this isn't the problem as the wires aren't actually close together.

I was implementing suggestion (1) wrong. Here's the winning setup:

|500x332

Okay, so not a power issue.

Next, the P9813 you're using. Is it in a breakout board or are you using the actual chip plugged into the breadboard. If it's on a breakout board can you post the data sheet.

Something to try if it's just the chip is decoupling capacitors. See Link

Place the capacitor as close as possible to your power and ground of the P9813 and possibly try it with your sensor.

Did you try a capacitor between your signal line and ground to filter the noise? What effects did it have?

My knowledge of capacitor use is limited on my own personal experience, of which I have solved a few noise issues and not had anything blow up. Of course as always; take care and don't take an online forum as gospel.

Edit: Also something to consider is your breadboard - Link

Have you tried averaging your analog reads? Say take 10 averages with every read? - Depends on your projects allowable time spent getting the data.

Edit: in case it is unclear, the general problem is solved by giving the LEDs their own power source and properly connecting ground. As for the initial problem, I'd definitely like to know exactly how the noise is caused by drawing 960mA from the Due's 5V out.

Next, the P9813 you're using. Is it in a breakout board or are you using the actual chip plugged into the breadboard. If it's on a breakout board can you post the data sheet.

It's a strip of these - http://g01.a.alicdn.com/kf/HTB1hNu.HXXXXXacaXXXq6xXFXXXy/DC5V-50-pcs-lot-12mm-UCS1903-WS2811-P9813-LPD6803-WS2801-DMX512-ic-optionally-Square-full-color.jpg

Something to try if it's just the chip is decoupling capacitors. See Link

Thanks - I assume this is the takeaway: "always put capacitors on the power supply of logic chips"

Did you try a capacitor between your signal line and ground to filter the noise? What effects did it have?

I haven't tried this yet but planning to when I figure out what kind of capacity / why. Hoping that is in http://www.vagrearg.org/content/decoupling which I haven't read yet.

Also something to consider is your breadboard - Link

Interesting. I'm about to dive into a more sensitive mic/opamp situation. From your link in the last bullet point in a list of times to not use a breadboard: "Sensitive analog electronics, such as sensor usage"

there could be capacitive coupling of the switching led voltages onto the analog electronics. it's essential to keep the digital wires as far away from mic electronics as possible. on a typical condensor mic the voltage may be amplified by factor 100, so any noise on ground or supply will be very noticable.

i assume the new supply/ground situation has the LEDs hooked directly to the same supply that's connected to the Due?

i assume the new supply/ground situation has the LEDs hooked directly to the same supply that's connected to the Due?

Actually no - the LEDs are now being powered with a 5V wall adapter while the Due is using USB.

A USB port can only supply 500mA to the Due board. The limit is from the Due board, not the USB port. And the power input port can only supply 850mA. You are just pulling too much current from the regulator/fuse, And it doesn't like it. you probably could have gotten it to work, if you used two USB ports to power the due, but this is not recommended. Your only other option is to power the due board with the external 5V Power supply, as well as the LEDs, Connected directly to the 5V pin.

Note: your power supply should be rated at least 25% more power then you need to power your project. And can be up to 200% needed power. This means if your project needs 900mA, your power supply should be rated at least 1.25A, and up to 2A. It also means that if you need anything more than 650Ma from the do board itself, you need to consider using a external power supply. The higher available current means better stability, and less noise. it also means that any surgeon power will have little effect on the power supply itself. Keeping your voltage in a safe operating range.

separate supplies. hhmm.. that means the supplies can possibly float from eachother, which is probably not what you want (in the long run). grounds should be connected at one point.

it's too bad noise problems are a purely analog issue, and hence all kinds of things may be wrong.. solving them typically requires a lot of experience..

i do not think the people here can solve them for you directly (although i hope i'm proved wrong!)..

what i can recommend in terms of EMC design: reading good tutorials on the topic, maybe the Art Of Electronics, which has some chapters on it.

in terms of troubleshooting i can wholeheartedly recommend hooking up an oscilloscope. then you'll be able to see if there's noise before the signal enters the A0 pin, and exactly where it comes from.

you probably need both of the above.

pinMode:

i assume the new supply/ground situation has the LEDs hooked directly to the same supply that's connected to the Due?

Actually no - the LEDs are now being powered with a 5V wall adapter while the Due is using USB.

So, Just to be clear, when powering the LEDS separately; your noise issues disappear?

If this is the case then it's clearly current supply issues and you've been drawing too much through the Due.

A long lesson to learn with design is that at some point you will come to a cross road and compromises must be made. This is a fact of design, you never get a system that runs "perfect" in every way, there's always something that must change to suit reality.

As suggested by JWScotSat you might want to check with one LED at first.I think its a issue of not providing enough power supply to LEDs.