Using RAM you'd have maybe 30kB available, so if using 2 bytes for temp + light, it's 15000 samples, so if measuring once a minute it's 10 days worth.
Having said that, you can use the on-chip flash too, but it'll drain the battery a bit more. There's 512kB flash, but Espruino + the bluetooth stack and bootloader will take a lot of that. I'd hope there would be 100kB free but I can't be sure about that. SD cards are also supported so you could wire one of those up - but realistically the power consumption will drain the battery quickly - there are also some flash, EEPROM or RAM chips that you could wire on.
The chip is the nRF52832 - it's easy enough to google for the datasheet. It can wake up on a digital IO changing state, a timer, or a bluetooth event - so realistically you probably don't need to go up a tree for it :)
In terms of power consumption, on average with normal Bluetooth advertising it uses 15uA. I'll need to do some proper measurements of the power consumption when running, but I think it's around 5mA. JS execution speed isn't that fast, so you could expect that it might take 2ms to wake up, read temperature and light and write it to memory - so you can work out battery life based on that.
Realistically, as long as you're sampling every minute or more, you shouldn't suffer a big hit on battery life.
© Espruino, powered by microcosm.
Report a problem