

User avatar
By Deckard
#82513 I want to deploy ESP8266- and/or ESP332-based devices for remote sensing applications. The goal is to maximize battery life, therefore powered sensors can't simply be tied to a live circuit. I've got the software side down, but there is one point of the hardware side that I'm not sure I understand completely.

Assuming a sensor draw of 5mA, I presume that I could either drive the sensor power by taking a GPIO pin high, or pull down a GPIO pin to ground the sensor. Am I correct in that assumption, and if so, is there any reason one method is preferable to the other?

I see many example circuits that seem overly complicated (e.g. transistors gating power with GPIOs connected the base, etc.) and I don't understand why this extra circuitry is required if the device can source the current required.
User avatar
By eriksl
#82813 Usually if something done not simple there is a reason, really.

For example GPIO pins can source 30 mA, which sounds great, but nothing says it will be a stable power supply for your sensor. Also there will be all sorts of high frequency noise that can be interfering with the sensor.

What is exactly your objection against adding one extra transistor? Do you fear it's too complex for you to understand?
User avatar
By rudy
#82815 GPIO pins can be used to power low current sensors but iy needs to evaluated on a case by case basis. From what i remember, the ESP8266 outputs are rated at 12 mA. It should be good enough to power a 5 mA sensor. As the current pulled out of the port pin goes up the output voltage goes down. You need to check how much and if it will negatively affect the operation.

As far a supplying a positive voltage, or giving a low to "ground" the sensor. In most cases supplying a positive voltage is much preferred. When sinking current the port pin will not be a perfect switch to ground. There will be a positive voltage at the pin and the magnitude will depend on how much current is being drawn. This extra voltage will be added to the sensor's low state output voltage. Once again, the sensor and it's requirements must be looked at.
User avatar
By davydnorris
#82818 Most of the sensors I have found either have a chip enable pin or a software command that can be used to put the sensor into a low power state, so I just power them off the main supply and use a GPIO for pin based enable sensors or software for the rest.

The other thing is that most LDOs also have enable pins, so you could put all your sensors on a second power circuit with a second LDO that can be enabled or disabled

I haven't found a need to individually power my sensors on - for the tiny draw they have you can just power all of them on when you need to take readings and then shut them down again.