I found this post recently and found it’s very interesting for a few things; 1) the way to read internal temperature from ATtiny85V in less noisy mode; 2) negabinary system; and 3) sleep mode to save battery power. It works pretty well. I’d like to thank David for sharing the great project and ideas and nicely written code. What it does is to measure the internal temperature using sleep mode precision and flashing 2 LEDs (one for 1 and the other for 0) in negabinary format. And then it goes into sleep mode to save battery power until the watchdog timer interrupt triggers.
After playing with it a couple of days, I found it was difficult to convert negabinary into decimal number. I’m pretty familiar with binary number and I can easily convert it into decimal up to 32. Why 32? I used to count the binary numbers using my right hand by folding and unfolding fingers. So, 2^5 = 32. However the negabinary number system can use 7 digits to show 23, for example. Also, those numbers, 2^odd, are to be subtracted from the total. To me, it was confusing and difficult to convert.
So, I was thinking to find other way to show the negative number and got this idea. My idea was to blink both LEDs briefly followed by positive number if the temperature is below zero. For example, if it’s -12degC, as soon as you press a push button switch, both LEDs are turned on for 400ms and off. After another 400ms, the positive number, 0b1100 (12), flashes.
The code can be downloaded from my GitHub.
Although it consumes very little current during the sleep mode, it still use the battery power. Instead of showing the temperature at given interval, I wanted to show the temperature when I press a button switch. Also, I wanted to turn it off completely. Since it doesn’t require long booting time like a laptop, almost instantly it turns on and show the temperature. So, I started thinking about a circuit that can latch the power after the switch is pressed until if flashes all the binary digits and disconnect the battery power automatically. Since the total current is just about 30mA (2 LEDs and ATtiny85v), the popular PNP transistor, 2N3906, which can work up to 200mA, can be used on high side. Now, in order to latch the power, another BJT transistor, 2N3904, can be used to pull down the base of the 3906 and the 3904 can be ON by a digital output pin from the ATtiny85v. I had to try a couple of different resistors, but it actually worked!!! Below is the schematic diagram.
It works perfectly with this small current consuming project, but the same circuit can be used for higher current project if you replace the PNP resistor with a logic level P-channel MOSFET.