Arduino Micro
2x HT16K33 led drivers (on adafruit breakout, connected to I2C)
4x analog sensors connected to the analog inputs with a 100uF and 1uF in parallel in front of them (as suggested in the datasheet of the sensors)
Everything is working like it is supposed to, but since connecting the led drivers there is a lot of noise on the reading of the analog inputs.
I connected a scope and noticed it's the 5V power supply coming from the Arduino that now has a regular noise on it (see attachment).
It starts with almost a 0.5V drop and then in the middle of that cycle again a noticable drop of 0.1V?
Maybe I should mention the current 100uF / 1uF combination is only used 1 time in front of the first sensor, the power and grounds are then parallel wired from there on to the following 3 sensors.
I suppose this is solvable by using the right capacitors in the circuit?
Is there a formula to calculate the values for the capacitors, based on the noise you see on the scope?
MarkT:
Looks like you don't have a star-ground setup. How much current do you LEDs take?
Or the power supply is being overloaded and losing regulation. Neither of those problems are fixable with just some filtering capacitors.
A minor quibble about terminology: noise is typically understood to refer to random and uncorrelated fluctuations superimposed on the signal of interest.
What you have on the scope is not noise. Since the fluctuation in your signal is so exact and repeatable it is more properly called distortion.
Jiggy-Ninja:
Or the power supply is being overloaded and losing regulation. Neither of those problems are fixable with just some filtering capacitors.
A minor quibble about terminology: noise is typically understood to refer to random and uncorrelated fluctuations superimposed on the signal of interest.
What you have on the scope is not noise. Since the fluctuation in your signal is so exact and repeatable it is more properly called distortion.
There aren't many leds connected or activated at the time of measuring:
led driver 1 draws 60mA
led driver 2 less than 10mA
current going to the sensors is 10mA
What does star-ground setup mean? All components having their separate ground-wire or -line?
The 2 led drivers are wired separate to the - and + lines of a breadboard, the sensors are on a seperate printboard which is wired to the breadboard's lines.
Star grounding isn't something I made up, google will tell you everything.
0.5V drop on a few tens of mA means you have a significant resistance in the power distribution somewhere,
about 10 ohms... How are you suppling power exactly?
MarkT:
Star grounding isn't something I made up, google will tell you everything.
Well, I googled it when you mentioned it and read about a common ground point and separate ground lines to that point, but there's more to it than that probably? I also read about separating a digital and analog ground and separate power rails, but I'm not sure I understand this or how to achieve this with the arduino.
MarkT:
0.5V drop on a few tens of mA means you have a significant resistance in the power distribution somewhere,
about 10 ohms... How are you suppling power exactly?
For now I'm just using the usb-port for power, so laptop, usb battery pack or usb adapter are currently the different power sources I've tested and are giving more or less the same results.
The few tens of mA I'm measuring with my cheap digital ampere-meter are probably not correct because it's an average over time, no? It's not measuring the mA at the exact 4.5V point in time.
dlloyd:
Lower the voltage at Vin to 7.5 or 9V.
It's getting 5V from usb.
Anyway, I will do some more testing this evening, disconnecting all leds etc. to see if there is something blocking the power distribution there somehow.
Your voltage drop is within specifications for low power (100mA). One way to ensure you have 500mA available at the USB port is to use a hub with power adapter connected.
Low power bus powered functions draw all its power from the VBUS and cannot draw any more than one unit load. The USB specification defines a unit load as 100mA. Low power bus powered functions must also be designed to work down to a VBUS voltage of 4.40V and up to a maximum voltage of 5.25V measured at the upsteam plug of the device. For many 3.3V devices, LDO regulators are mandatory.
Ok, I think I'm starting to understand what's going on by disconnecting all the leds.
I was using 2 cathodes of led driver #1 (connected to 2 x 8 leds / anodes) and 1 cathode of led driver #2 with only 1 anode / led active.
The first drop in voltage are actually the 2 cathodes of led driver #1 which had an equal amount of leds active, so these are 2 drops, you can see a little spike going up between those 2. The second (third) smaller drop is the second led driver which drops a tiny bit because only 1 led was active there.
Putting resistors before the leds would make the distortion smaller but doesn't solve the problem (and the leds would be too dim because they are actually never fully "on").
I guess the real solution would be to separate the supply voltage / grounds between the analog and digital circuit? I guess that's not that simple? Any advice, tips or relevant threads are welcome... I'll do some google-ing.
BUT
I was thinking of an alternative solution, what if I connect the 5V directly to a fifth analogRead() and use this as a denominator to compare the other analogReads to? So if we're at the 4.5V part in time the analogReads are scaled against this? Probably a long shot considering timing between analogReads and the lineair scalability of the sensors at lower voltages...
martijn103:
There aren't many leds connected or activated at the time of measuring:
led driver 1 draws 60mA
led driver 2 less than 10mA
current going to the sensors is 10mA
That adds up to 80 mA. Add another 15-ish for the Micro itself (believe it's based on the Leonardo, so it's an ATmega32U4) and you're pushing the limit of USB's default current output. I doubt the Leonardo bootloader negotiates for the extra current, so you're probably stuck with 100 mA running off of a computer's port.
Add to that the fact that the integrating ADC in your multimeter is going to average out the current spikes going to the multiplexer chip, and it's clear you're overloading the USB power. Star grounding won't help that. Larger capacitors might, but it's not guaranteed.
The solution is to make the analog portion less susceptible to power supply fluctuations. Instead of using the default analog reference, use the internal 2.56V one. It's pretty bad by voltage reference standards, but a huge improvement over referencing the supply voltage. If the sensors are also sensitive to changes in supply voltage, you could run them off the 3.3V supply instead of 5V.
The drop you see is probably mainly from the onboard polyfuse in the USB supply line.
0.5volt is ok for digital circuits, but it could indeed upset (non-ratiometric) analogue reads.
You didn't say what sensors.
Maybe you could read them with 1.1volt Aref (I don't think a Micro has 2.56volt Aref).
The idea you had about reading VCC and using it to compensate can also be done in software.
Leo..