0
\$\begingroup\$

I'm modding a PCB that has a CO2 sensor on it, powered by a battery (via a linear reg that also supplies the micro). The sensor is turned on and off to preserve battery power and the micro goes to sleep. I was surprised to see that the sensor has a permanent supply to it and ground is switched by the micro with an N-type MOSFET, rather than using a P-type MOSFET to switch its Vsupply on and off.

The C02 sensor is then connected to the one of the micro's UART's Rx and Tx pins. I would have thought that the problem with this is that the micro could then provide a path to ground and be leaching current away as there is always power on the sensor's supply pin.

Am I unduly worrying about this?

Or, I'm not unduly worrying about this...if the pins were set as outputs and set high before sending it to sleep would that be the best way to minimise power consumption with the current set-up?

I would have had it high sided switching and set the Rx and Tx pins as GPIO pins configured as outputs with the pins being set low just before going to sleep. Is that a better way of doing it or am I overthinking this? (Or indeed just plain wrong?)

\$\endgroup\$
  • 1
    \$\begingroup\$ It's just a choice, not overthinking at all. Given that the designers chose an N-Channel FET (probably for cost) they probably set the Tx/Rx as GPIO inputs pulled high which achieves the same low power characteristic. \$\endgroup\$ – Jack Creasey Jul 24 '17 at 15:27
  • \$\begingroup\$ If this was a passive sensor with an analog output I'd be concerned, but since it's obviously a smart sensor that communicates via serial it's less of an issue. Switching low-side is easier/cheaper. As @JackCreasey mentions, backdriving through IO pins can be alleviated by proper pin assignment at the receiving end. \$\endgroup\$ – Trevor_G Jul 24 '17 at 15:40
  • \$\begingroup\$ @Jack Actually, the one thing that is done just before sleep in the current code is "Tri state the CO2 TX pin to reduce power consumption", so I do not think, from all I have read that it's been properly thought through. \$\endgroup\$ – DiBosco Jul 25 '17 at 7:51
  • \$\begingroup\$ @Trevor I have found a plethora of information on line about minimising current in sleep and, in fact, one article advises putting things in to analogue mode to reduce consumption in sleep mode. There is so much conflicting advice, lots about what to do with unused pins and very little about what to do with connected pins. Seems to me the best way in the end would be to test different methods with a sensitive ammeter. \$\endgroup\$ – DiBosco Jul 25 '17 at 7:53
  • \$\begingroup\$ @DiBosco, indeed, there is more to consider when powering things off than just turning off the power to the device. Obviously, you want all signals between whatever is being powered down and the micro or whatever else is in between to not be carrying any current in that state. Sometimes it's obvious, sometimes, not so much. You really have to look at each signal on an individual basis and decide the best case for each. \$\endgroup\$ – Trevor_G Jul 25 '17 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.