Best way to use up some power?

After all the questions about power saving, this might seem an odd question but ...
I'm running a device on a lipo battery. The battery will charge to 4.2V, but I believe that this is not the ideal storage voltage for lipos, which ought to be kept at 3.7V, the nominal voltage. So after charging I would like to automatically run a bit of code that uses some power until the voltage drops to the right level. Are there better or worse ways of doing this?

Its a common feature of LiPo chargers I believe... 50% charge is recommended for storage IIRC.
Other battery chemistries are different, most wanting full charge for storage.

3.8V is a more often quoted figure for Lipos. My questions is not really about batteries but about what kind of code will make the a processor work hardest. (I originally posted this in the programming section but it got moved over here )

Is your intent to store batteries, or use them?

The battery will be charged, and remain connected permanently to the device it powers. The device will be in sleep mode until woken up through an external reset. At that point the battery will be used. I want to add some code to wake up the device periodically, check the battery voltage level, and dump some power if necessary.

Your best way to dump some “power” is to use a light bulb connected across the battery and switched by a relay . Use Arduino to monitor the voltage and when it drops to your desired value operate the relay and turn the bulb off .

Thanks, but not an option. Everything is ultra small and potted. There is no room for any other hardware. Hence my asking for a software solution.

Too bad, as it seems to be the best solution would be to have the charging hardware set to a lower terminal voltage.

Every charge-discharge cycle causes wear on the cell.

I’m curious how much genuine benefit there is to reducing the max voltage of the cell. presumably you’re doing it to extend the battery life. But if it results in more frequent charging (which itself shortens the life of the cell, plus results in more maintenance), is that really desirable? Or is this a solar-charged device that constantly stays “topped-off”? How does keeping the cell topped-off, but also in constant-use affect overall life?

How much load does your device pull and what’s your batteries capacity? It may pull itself down out of the 4.2V range relatively quickly depending on its capacity and the requirements of your device.

Yes, I share your scepticism to some extent.
It is to extend the battery life, since in the lipo community (especially among drone users etc) there are frequent admonishments to do this. I am not completely convinced since I haven't seen a truly authoritative source, but I want to do the right thing.
I'm using a lipo charger module that automatically takes it to 4.2V then stops - this seems to be standard.
In sleep mode the device pulls about 15uA and the battery capacity is 30mAH. The general lipo discharge curve from max (4.2V) to 3.8V is fairly steep. My impression is that in my case it takes a couple of days to get there, but I haven't measured it.

If you're using an Arduino board with an onboard LED, turn that on. If you're using an ATmega32U4 based board like Leonardo, Pro Micro then you can even turn on the RX and TX LEDs.

Floating inputs are supposed to increase power consumption. So you could use pinMode() to set all possible pins to INPUT mode.

Having the watchdog timer on increases power consumption.

The latter two are fairly minuscule.

Depending on your circuit, there might be some other ways to increase power consumption so it might be helpful if you provided that information.

How about some resistors to eat up a bit. I had issues with a powerbank module to power my low power project. It would shut down because there was not enough consumption so I used some resistors to create a load.

You need SOME kind of hardware to use power, you can not add anything you said, tell us what you have already so we might be able to work with that.

Waste of time.
If you want to store the battery so that it retains its charge , then keep it at 40% charge, but theres no point deliberately charging it to 4.2V only to then discharge it to some lower value.
The extra charge / discharge cycles will reduce the batteries capacity more than just keeping it at 4.2V .

How do you charge it ? Same connection to discharge it too?

You only need to discharge to the storage voltage if you intend to not use for a while ( more than a week ? ) and it may only matter for hi power cells , not sure.

Most commercial
Chargers can charge to this voltage .

but about what kind of code will make the a processor work hardest.

The code running on an Arduino does not affect the current draw. No sort of code takes more current than any other.

If clock-speed were increased, wouldn't that draw (slightly) more current? Not sure how flexible that is to change on-the-fly, though.

Regardless, this whole concept seems like a moot point, and this thread feels like an X-Y Problem.

Floating inputs are supposed to increase power consumption. So you could use pinMode() to set all possible pins to INPUT mode.

That seems like an incredibly bad idea. It would make a lot more sense to just connect resistors to some unused pins and set them high to eat more power.

However, I agree with others that charging to 4.2 only to discharge is wearing out the cell. There should be some adjustment on the charger, you may have to add a trimpot, for terminal voltage.

Why 3.4V? Merely reducing terminal voltage to 4.0V leaves it at 70 to 75% charge, but increases the full charge/discharge cycles by 3x.

The range of charge/discharge affects the units of energy you can utilize in the cell.

Case 1: 75–65% SoC offers longest cycle life but delivers only 90,000 energy units (EU). Utilizes 10% of battery.
Case 2: 75–25% SoC has 3,000 cycles (to 90% capacity) and delivers 150,000 EU. Utilizes 50% of battery. (EV battery, new.)
Case 3: 85–25% SoC has 2,000 cycles. Delivers 120,000 EU. Uses 60% of battery.
Case 4: 100–25% SoC; long runtime with 75% use of battery. Has short life. (Mobile phone, drone, etc.)

polymorph:
That seems like an incredibly bad idea.

Why is it an incredibly bad idea?

polymorph:
It would make a lot more sense to just connect resistors to some unused pins and set them high to eat more power.

It would if OP hadn't specifically said adding hardware was not an option.

robertjenkins:
After all the questions about power saving, this might seem an odd question but ...
I'm running a device on a lipo battery. The battery will charge to 4.2V, but I believe that this is not the ideal storage voltage for lipos, which ought to be kept at 3.7V, the nominal voltage. So after charging I would like to automatically run a bit of code that uses some power until the voltage drops to the right level. Are there better or worse ways of doing this?

After charging, use the A to D converter read the voltage of the batteries, some testing for optimization may be required. If the voltage is higher then what you desire, switch the battery into the circuit as the primary power supply and let the project drain the battery down to its desired level. When the battery voltage has reached the desired level on the battery under load, switch the main power on, battery off, now no load on the battery, and do the thing.

You may find that the circuit and code to do this may want to switch the battery back into the circuit when their is no load on the battery but with some measurements of the no load battery voltage, high and low limits of the drain the battery thing could be realized and coded for.

Yea, I read about not wanting to add to the existing circuit but that's my idea. A relay, some wires, perhaps a kick back diode, and two 1% resistors.