Switch off Feather and STEMMA peripherals??

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
superg2
 
Posts: 41
Joined: Wed Aug 31, 2022 12:27 pm

Switch off Feather and STEMMA peripherals??

Post by superg2 »

I'm working on a battery-powered project using ESP32-S2 Feather with Mini GPS connected via STEMMA port. I'm trying to figure out how to turn off the board and GPS. I hooked up a switch to the ENABLE pin which turns off the board but the GPS is still receiving power. I was thinking about connecting the switch between the battery but not sure how the project will work once I pull in the USB cable.

What is the best method to disable the board and STEMMA peripherals?

User avatar
michaelmeissner
 
Posts: 1832
Joined: Wed Aug 29, 2012 12:40 am

Re: Switch off Feather and STEMMA peripherals??

Post by michaelmeissner »

You are in luck. The ESP32 V2 is one of the few feather boards that has a separate internal pin (NEOPIXEL_I2C_POWER) to control the power for the on board neopixels and the stemma quiic connection. Checkout:
As the documentation says, it appears you need to actually enable that power before using either the onboard neopixel or the stemma quiic connector. But once enabled, you need to turn it back off before going to sleep.

I would imagine if you use the normal feather pins for I2C (ground, 3.3v, SDA, SCL) the power will be controlled via the main voltage regulator and not the secondary voltage regulator controlled by NEOPIXEL_I2C_POWER.

User avatar
danhalbert
 
Posts: 4688
Joined: Tue Aug 08, 2017 12:37 pm

Re: Switch off Feather and STEMMA peripherals??

Post by danhalbert »

On the Feather ESP32 V2, GPIO2 is the NEOPIXEL_I2C_POWER pin. GPIO2 is unusual in that when the processor is hard-reset, it is pulled down. Most pins are not like this. So the default state is firmly off, and CircuitPython deliberately sets it to high when CPy starts up. This turns on the STEMMA/QT and NeoPixel power. But when deep-sleeping, it goes back to low, unless you use the `preserve_pins` feature to keep it high.

I am not sure what the default is for Arduino.

User avatar
danhalbert
 
Posts: 4688
Joined: Tue Aug 08, 2017 12:37 pm

Re: Switch off Feather and STEMMA peripherals??

Post by danhalbert »

Reading the original post, I see you are using an ESP32-S2 Feather, not an ESP32 V2 board. And you are not sleeping, just disabling things.

To turn off the 3.3v power on the board, you need to connect the ENABLE pin to ground. That will shut down the 3.3V regulator, which will turn off the processor and also shut down the power to the STEMMA/QT connector.

Did you wire the switch to connect ENABLE to GND, or some other way?

User avatar
superg2
 
Posts: 41
Joined: Wed Aug 31, 2022 12:27 pm

Re: Switch off Feather and STEMMA peripherals??

Post by superg2 »

Thank you for the responses it working using the Enable pin. I would have sworn the Green light on the GPS was lit after grounding the Enable pin but I cannot reproduce it.

Thank you very much for the responses

User avatar
superg2
 
Posts: 41
Joined: Wed Aug 31, 2022 12:27 pm

Re: Switch off Feather and STEMMA peripherals??

Post by superg2 »

Appears I was right the first time, looking at it right now. The board is off because I grounded the Enable pin but the green light on the GPS is lit.

User avatar
danhalbert
 
Posts: 4688
Joined: Tue Aug 08, 2017 12:37 pm

Re: Switch off Feather and STEMMA peripherals??

Post by danhalbert »

I connected the Mini GPS to a Feather ESP32-S2 with a STEMMA-QT cable. I powered the Feather from USB and then jumpered the EN pin to GND on the Feather. The Green power LED on the Mini GPS went off.

I don't have a suitable battery for the Mini GPS to check whether inserting a coin cell would somehow power the GPS. But it is supposed to be only for backup. Do you have a coin cell in that holder?

Do you have any other wires going to the Mini GPS board? If so, could you post a picture of your wiring? Thanks.

User avatar
superg2
 
Posts: 41
Joined: Wed Aug 31, 2022 12:27 pm

Re: Switch off Feather and STEMMA peripherals??

Post by superg2 »

I attached a picture of the gadget. On the left is a yellow cable going to EN and on the right is the switch. I didn't connect the battery to the GPS and just have the STEMMA connection.

Thank you for the reply. I'm so close to completing this project, this is my last hurdle.
Attachments
IMG_4548.jpg
IMG_4548.jpg (207.47 KiB) Viewed 119 times

User avatar
danhalbert
 
Posts: 4688
Joined: Tue Aug 08, 2017 12:37 pm

Re: Switch off Feather and STEMMA peripherals??

Post by danhalbert »

It's kind of hard to see what is going on with the switch. Could you pull the jumper from the EN pin and connect another jumper and just touch it to GND?

If you pull the LiPo out and just power it from USB, do you see the same issue?

User avatar
michaelmeissner
 
Posts: 1832
Joined: Wed Aug 29, 2012 12:40 am

Re: Switch off Feather and STEMMA peripherals??

Post by michaelmeissner »

Note, the enable pin is only used for the voltage regulator from the lipo battery. If you power it via USB, it should ignore the enable pin.

User avatar
danhalbert
 
Posts: 4688
Joined: Tue Aug 08, 2017 12:37 pm

Re: Switch off Feather and STEMMA peripherals??

Post by danhalbert »

michaelmeissner wrote: Sun Jan 22, 2023 1:30 am Note, the enable pin is only used for the voltage regulator from the lipo battery. If you power it via USB, it should ignore the enable pin.
@michaelmeissner: I would disagree with this. Here is the schematic. Both VBUS and VBAT, which together become VHI (blue arrow), go the regulator in the upper left. That produces the 3.3V power, which powers the ESP32-S2 module. So pulling EN down (red arrow) will turn off the regulator, and turn off the module.

VSENSOR is connected to the STEMMA/ QT connector. VENSOR is the output of a second regulator, supplied by VHI. It is turned on by the I2C_PWR pin from the module. However, if the module is shut down, then I2C_PWR will be unpowered, and will be pulled down to GND (turned off).

I verified the voltages with a multimeter when grounding EN, and I have the mini GPS connected.
Feather-ESP32-S2.png
Feather-ESP32-S2.png (116.72 KiB) Viewed 106 times

User avatar
danhalbert
 
Posts: 4688
Joined: Tue Aug 08, 2017 12:37 pm

Re: Switch off Feather and STEMMA peripherals??

Post by danhalbert »

@superg - I am wondering about the switch and/or its wiring.

I also have a couple of questions for you:
1. When did you buy this Feather ESP32-S2? The circuitry to control the VSENSOR has evolved, but the basic function of the EN pin has not changed. On the bottom of the board, there may be a letter in a circle, or not. Most boards have a "C" in a circle.
2. Does your board have the optional BME280 sensor installed?

User avatar
michaelmeissner
 
Posts: 1832
Joined: Wed Aug 29, 2012 12:40 am

Re: Switch off Feather and STEMMA peripherals??

Post by michaelmeissner »

@danhalbert You are correct, and my understanding of the enable button was flawed.

User avatar
superg2
 
Posts: 41
Joined: Wed Aug 31, 2022 12:27 pm

Re: Switch off Feather and STEMMA peripherals??

Post by superg2 »

Thanks for all the responses. I did some testing over the last couple of days and my mini GPS shows a green light on whether or not the EN pin is grounded. It sometimes turns off based on my earlier responses but it is consistently staying on now.

I had the device charging all night, verified the battery was 100%, and turned off the device (grounding the EN pin). 8 hours later I turned on the device and the battery was under 10%. Additionally, I have visually seen the green light on the GPS when the device is off and not connected to USB. The board turns off and disappears from the computer so it seems that my switch is grounding the EN pin correctly.

This is a replacement board I received in December 2022. The original board's LC709203 chip wasn't working. I'll have to disassemble the device to see the markings, I'll do that over the next couple of days. Lastly, this is the standard board and not the BME280

User avatar
superg2
 
Posts: 41
Joined: Wed Aug 31, 2022 12:27 pm

Re: Switch off Feather and STEMMA peripherals??

Post by superg2 »

Here is a picture of the board. I have Turned On and Off several times this evening, the green light on the GPS remains lit while the Feather turns off and on as expected.
Attachments
IMG_4552.jpeg
IMG_4552.jpeg (154.94 KiB) Viewed 75 times

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”