Issue w/Analog Microphone Readings

Please let me know if this is not the right section

The problem: I am sampling audio for an sound reactive RGB LED strip with the NodeMCU v3. When I use USB power from my computer, everything works well. If I power the NodeMCU from a 7805 linear regulator (5v) to Vin, it works fine. "Silent" conditions hang around 0 volts and audio levels show up clearly. When I power the NodeMCU with a 3.3v switching regulator (with the microphone grounded on the NodeMCU and VCC coming from the 3v3 pin) this is where the problem starts. If I have the LED strip unconnected, it detects the sound find (although my "silent" conditions hover more around .1 volts but for my purposes that wouldn't be an issue).

The problem is powering the board and subsequent microphone from the switching regulator with the lights connected I get very erratic voltage readings that are all over the place. You might be asking why not just use the linear regulator then? Well, even at 12 volts the (12v-5v)*( few hundred mA) is a decent amount of heat to dissipate but sure I could get a heat sink and control it but the end goal for this project is to power my 10m strip which is 24 volts and the linear regulator would have to dissipate (24v-5v) * (few hundred mA) which I really do not think is sustainable which is why I got the switching regulator in the first place.

I was told that these switching regulators do not play nicely with microphones but with the LED strip unconnected it wasn't as consistent as USB or linear regulator power but it still worked perfectly fine.

Could anybody explain why this issue arises and hopefully a way to fix it? Are there a series of tricks I can use to limit whatever interference is occuring? Should I give up on trying to make the switching regulator work? Would capacitors/resistors solve this?

I really would prefer to use the switching regulator for efficiency reasons, my second option wouldn't be the linear regulator it would be powering the Node from a wall adapter and USB cable to be honest. This is getting quite frustrating, one problem's fix causes another but I suppose thats how things go sometimes.

I am including a diagram of my setup. Please note the linear regulator should actually be a switching regulator and the board I am using is not the Huzzah, its the NodeMCU v3.

Components:
-NodeMCU v3

-Adafruit Electret Mic

-N Type Mosfets

-RGB LED strip (currently a 5 meter 12 volt 5050 leds, future: 10 meter 24 volt)

For any suggestions if there is something that will solve my issue, I am not worried if it costs $5 versus the linear regulator being <$1. I am more worried about space, amount of cords, and relative efficiency.

Would really really appreciate any help in solving this issue, this is pretty much the last part of a pretty big and feature rich controller.

Hopefully I have included as much information as is needed.

Thank you and feel free to ask any questions!

Diagram: https://postimg.org/image/6qcxxpaf1/

Are you using decent decoupling capacitors? The datasheet suggests 10µF on the in- and output of the regulator. That could solve the noise you get.
What 24V power source are you using? If you PWM the LEDs, the 24V line may be unstable, and therefore the regulator could be unable to provide a stable 3.3V. Maybe add some decoupling caps on the 24V line as well, close to the FETs.

Hope this helps,
Pieter

PieterP:
Are you using decent decoupling capacitors? The datasheet suggests 10µF on the in- and output of the regulator. That could solve the noise you get.
What 24V power source are you using? If you PWM the LEDs, the 24V line may be unstable, and therefore the regulator could be unable to provide a stable 3.3V. Maybe add some decoupling caps on the 24V line as well, close to the FETs.

Hope this helps,
Pieter

Right now just using a 12v wall adapter. As for the extra decoupling capacitors, would 10uF work and should how should I place them on the breadboard?

Is it a switching 12v adapter or just a transformer with a rectifier? You should put capacitors in parallel with the source and load(s), as close to the regulator as possible. The datasheet shows a schematic.
To learn more about bypassing/decoupling capacitors and why you should care, you could watch this video.

TL;DW:
Small bypass caps suppress noise on the power lines caused by fast digital switching (inside a microprocessor, for example). Some regulators also need capacitors for stability reasons.
When switching large loads (e.g. a LED strip) you should add some larger caps as well. When your circuit suddenly switches on the LEDs, the voltage drops, because 1. The power supply is slow, 2. All wires and PCB tracks have a certain impedance and inductance, preventing fast changes in current. When you add a bypass cap, the capacitor provides the current, until the power supply reacts.

The video also mentions that a capacitor is far from ideal (it has a series resistance and inductance) and you want the least amount of impedance. (To output the maximum amount of power when necessary)
The impedance, however, depends on a lot of factors: switching frequency, current draw, type of capacitor, capacity, wire length, inductance of the PCB traces, even package size of the cap itself, can change the frequency at which this impedance is at its lowest.

To have a wider range of frequencies at which your bypassing is effective, you can add multiple in parallel.
However, he shows that in practice, it is sometimes better to use only 1 or 2 caps, instead of 3 or more, in other cases, 3 or more different values are desired.

Pieter

PieterP:
Is it a switching 12v adapter or just a transformer with a rectifier? You should put capacitors in parallel with the source and load(s), as close to the regulator as possible. The datasheet shows a schematic.
To learn more about bypassing/decoupling capacitors and why you should care, you could watch this video.

TL;DW:
Small bypass caps suppress noise on the power lines caused by fast digital switching (inside a microprocessor, for example). Some regulators also need capacitors for stability reasons.
When switching large loads (e.g. a LED strip) you should add some larger caps as well. When your circuit suddenly switches on the LEDs, the voltage drops, because 1. The power supply is slow, 2. All wires and PCB tracks have a certain impedance and inductance, preventing fast changes in current. When you add a bypass cap, the capacitor provides the current, until the power supply reacts.

The video also mentions that a capacitor is far from ideal (it has a series resistance and inductance) and you want the least amount of impedance. (To output the maximum amount of power when necessary)
The impedance, however, depends on a lot of factors: switching frequency, current draw, type of capacitor, capacity, wire length, inductance of the PCB traces, even package size of the cap itself, can change the frequency at which this impedance is at its lowest.

To have a wider range of frequencies at which your bypassing is effective, you can add multiple in parallel.
However, he shows that in practice, it is sometimes better to use only 1 or 2 caps, instead of 3 or more, in other cases, 3 or more different values are desired.

Pieter

I am away from my project right now but when I am back I will check! Thank you for the material to research, I will watch it shortly and try to implement it and hopefully will take care of the issue. Will update with results

PieterP:
Is it a switching 12v adapter or just a transformer with a rectifier? You should put capacitors in parallel with the source and load(s), as close to the regulator as possible. The datasheet shows a schematic.
To learn more about bypassing/decoupling capacitors and why you should care, you could watch this video.

TL;DW:
Small bypass caps suppress noise on the power lines caused by fast digital switching (inside a microprocessor, for example). Some regulators also need capacitors for stability reasons.
When switching large loads (e.g. a LED strip) you should add some larger caps as well. When your circuit suddenly switches on the LEDs, the voltage drops, because 1. The power supply is slow, 2. All wires and PCB tracks have a certain impedance and inductance, preventing fast changes in current. When you add a bypass cap, the capacitor provides the current, until the power supply reacts.

The video also mentions that a capacitor is far from ideal (it has a series resistance and inductance) and you want the least amount of impedance. (To output the maximum amount of power when necessary)
The impedance, however, depends on a lot of factors: switching frequency, current draw, type of capacitor, capacity, wire length, inductance of the PCB traces, even package size of the cap itself, can change the frequency at which this impedance is at its lowest.

To have a wider range of frequencies at which your bypassing is effective, you can add multiple in parallel.
However, he shows that in practice, it is sometimes better to use only 1 or 2 caps, instead of 3 or more, in other cases, 3 or more different values are desired.

Pieter

Okay I have watched the video and think I understood (hopefully enough) at least the first half/main points. Interesting actually.

To answer your power supply question, I believe it is just a switching supply. I do not know for sure but it looks similar to this one.

I have a few questions

  1. The datasheet for my switching regulator says to use MLCC, is it okay to use a breadboard friendly regular ceramic capacitor or a electrolytic capacitor?

  2. I still don't fully understand where to put the capacitors. I have included another image and would love if you could comment where is correct.

  3. As far as a selection for bypass caps, what would be a good place to start as far as values go and can they be electrolytic or should they be ceramic?

  4. If I were to add caps for the incoming power should those be directly after the incoming V+ and GND wires from the supply? If so, what would be a good value to try?

Image: https://postimg.org/image/cj2jtpc4t/

Again thank you so much for the input! I really appreciate it

bmoe24x:
I do not know for sure but it looks similar to this one.

That's a switching adapter indeed.

bmoe24x:

  1. The datasheet for my switching regulator says to use MLCC, is it okay to use a breadboard friendly regular ceramic capacitor or a electrolytic capacitor?

  2. I still don't fully understand where to put the capacitors. I have included another image and would love if you could comment where is correct.

  3. As far as a selection for bypass caps, what would be a good place to start as far as values go and can they be electrolytic or should they be ceramic?

  4. If I were to add caps for the incoming power should those be directly after the incoming V+ and GND wires from the supply? If so, what would be a good value to try?

  1. MLCC would be the best, but electrolytic will be much easier and cheaper.
  2. The 10µF ones: 1 between Vin and GND, and 1 between Vout, as close to the regulator as possible.
    The larger ones: between the source of the FETs and the 12/24V rail, close to the FETs.
  3. Ceramic caps work better at higher frequencies. They can't store a lot of energy, however.
    Electrolytic caps work best at lower frequencies. They can store a lot more energy. Choosing the right caps is mostly trial and error, however (if you're a hobbyist).
  4. No, as close to the device/component as possible, if you connect it to the incomming power, you'll add some impedance/inductance from the wires/tracks between the input and the device. You could try anything between 47µF and 2200µF.

Pieter

PieterP:
That's a switching adapter indeed.

  1. MLCC would be the best, but electrolytic will be much easier and cheaper.
  2. The 10µF ones: 1 between Vin and GND, and 1 between Vout, as close to the regulator as possible.
    The larger ones: between the source of the FETs and the 12/24V rail, close to the FETs.
  3. Ceramic caps work better at higher frequencies. They can't store a lot of energy, however.
    Electrolytic caps work best at lower frequencies. They can store a lot more energy. Choosing the right caps is mostly trial and error, however (if you're a hobbyist).
  4. No, as close to the device/component as possible, if you connect it to the incomming power, you'll add some impedance/inductance from the wires/tracks between the input and the device. You could try anything between 47µF and 2200µF.

Pieter

Thanks again for all the help! Here are some of my findings:

When I power the NodeMCU via USB but the microphone from the regulator I get effectively the same outcome as if I power the NodeMCU via the regulator and the microphone via the 3.3v pin on the NodeMCU. I power the node via USB so I can see the serial plot.

Without capacitors, Node connected to USB and microphone connected to regulator looks like this (i.e erratic):

https://postimg.org/image/v049derrb/

With capacitors, Node connected via USB and microphone connected to the regulator:

https://postimg.org/image/6eekt3pkp/

Hey! We got somewhere. Is it perfect? No, but it is a big improvement. The software btw is sampling the analog read 1000 times per second, then 50 ms of these readings are analyzed for a peak to peak amplitude which I then convert to volts.

To get that result, I used 10 uF Electrolytic capacitors on the in and out of the regulator as well as one 470 uF electrolytic (the biggest I had laying around), followed by a 100 uF electrolytic... Now after those I did this setup three times (one for each FET): first was a 4.7 uF electrolytic, then .1 uF ceramic, then .01 uF ceramic, then a .001 uF ceramic

1)Should I be putting my set of capacitors one time before the first FET or should I continue to do what I did and have one set before each FET? Also is this too many capacitors?

Now here is where the news is less positive, when I unplug the NodeMCU from the USB (no more serial, relying on wifi sent voltage readings at 100 ms intervals and watching the LED strip) the results go back to how the first image looked :frowning: this setup has the node powered via 3.3v regulator, outputting power via 3v3 pin to microphone and LED strip powered by 12 v which is on the breadboard rails.

  1. I just used the capacitors I had from an old set. For my big (currently 470 uF) capacitor, should I go buy something bigger? When I remove capacitors one by one (then replace them) this one seemed to make the biggest difference.

  2. In my diagram is there any placements that I should change or certain wires I would want to keep as short as possible?

If you have any other tips I would be more than glad to hear them or if you have a direction to have me research in, I do not mind research.

Again, thank you so much! I really appreciate it and hope that I can complete this project.

UPDATE: I got a 1000 uF electrolytic cap before the 470 uF one now, when the board is powered via USB and the mic from the switching regulator it is even smoother. However when I power the board from the switching regulator and the mic from the 3v3 pin it doesn't fix it still

SECOND UPDATE: I found this forum posting and figured I had a similar situation. I have attached how I implemented it using 100 ohm resistors and a 100 uF cap below (note I have it all one one side of the breadboard, could not see the resistors because of the cap in the diagram maker I have)

The Diagram

I do not know if this is helping me accomplish the final goal but again I see an improvement when powering the board via usb and the mic via the regulator. Look at the screen shot below, the signal is actually almost smooth and it hovers actually around 0 now:

Most Stable Readings So Far

Thanks again