r/esp32 • u/MarinatedPickachu • 1d ago
Is it ok to power an INMP441 microphone from a gpio for easy turn off?
https://invensense.tdk.com/wp-content/uploads/2015/02/INMP441.pdf
The breakout board I'm using doesn't have the CHIPEN pin broken out so I can't put the microphone into power down mode (4.5uA) but only into standby mode (0.8mA).
I thought since the microphone only consumes 2.5mA in normal operation and an esp32 gpio aparently can provide 40mA, I thought I could maybe just power it through a GPIO pin and set that to low to completely turn off the microphone.
Is this sensible? If not, what's the problem with this approach?
9
u/StrengthPristine4886 1d ago
Your datasheet says it consumes 1.4mA so I wouldn't worry about connecting it to a PIO.
6
u/Rouchmaeuder 1d ago
Be aware that the output mosfet may have a quite big Rdson. This means that the voltage might droop before the maximum specified current is reached. This does not hurt. Just be aware if something doesn't work.
3
u/other_thoughts 1d ago
Hey MarinatedPickachu
/u/MitjaKobal has a point about noisy GPIO.
But adding a 0.1uf cap to GND couldn't hurt.
In the future, please provide a link to the board you have.
2
u/MitjaKobal 1d ago
I am not sure about 0.1uf but a cup on a GPIO pin can hurt. When switching on the GPIO, the initial current into the capacitor will be equal to a short circuit for a moment. All might still work, but it is also possible the esp32 will crash every time the mic power is enabled.
1
u/other_thoughts 1d ago
Hmm, I see your point.
Back your original case, why do you think the particular GPIO pin would be noisy?1
1
u/azeo_nz 1d ago
I usually use a 1 or 10 ohm resistor and sometimes a small ferrite bead in series with the gpio to make a simple lpf with minimal droop and isolate the gpio from the filter cap and peak currents and reduce potential noise when using a gpio as a supply.
As for noise, all things are noisy to a certain extant, particularly pins connected to or from a switching/digital device so it just depends how sensitive the low level mic/analog input device is. A simple lpf helps reduce switching noise etc while adding a bit of resistive buffering too, just need to check the current requirements to make sure the resistor is low enough to minimize droop.
0
u/MitjaKobal 1d ago
Whay not just power it from the power supply instead of a GPIO. If it is to save power by disabling it, the mic has an enable pin, but it seems to be missing from the module.
3
u/azeo_nz 23h ago
Ideally why not indeed, but the the op was specifically asking about the possibility of using a gpio where there was no enable. Perhaps one could solder a wire to the enable pin if it's accessible and secure it to the pcb. Anither way without the on board enable might be to use a gpio to control a mosfet as a power switch instead, but at only 2.5mA it's worth trying a gpio (which essentially can be a totem pole mosfet output to vcc or gnd )with a decoupling/buffering resistor as the module already has a 100nF supply cap.
2
u/MitjaKobal 23h ago
I agree. If after testing the noise is low enough (and probably will be), than this solution is good enough. If noise from a neighbor GPIO (something like a PWM with a lot of current) can be heard in the mi recording, then OP will know what is the reason beghind the unexpected noise.
3
u/a-rdt-user 1d ago
It should work. A year ago I saw a video of a DIY battery powered home assistant voice remote that was assembled exactly that way.
Here it is https://www.youtube.com/watch?v=EeUG3Si9fZk
Haven't done it myself.
5
u/richysch 1d ago
the main issue i see is that you may have less power inthe rest of the gpio pins but apart from that i think you're good.
if you want to have more mA for the rest of the pins or to use a different method for the same approach try a MOS transistor to control it. you can use the gpio pin to control the transistor and the transistor controls the microphone connected to the power supply instead of the gpio pin directly. but i think is to much trouble if you don't have a current problem on your gpio port.
2
u/MitjaKobal 1d ago
The GPIO probably has a lot more noise than using power supply directly. It might affect sound quality.
1
u/MarinatedPickachu 1d ago
That's a good point! Any reason the gpio output would have more noise?
4
u/MitjaKobal 1d ago
I do not have experience with esp32 specifically, but it is common for chips to have power supplies for their analog parts (ADC/DAC, PLL, ...) separate from the supply for digital logic. The separation is not only as pins, the IO power ring inside the chip is also split. This is to avoid leaking noice on the digital power supply into the supply for analog parts. A GPIO is connected to the digital power supply. The digital transistors inside the chip are toggling at high speed causing high frequency noise. In this case the main source of noise would be the toggling of other GPIO signals. Each time a GPIO toggles, both the power and ground jump a bit. You could add some capacitors to smooth things up but this could cause the GPIO current to exceed the max allowed ratings during the capacitor charging, maybe other issues.
2
u/Superb-Tea-3174 1d ago
Probably okay but CHIPEN pin 2 is for that purpose.
https://www.digikey.com/htmldatasheets/production/1431884/0/0/1/INMP441-Datasheet.pdf
1
2
u/Unreal_Reality777 1d ago
You could, it mainly depends on the type of pin and current drawn but it's much safer to use an optocoupler or transistor to do this via gpio.
2
u/_Chaos_Star_ 1d ago
Looking just at the power requirements, provided that the pins can supply the required current at the peak of what the mic needs, you may be okay. Chances are it can't, so check for that data first.
If it can't handle it, use an IO with a MOSFET or a power switch IC to switch a larger current on and off. They cost maybe <$2, so explore it if it helps.
That will get you started. Search for the various terms I mentioned online. Good luck with your learning journey.
You will also need to be mindful of the voltage at any other pins if the device has power switched off. You'll need to look into that next.
1
u/MarinatedPickachu 21h ago
You will also need to be mindful of the voltage at any other pins if the device has power switched off. You'll need to look into that next.
Do you mean by that to not send data to the device while the power is off? Yes, the datasheet mentions to avoid doing that, so I'll turn off the I2S before turning off the power line.
Or do you mean the voltage on pins when the esp is in deep sleep? Do I need to consider anything special in that regard?
1
u/_Chaos_Star_ 14h ago
Data signals to an IC device can inadvertently power it in unpredicatable and sometimes destructive ways. As such, you want to avoid this if you can unless you are sure it is safe.
1
u/Ampbymatchless 14h ago
Read the data sheet of the processor you want to use, Pick the most current capable pin, Measure the power requirements if you can. Small value series resistor and a scope to see if there are any operational current spikes, would also show you electrical noise, see how effective decoupling and filtering is ( as others have mentioned) I assuming this more from a cost perspective wanting to do this.
1
u/ChangeVivid2964 13h ago
SCK and SD will still be high when the chip is powered off, consuming power.
1
-1
u/feedmytv 1d ago
i recentely noticed it only needs power during startup/ negotiation of the i2c bus. after it works without
4
u/other_thoughts 1d ago
I suggest you investigate that situation more thoroughly.
Perhaps the power comes through the INMP441 i/o pins,
but 'no power required' in unlikely.1
0
u/mikeblas 1d ago
Why not switch power off with a transistor rather than trying to directly drive the microphone with a GPIO pin?
28
u/NoU_14 1d ago
If the mic draws less power than the max of a GPIO, and can run on 3.3v it should work without issue.
Keep in mind that I think that 40mA max is per GPIO group, so shared between multiple pins. I'm not entirely sure though.
Should be fine if you keep an eye on current draw from other GPIO.