2

I am building an ESP8266 device that uses RFID but need to conserve battery power.

The ESP is a Wemos D1 Mini and the RFID module is a RC522 (still waiting for it to arrive), which needs 3.3 V. I'm powering the ESP with a battery shield and 3.3 V.

But I don't want to connect the RFID module directly to the battery shield because it will be sucking voltage constantly. Instead, I want to be able to control its power using the ESP.

So I thought the easiest would be simply to connect the RC522's 3v3 line to one of the ESP's available GPIO pins, set it to output, and when I need RFID, set the GPIO pin high, to turn on the RFID module.

Is this an acceptable solution, or do I need to wire in a transistor and capacitor somewhere?

  • the RC522 has a power-down pin that you can use to shut down the module .... it also has a software controlled power-down – jsotola Jul 19 '18 at 1:12
  • you used an incorrect term .... it will be sucking voltage constantly .... not voltage .... current or power – jsotola Jul 19 '18 at 1:16
2

No, this is not an acceptable solution. The RC522 needs in excess of 100mA to operate, and an ESP8266's GPIO pin can only supply 12mA maximum. You will damage the ESP8266.

You need to use a P-channel MOSFET with the gate pulled HIGH as a high side switch.

schematic

simulate this circuit – Schematic created using CircuitLab

Set the GPIO to LOW to turn on the MOSFET. Set it HIGH or to INPUT to turn off the MOSFET.


Note 1: Set the communication IO pins to INPUT before powering off otherwise they could back-power the target device through the ESD diodes in the IO pins.

  • Thanks. I don't have a mosfet lying around. Can't I achieve the same with a transistor (seeing I can make the GPIO pin HIGH to turn it on, and LOW to turn it off again? eg: groovy.globi.ca/img/… – Andreas Huttenrauch Jul 18 '18 at 13:47
  • @AndreasHuttenrauch Only if the RC522 is OK running at (say) 2.6V. The PNP will impose a voltage drop that the MOSFET would minimise. – Majenko Jul 18 '18 at 13:51
  • And yes, it must be a PNP not an NPN transistor. You can't use an NPN as a high side switch like that. – Majenko Jul 18 '18 at 13:53
  • So I just need to move the NPN to the low side? (sorry - code veteran but arduino n00b :-) - eg: groovy.globi.ca/img/… – Andreas Huttenrauch Jul 18 '18 at 13:56
  • No, that would be almost as bad - the ground would then be offset and communication may fail. It really wants to be a MOSFET. – Majenko Jul 18 '18 at 14:06

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.