i know you can run a processor on a coin battery for weeks/months, look at tamagotchis/digimons.
iirc, many microcontrollers can be put into special modes that draw very little current from their power source. they may be running at a clock speed in the region of tens of kilohertz, but that is no issue for me.
my problem is i just can't find much practical instruction online about how to do such designs 'homebrew'. usually people just point me to a specific microcontroller datasheet, and that's it.
maybe my next deep dive will be how to build a lil puter that runs on a current draw that is ultra-low.
@vidak
I mean, the general concept is, you just set up your interrupts to listen for the input/timer event/whatever you want to wake up the computer, do whatever's required to sleep your peripheral hardware (other than external timers that will send the interrupt or extra RAM or whatever you need to keep alive), and then put the microcontroller to sleep.
The problem is 1) that doesn't help with reducing power when running, and 2) you have to choose peripherals to ensure that they all can be put to sleep (or at least, you can set up a transistor to cut power to them or something). The real hard part is designing it to be reasonably low power when running though, especially for things with any human output devices which inherently tend to just eat power (even e-ink and to a lesser extent memory LCDs absolutely hog power when refreshing, it's just offset by them not using any power when not refreshing)
You have to choose the right one with the right features, then put it in to the special ultra-low-power modes, often fully asleep with wake-on-input or only the watchdog timer running. The trick to low power computing is largely to not compute as much as possible.
@nytpu @vidak This. Most processors have a "wait for interrupt" instruction. When you execute this instruction, it puts the processor into a low power state while it does nothing until an interrupt is received. Only a reset or an external interrupt will re-engage the core at full power.
This sort of instruction is often found inside of a very tight loop, which basically means the entire firmware that the processor is executing is essentially interrupt driven. There's practically little to no sequential code that's executed.
@vidak
I don't know what your project is, but maybe you can look to the sensor-watch for inspiration?
Runs on a coincell, battery life is very much a concern, the code is open on GitHub.
sensorwatch.net
https://www.embeddedts.com/products/TS-4100
this little number is quite fascinating, but i was thinking of something that draws even less power...
https://hackaday.io/project/184340-potatop
I got annoyed with my personal laptop always being out of battery when I wanted to work on my small programming projects, so I am building myself a laptop form factor device. It currently has an estimated battery life of up to 2 years depending on ambient light (with a 12000 mAh li-po battery), but I am hoping to eventually make it powered by ambient light alone.
one more:
https://www.the-diy-life.com/making-an-ultra-low-power-arduino-pro/
This 3.3V Arduino Pro Mini uses over 600 times less power than a traditional Pro Mini, using a couple of simple, low power, changes that cost around $2 to make.
@jaredj @nytpu @vidak Although it didn't have the instruction, you could get the same effect with the RDY line. This trick was used in the Atari 2600, to synchronize against the horizontal sync pulse. You'd load from a special memory-mapped register, which would cause RDY to drop, this halting the processor, until HSYNC happened. (Don't use stores, because the NMOS 6502 doesn't respect RDY during stores!)
The WAI instruction in the 65C02 does the same thing: it just pulls RDY low until IRQ or NMI are asserted. 😏