Sometimes I should listen to my own advice


I've been working on the software for the Web connected thermostat. But I ran into a gotcha, that stumped me for a couple days. I had the button debounce working fine until...

Well I started mucking with the clocks for the CPU in BASIC. If you've read the forum over the years, I have warned people to be careful when doing this. Should have listened myself. As the thermostat has to run off the battery when heat is being requested, minimizing that operating current is important.

Normal power

BASIC normally runs at 48 MHz on the LPC11U37, which is consuming around 10 mA. The above graph does not include USB operation which makes it hard to debug when you disable that. (The final program will disable it). As the thermostat sits around doing not much most of the time, it can also be put to sleep, which drops the power even more.

Sleep power

So after getting sleep mode to work and wakeup for interrupts for button press, each minute to check temperature, and nightly resetting the clock; it was time to start playing with the oscillators. I switched to the 12 MHz clock and turned off the IRC and PLLs, and thought the time constants were set correctly. And while things seemed OK, all the debounce software wasn't working correctly. So DOH, it took a while to figure out I had made some mistakes with time constants, I'm back on the track finishing up the thermostat code.

Previous Next