Page 1 of 1

GPIO to Power a Sensor

Posted: Sat Feb 23, 2019 8:08 pm
by tony@shatalmic.com
I have a magnetic sensor on my board. Currently it is powered directly by the 3.3v rail.

I have found that when I update the firmware using OTA the sensor doesn't work until I power cycle the whole system. I suspect that the magnetic sensor is just in a state that it needs to be reset.

I know I could add a FET or transistor with a GPIO to be able to power cycle the sensor, but was wondering if I couldn't just power the sensor directly from a GPIO. That way I could just set the pin low and then high to cycle power on the sensor.

The data sheet says the average current draw during normal operation is 3.7 mA and the note says this is the peak during ADC operations for about 270 microseconds, so I guess that is the max.

I read a post that says the max current draw on the esp32 GPIO is 40 mA, so it seems this would be fine. I just didn't want to bank on it without asking someone.

Re: GPIO to Power a Sensor

Posted: Mon Feb 25, 2019 2:30 am
by ESP_Sprite
Yes, you should be able to do this.

Re: GPIO to Power a Sensor

Posted: Mon Feb 25, 2019 2:29 pm
by tony@shatalmic.com
Thank you. Can you think of any side effects or down sides?

Re: GPIO to Power a Sensor

Posted: Tue Feb 26, 2019 7:07 am
by ESP_Sprite
For one sensor? Not really. I wouldn't go overboard with this technique and try to pull 40mA from every single available GPIO as that'll probably heat up the chip a fair bit, but for one sensor, you should be good to go.