How to handle/avoid voltage drop on current load (ADC trouble)

For users of Matrix Multimedia Electronics software to discuss projects, circuits and any other electronics concepts.

Moderators: Benj, Mods

Andreas
Posts: 17
Joined: Tue Jan 17, 2017 6:10 pm
Has thanked: 4 times
Been thanked: 1 time
Contact:

How to handle/avoid voltage drop on current load (ADC trouble)

Postby Andreas » Mon May 11, 2020 12:06 am

Hi

I've been trying to control a bunch of LED's through a PIC microcontroller and some microphones, such that the LED's light up whenever the microphones sense sound. The microphones are two small electret mics together with a amplifier circuit such that the output is centered around VDD/2 Volts when no sound is present and when a sound is present the voltage will change around the center-voltage depending on the volume of the sound.

I use one the analog inputs on the microcontroller to read the sound volume and calculate how to light the LEDs, before letting the controller switch on the lights. Unfortunately, as soon as the lights turn on, there is a relatively big increase in current flow in my circuit and thus I have a voltage drop of up to 200-300mV from around 5V to 4.8V. (Actually I'm a bit confused about the relative large drop as i still should be far from the current limit of the Power supply, but I've accepted it as the circuit otherwise operate fine at that voltage). As the microphones gets supplied by the same source as the LEDs' the change is also present on the supply of the microphones, which then influences the output of the microphones, which then confuses the micrcontroller to believe that a new (and maybe louder) sound was present even when this is not the case, making the program enter an long loop of making itself believe that a lot of noise is present even when that's not the case. In a similar way the voltage reference (VREF+) of the microcontroller is also affected by the change of voltage which doesn't simplify the complexity of solving the problem.

I've added (a lot of) capacitors around the circuit, and most of them i've even oversized compared to minimum-recommendations to avoid voltage drops, without it helping much.

I've tried to find a solution online to the problem, but I havn't found a definitive answer yet. I've tried to seperate the circuits into two different circuits supplied by different sources: One for the LEDs and one for the remaining: Micronctroller, Microphones, display, etc. This seems to greatly reduce the problem (and maybe solve it entirely) but it does increase the complexity of the circuit more than i like.

I'm not great with Electrical Engineering, so I hope that someone with more experience will help with some new ideas, or maybe at least tell me/confirm that separate circuits is the best way to go.

Some details in case of interest:
Microcontroller: PIC16F18877
Voltage: 5V
Microphones: https://www.sparkfun.com/products/12758
LED: up to 150pcs of adressable WS2812 (Or alike). However, the things described here are with tests at around 20 leds.
PSU: 5V, 30A

Kind regards
Andreas

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8809
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2553 times
Been thanked: 3712 times
Contact:

Re: How to handle/avoid voltage drop on current load (ADC trouble)

Postby medelec35 » Mon May 11, 2020 12:27 am

Are you able to monitor the current drawn from the power supply?
Considering it should be a very low impedance PSU, either voltage regulation is terrible or current limit is set way to low, so it's on the start of limiting.
Are you able to load PSU with a load that draws a few amps to test output regulation?
or you got an alternative PSU you can test with?

Thinking about it, if each WS2812 draws 50mA full brightness, then total current can be up to 150 * 50mA = 7.5A
Can the power leads and traces support that?
Try measuring voltage from the start to the end of say the positive supply lead and see what the voltage drop is?
These users thanked the author medelec35 for the post (total 2):
Steve001 (Fri May 22, 2020 8:16 pm) • Andreas (Sun May 24, 2020 9:18 pm)
Rating: 10%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

Andreas
Posts: 17
Joined: Tue Jan 17, 2017 6:10 pm
Has thanked: 4 times
Been thanked: 1 time
Contact:

Re: How to handle/avoid voltage drop on current load (ADC trouble)

Postby Andreas » Wed May 20, 2020 11:27 pm

Thanks for the quick reply, and your simple advice

I quickly found that a large problem turned out to be the power-switch I had integrated into the circuit, which was greatly underated for the currents in the circuit. It seems that there were a voltage drop of around 300mA over that switch.

Unfortunately this didn't entirely solve my problem. The good news is that I've found that there seems to be no voltage change at the PSU, which stays around 5.11-5.12V at all times (for the setup in question). However, at connection to my circuit the voltage alternates between 5.09 and 5.02V. Maybe I'll have to find some thicker wires than 18AWG for the PSU. Also, at the microphone, the voltage alters between 5.07 and 4.97.

Do you think it is fair that I would encounter trouble with voltage changes at around 100mV (as previously explained this is both at the microphone supply and the VREF+ for the ADC)? The problem is elaborated in the end, and I just feel that a voltage change of 2% shouldn't have so severe consequenses. However when using a separate supply for the ADC/microphone, the voltage at the MIC is fixed at 4.91 meaning a change of less than 10mV, so it might be that 2% is simply to much of a change.

I've measured the current which seems to be between 0.25A to around 0.7A (maybe a little more as the multimeter might not have time to settle before the LEDs turn off again). I'm working with 150 LEDS, but at a low intensity around 1/3 of the maximum lighting and at most two of three RGB colors are used at the time in my test. The current seems to be around 1A when all the LED's are lit red at this itensity.

Maybe there is some other way to stabelize ADC measurements or maybe I just have to reconfigure, such that the LEDs are powered closer to the PSU, and doesn't directly use the same wires as the rest of the circuit. At the moment everything is connected through a breadboard (which I guess might also be underrated for currents above 0.5A). Of course I plan to create a print when I'm done developing.

Any suggestions are appreciated
Regards Andreas
------------------------------------------------------------------------------------------------------------
In case of interest I can try and eleborate on the things that I observe to be my problem:

Setup: The output of the microphone is centered and oscillates around 2.5V when a sound is present. The PIC repeatedly does a lot of ADC measurements and then it subtracts the highest and lowest voltages sensed (difference between 8 bit ADC value registered), to get the measurement of the sound right now. This difference will be referenced as volumen in the following. I would guess that the program cycles between measuring and updating LEDs between 2 and 10 times pr. second. The PIC stores the loudest volumen for a given amount of time (say 2 minutes) and it uses the current volumen to figure the percentage of the 150 LED's that should be lit by comparing it to that maximum volumen.

A volumen of less than 4 is not registered as it is considered as background noise. When playing dimmed music I'll get most volumens between 5-10 and a few loud sounds may reach 15-20. To avoid a single loud sound is remembered forever the program sometimes average current volumen and the max-volumen to reduce the remembered max volumen. As the max-vol is then reduced, a higher percantage of the LEDs are light up (assuming the next measured volumens doesn't change much). This of course increseases the current load. When using a separate supply for the LED's this doesn't give any problems, and the program continues with a little more light until a slightly higher sound is again registered increasing the max-vol registered.

However, when I use a single power supply something happens (and I assume that it is the voltage drop), that makes the measured volumen increase substantially right after the maximum volumen is reduced/halved and more LED's has to light up. The registered volumen quickly reaches to 50, and continues to raise from there, and often the new maximum volumen is registered at around 120-130. After a few secondes things seems to settle, and the registered volumen goes back to around 5-10, meaning that nearly no LED's are on as 10 out of 120 is less than 10% of the LEDs to be turned on. After some time, when the max-volumen is then reduced/halved again the problem repeats. The problem is the same when reducing the max-vol in smalle steps. When the max-vol reaches around 50 or below, the program goes crazy again.

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 1126
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 459 times
Been thanked: 517 times
Contact:

Re: How to handle/avoid voltage drop on current load (ADC trouble)

Postby Steve001 » Fri May 22, 2020 7:59 pm

Hi Andreas

in addition to martins post above:

And assuming a bench power supply that is rated to supply this level of current.

The power supply output terminals will be constant and unlikely to drop because of the PSU regulation circuits unless your PSU has a separate Voltage feed back / voltage monitor input that you could use to regulate the 5 Volts at the PCB Input terminals.

You are looking at 18AWG wire = 1.0237 mm2 this seams a bit small and volt drop will become noticeable at 7.5 Amps
If you can find a data sheet for your cable they will list a Current carrying capacity @ 20 degrees C and a de-rating factor for an increase in temperature and if the cables are bunched together.

The volt drop is expressed as mV per Amp per Meter

Cable resistance increases as the temperature increases this is different between copper, tinned copper and aluminum cables.

So looking at a "typical" PVC Insulated copper cable working across from the 1.00mm2 coloum this cable has a voltage drop of 19 mV per amp per meter of cable, don't forget include the return path(s)

so @7.5 amps with a 1 meter length of cable

Cable length = 1 * 2 = 2 meters

volt drop = 7.5 * 2 * 0.019 = 285 mV

so your volt drop you measured looks correct

you will also have resistance in connections and switches, PCB track widths that will drop the voltage


Steve
These users thanked the author Steve001 for the post:
Andreas (Sun May 24, 2020 9:18 pm)
Rating: 5%
 
Success always occurs in private and failure in full view.

Andreas
Posts: 17
Joined: Tue Jan 17, 2017 6:10 pm
Has thanked: 4 times
Been thanked: 1 time
Contact:

Re: How to handle/avoid voltage drop on current load (ADC trouble)

Postby Andreas » Sun May 24, 2020 9:56 pm

Thanks to both of you on the elaborations.

I've now now made two parallel connections from the PSU, one for the LEDs, and one for the remaining (voltage sensitive) part of the circuit, and everthing seems to work perfectly now. Its great that I now only need one PSU, even though I would have liked to have only a single main power source/connector/cable, but I'll have to wait until I come accross some thicker wire.

Do you have any recommendations on the thickness of the wire, to reduce/solve the problem. I guess that as the 8 bit ADC should have a sensitivity of 5V/256=0,0196V=19,6mV, the worst case maximal voltage drop should be 19,6mV for the system to not get affected. However using Steves example that would mean a voltage de-rating of at most 0.0196V/(7.5V*2m)=0,0013V per Amp per meter=1.3mv pr. amp pr. meter meaning a gauge of around 6AWG, based on an arbitrary table look-up on the internet (and the assumption that V/(A*m)=Ohm/m which I guess is right by Ohms law).

An Gauge og 6AWG is probably a bit infeasible, so maybe I should stick to having seperate power cables for different parts. Also here I have assumed no voltage drop on the PCB.

Let's assume I only have one power supply cord to the PCB, would it then be better to place the voltage sensitive part of the circuit closets to the power input to give it access to the "cleanest" voltage supply? Or would it be better to place the current consuming parts close to the power input, to decrease the travel distance of the high current as much as possible and reduce voltage drop on the PCB traces?

Regards
Andreas

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 1126
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 459 times
Been thanked: 517 times
Contact:

Re: How to handle/avoid voltage drop on current load (ADC trouble)

Postby Steve001 » Mon May 25, 2020 8:58 am

Hi Andreas

Voltage sensitive applications do commonly run separate cables to the power supply away from high current devices.
You can always put 2 cables in parallel to the high current devices.

What is the length of the cable run ? i can help you picking a cable size. It dose become difficult at low voltages and trade off's are common as you have to be practical large cables are sometimes impractical to terminate into small PCB terminals etc.

See attached volt drop table, they are in mm2 so you will have to convert to AWG

I would be tempted to look at :

1.5 mm2 - 16 AWG
2.5 mm2 - 14 AWG

Steve
Attachments
Capture.JPG
Capture.JPG (69.14 KiB) Viewed 89 times
Success always occurs in private and failure in full view.

Andreas
Posts: 17
Joined: Tue Jan 17, 2017 6:10 pm
Has thanked: 4 times
Been thanked: 1 time
Contact:

Re: How to handle/avoid voltage drop on current load (ADC trouble)

Postby Andreas » Wed May 27, 2020 6:34 pm

Thanks again

In response to your question: I dont know the exact length at the moment but I'm pretty sure that the supply wouldn't have to go further than 3m (6m roundtrip) at most. And that distance will only apply to some parts of the circuit/amount of LEDs, as I would have several cables powering the LED strip, to handle voltage drop on the LED strip.

I've been working on/testing my circuit a bit more, and I found that I still have some supply noise problems when I increase the light intensity/power usage. After searching around i've read about 'listening' to the circuit by the use of a headphones, and this was really an eye opnener for what is going on, as I haven't access to an oscilloscope. When listening to the microphone audio signal I was suprised by how well the microphone captured canges like turning on a simple LED. I dont know if components like these are considere high current devices in the context mentioned by you, Steve. Maybe I should have a different supply line for the microphones also.

However the main part of the circuit only seems to raise the ADC value from a steady 2 (out of 255) to a more unstable 4-6 (out of 255). The biggest problem still seems to be the LED strip light, which still induces selv-inflicted ADC readings up to around 40 (out of 255) at some times, and when listening to the signal from the microphone, there is no doubt why: A high pinched noise seems to appear as the LED-strip is lit, and it increases in volumen as the number LEDs turned on and their intensity increases. To recap: The only connection between the LED strip and the remaining part of the circuit is at the PSU terminals, and the data-signal cable from the microcontroller to the LED-strip. Please let me know if i should short the 5V and/or the ground lines at the ledStrip with the ones at the breadbord.

When listening to power supply line on the breadboard the same sound is present but at a way lower volumen (I guess it is the noise on this line that is amplified by the mic-circuit and then being output on the audio line). The sound/noise is also present at the first LED of the LED-strip and at the PSU. It therefore seems that the PSU induces some (high pitched) noise when a lot of current (I guess around 5Amp) is drawn.

As this problem seems to be at the PSU, I guess it wouldnt help to add more cables and separate supply lines (however I might be wrong). I'm thinking that there might be a way to filter out the noise. At the moment I have one 2200uF capacitor accross the power lines on the breadboard and one at the LEDs. Also i have a 22uF accross the microphone power and one of 10pF accross the microchip.

###
UPDATE:
I've found that each time the microcontroller turns on/off an regular LED (around 6mA) it can even be slightly 'heard' on the PSU terminals as 'dik' og 'tik' sound. This makes me believe that the high pitched sound heard when lighting the LED strip is the same response of each LED being PWM controlled very fast. This migt also explain why I feel like the noise seems to fade a bit when the brigthness gets closer to 100%. If i'm right the noise seems to come from PSU each time the system changes state rather than being caused by current consumption.

However, there seems to maybe be a lower frequency sound that might increse with light intensity and thus power-consumption. However it seems the high-frequence-chang-of-state-noise creates the biggest trouble.

Also: there seems to be voltage changes of about 0.5mV across microphones (voltage drop from PSU to mic is between 1.1mV-1.6mV) and 1.2mv in the worst part of the circuit (voltage drop from PSU to that part is between 2.6mV-3.8mV) (not considering LED-strip part of circuit). 0.5mV does not sound like much to me. However the mic amplifier is about x60, så that would of course add up to be 30mV, if changes on the supply is amplified in the same way as the microphone signal. However this i guess would be solved by totally isolating the mic on seperate power lines. But it does not help/explain the LED-strip noise which induces no voltage drop on the mic anymore.
###

Regards
Andreas