Teensy Feather, OLED wing, lipo battery and Snooze library fun and results

Status
Not open for further replies.

DaQue

Well-known member
I was asking some questions in another topic and someone suggested I post something here when I finished up my little project, its not much of a project but I did enjoy it.

As a bit of background at work I had to test how a part change would effect battery life on pagers we repair so I used a Teensy to send data to a laptop. Each test lasted a few days and as luck would have it the power went out on one and the data was lost and the test had to be reran. This got me interested in using a battery as a backup and to log the data in the Teensy eeprom and just dump it all at once.

By the time I got around to getting an Adafruit Teensy feather adapter, OLED feather wing, and 500 mAh lipo the work tests were done but that didn't mean I couldn't have some fun at home and maybe learn something. I decided to take the sketch I used for work and see how long I could get my setup to log its own lipo and Vin, these could be easily changed back to do the pager tests again if needed.

My test displayed 3 voltages (more on the 3rd one later) running time and how many data sets were stored on the EEPROM. It ran for about 13 hours displaying new data every couple seconds with the display always on. I decided to run at a much lower MHZ and use delay() to turn the blank the display most of the time and only have it "on" 10% of the time. It ran for a couple days. Using the Snooze library to replace all the delays with deepSleeps got it to last about 6 days. A test using a REDUCED_CPU_BLOCK to drop the clock to 2 mhz didn't gain me much additional run time. This makes sense, it spent almost all of its time in deepSleep anyway.

About the 3rd voltage I logged. I tied a 10k resister from the built in LED pin to A0 (right next to it) and put a forward biased red LED to ground. I used this is sort of a cheap 2nd reference to confirm something I saw in the data plots. They would tip up right at the end of the battery life indicating an increase in voltage. I checked the voltage across the led I used diased thru 10k from 2.9 to 6.1 volts and it only changed .6%. The lipo shuts off at 3v. As I thought right before the battery dies the last 20 mv or so the ADC reading of the LED would go up showing the ARef was dropping. I only turned the leds on for 20ms out of every 2 seconds so it didn't add that much current draw, and I could tell at a glance it was still running.

Things I learned from this include that if you use Snoose and deepSleep or a REDUCED_CPU_BLOCK the USB serial port will probably be unusable until you restart the chip. You may even need to hit the program button on the Teensy to get it to load a new sketch. REDUCED_CPU_BLOCK still beats setting the Teensy to 2 MHz at compile time as you can have the first part of your sketch run at 24 MHz plus and still be able to dump data via USB.

Most of my battery life gain however came from using deepSleep to replace my delays(). I probably won't include the REDUCED_CPU_BLOCK if I use a display in the final version. As it turns out I only really used the display to see if it was still running. Having the a led blink on for 20ms every 2 seconds is a much easier and lower current way to do that. I put 0.1 uf caps to Aground on all the analog inputs I used. A bit big but they really smoothed out the noise and I didn't need fast samples. The reading of the lipo was quite low with out a cap, about 0.4v low. Adafruit supplys a voltage divider from the battery using a pair of 100ks on A7. I also learned my solderless breadboard sucks. I got a cheap one and the resistors kits I bought have leads small enough not to make reliable connections. I ended up soldering up a regular dip breadboard but used some surface mount chip caps and resistors I had left over. They were small enough to fit between the rows and worked great.

I got in a JST extension cable and modified it so I could hook up my Fluke 17B+ to measure some actual lipo current draws. The 2 MHz values were in a REDUCED_CPU_BLOCK. The no display values were with the OLED feather wing removed and all display function calls and library code removed. All were taken during a delay or deepSleep as noted.


96 Mhz delay() display on 42.4 mA
96 Mhz delay() display blank 39.2 mA
96 Mhz delay() no display 37.6 mA
96 Mhz Snooze display on 6.67 mA
96 Mhz Snooze display blank 3.41 mA
96 Mhz Snooze no display 0.29 mA <---------------
2 Mhz delay() display on 6.92 mA
2 Mhz delay() display blank 3.67 mA
2 Mhz delay() no display 2.22 mA
2 Mhz Snooze display on 5.15 mA
2 Mhz Snooze display blank 1.91 mA
2 Mhz Snooze no display 0.29 mA <---------------
 
Last edited:
One thing you might consider in the future is the epaper display, which is still visible when the power goes out. I saw this crowdfunded site that is making a Teensy version of it. I ordered one as part of the original crowd funding phase, but it hasn't shipped yet. But they are hoping to ramp up for normal production.

Adafruit is reselling an e-paper display from pi-supply for mounting on the Raspberry Pi Zero: https://www.adafruit.com/products/3335.

When the Adafruit display was announced, I suggested a feather version of the display, and the pi-supply folk thought it might be an interesting variant: https://forums.adafruit.com/viewtopic.php?f=57&t=106700.
 
I'm waiting for the price of those epaper displays to drop some before I try them. I'm a bit cheap or I would have one.
 
Can't understand why they make these ePaper Displays hardware specific instead of simply providing a quick bus like SPI, so that such a display could be used with whatever microcontroller which would open the market much wider.
 
My lastest version (2 Mhz,Snooze deepSpleep, no display) has been running 3 weeks now on a 500 mAh lipo. Tempting to just start a new project, but I want to see how long it will last too.
 
Final update. It ran 65 days logging 3 voltages every 50 mV change on one of the channels using a 500 mAh lipid. Not bad.
 
Status
Not open for further replies.
Back
Top