On/Off or Reset for Low Power


I’ve been working on a small project for the last month and for the most part, everything is working great. I’m using a spark to power 4 NeoPixel Matrices through a level shifter and using a LiPo Charger and battery from adafruit (Micro-B and 4400mAh battery). I was able to run half the pixels on semi-high brightness as green for over an hour. The problem I ran into is when the battery dies or at least drops in voltage to where the spark can’t stay powered and, as expected, everything shuts off. If I plug back in the USB connection to power the project when the battery dies, it doesn’t immediately power back on. I have to physically disconnect and reconnect the power to the project in order for the project to start again.

Is there a simple way to incorporate a hardware/software restart into the spark or add a momentary switch as a kind of reset or on/off switch? Or am I missing something entirely.


It will be nice to know how the Neopixels are getting power from the battery. Do you have a schematic or something?

With the right configuration, the core should run as per normal when you plug in the USB cable.

The RST button is already a Reset button and software reset is possible!

It will depend on if the battery is still supplying some power to the Spark Core. You can get an issue where the level drops too a point where the core won’t run but is not low enough that when the power comes back on at full the cpu does not recover. This is called a brownout and it requires a method to reset the processor correctly. Plugging in power does not often work to generate this correct reset.

Many modern microcontrollers have a reset circuit that can be driven from a built in brownout circuit.

The STM32 used in the Spark Core has one called a PVD. According to the docs this works down to 2V. It all depends on if the Spark team have enabled this and at what voltage level. Check out page 40 of the STM32F104CBT6 datasheet.

You could use an external device to do this.

@kennethlimcp I can post a schematic later, here’s a photo now . I’m actually using the LiPo Battery Charger from adafruit which has a power out that I’m using to power the core through VIN. The digital out of the Spark is running into a level shifter to bring the output up to 5V when running on battery.

I’ve tried the reset button and it hasn’t worked when the voltage is that low. So I’m assuming the RST wouldn’t work either.

@v8dave What kind of external device were you referring too? Or was that statement referring to the PVD?

Is that with the 5V via USB plugged back in or when the power is still down to 2V? With 5V re-applied, pressing RESET should work just fine.

I use the MCP130 range from Microchip.

@v8dave Thats plugging in the USB after the reset. Note that I’m not plugging in the USB into the spark, I’m plugging into the LiPo battery previously mentioned. The spark gives no indication it has power.

Heres a schematic of the project:

I’ve looked into the MCP130 and it might work for what I need assuming the voltage drops low enough when the battery ‘dies’ (I’m testing to see what that might be).

I’m also looking into a switch to either act as a reset (momentary) or on/off switch (toggle).

Mmmm. Not sure why Adafruit have a LOAD output on these boards as these are standalone battery charger IC’s and not designed to power a load at the same time as charging the battery.

The MCP73871 is and I’ve used this in a few designs. It has a separate battery connection so it can charge the battery and feed the output at the same time. When there is no charge input, it connects the load output to the battery. This Adafruit board uses it but you also need a buck/boost on the output to provide a stable 5V or 3.3V for your core. The buck/boost regulator takes in 2.5 to 7V and generates 3.3V or 5V (or any voltage depending on the programming resistors)

With your setup, you only ever see the battery voltage or charge voltage (4.2V), never 5V at the load output.

It is designed to charge with a higher initial current and then drop down to a trickle charge so in theory, very little of the input current is going to appear on the output once the battery is charged. I am not sure this is the ideal setup for what you are trying to do.

It could explain why your core does not restart when you plug in the USB to the charger. Very little current is probably flowing. You could connect a current meter in series with the spark and see what it tries to draw at each stage.

1 Like

Are you saying that because it only has a USB connection? Or is it because the board you mentioned also has a DC in?

I did look at the datasheet for both ICs and you are correct that the 871 does power the load while charging the battery. If that is the difference between the two ICs then I guess the board I’m currently using is powering through the battery even when its plugged in. But if that is the case then why does disconnecting and reconnecting the charger restore power?

Thanks for your help. I admit I’m still learning quite a bit about the “hardware” side of things. Typically I remain in the “software”.