gfroerli / firmware

Firmware for the water temperature sensor project
GNU General Public License v3.0
6 stars 1 forks source link

Power down #25

Closed dbrgn closed 6 years ago

dbrgn commented 6 years ago

This PR contains code from #18, #23 and #24. Merge those first.

Replaces #12.

Right now, only the commit cf8eac0 is relevant.

This commit adds code to power down the MCU. Here's the power trace:

screenshot

On the left you can see the MCU waking up and joining via OTAA. Then the measurements are sent and the LPC11U24 enters power down mode, which consumes 134 uA (highlighted area).

Then after 5s interval time, the MCU wakes up again and sends another packet (which arrives). During the next power down phase, current consumption is 2.17 mA. Due to reasons unknown to me, starting during the third power down phase, the current consumption is 4.58 mA.

But the main issue is that after the second sleep phase, the RN2483 does not wake up anymore, even though a break condition + 0x55 byte are sent.

Needs some more debugging. Maybe @rnestler has an idea when he gets back from holidays :slightly_smiling_face:

Once we get this fixed, it should be possible to bring down the power consumption even more by shutting down peripherals we don't use.

dbrgn commented 6 years ago

@rnestler rebased. I increased the sleep time to 15 minutes.

Care to take a look? I think we can wait with refactoring until we have some field experience with the sensor itself.

dbrgn commented 6 years ago

Here's the trace of a full 15min cycle:

powertrace

It's 235 uA on average. What's strange, is that the RN2483 wakes up 24s too early... is its clock that bad?!

screenshot

Powertrace (~35 minutes): https://tmp.dbrgn.ch/powertrace-20180605.otii

rnestler commented 6 years ago

So I think it would be nice to remove the unnecessary sleep calls to further improve battery time. But afterwards let's merge it and get one prototype deployed for real :smiley:

dbrgn commented 6 years ago

I'll merge this now since it's already deployed anyways. We can still optimize, but that will require additional testing.