Ask Engineering

Switch power on/off when SD card is inserted/removed in slot

I have ESP32 and I’m using it to read/write data from an SD card that is directly connected over SPI. This works fine. Now I want to switch on the ESP32 automatically by switching on the 3.3v power supply when an SD card is connected. When the SD card is beeing disconnnected, the power should be switched off.

I’ve tried to accomplish this using a 2N2222 transistor but I’m stuck now. My plan was place the ESP32 on the collector and GND on the emmiter. I wanted the base to be switched by a connection from the GND pin of the SD card (using a 220ohm resistor between SD card GND pin the power supplies GND to get part of the current to the base). This leads to the transistor switching just fine, but with this setup the SPI doesn’t work anymore.

What can I do to make this work. Is there another way to switch on/off power when an SD card is connected?

Leave a Reply

Your email address will not be published. Required fields are marked *