Contact Digital Thermometer With Deep Sleep [Attiny85]
Introduction: Contact Digital Thermometer With Deep Sleep [Attiny85]
This might seem totally useless, considering how advance current technology can be and you might even be like "Tsk! a Thermometer?"
But there is a lot of experiment based on temperature (water temperature, room temperature, etc) so digital thermometer becomes a key instrument for temperature measurement considering the other alternatives and cost/performance ratio. It is used from measuring temperature of human body to measuring temperature of chemical substances. So, In this Instructable we'll build a digital thermometer which runs on a single CR2032 cell for almost 140days! (In makers term that is amazing!) and also run through optimizing the code and circuit for running in low power. Just to add some nostalgic moment, I used the piezo sensor to reset the thermometer that people usual do with a Mercury-in-glass thermometer.
So, enough with the story grab your supplies and let's get started.
Supplies
These are the list of products which can help you do this project with ease
(Affiliate Link)
* ATTINY 85 : https://amzn.to/3bB8t8p
* ATTINY dev board : https://amzn.to/3bC1cp3
* Piezo : https://amzn.to/2S6yo0V
* Arduino Nano : https://amzn.to/3tY8I3E
* PETG filament : https://amzn.to/3w6bB46
* DS18B20 : https://amzn.to/3ylGRy0
* OLED display : https://amzn.to/2VcEATc
* CR2032 : https://amzn.to/3ysFiOX
* CR2032 battery holder : https://amzn.to/3fsFhl8
* Resistor Kit : https://amzn.to/3frj4nx
* 3d Printer : https://amzn.to/3trVWKw
* Printer Upgrades : https://amzn.to/3hbK3Ga
Step 1: Temperature Sensor DS18B20
Let's start with the core part of the project, the temperature sensor.
Why DS18B20?
There are different sensors to choose from, based on accuracy, type and how they transfer the data to the microcontroller. but I chose the DS18B20, because it’s very well designed to read temperature from an external object, and it requires only one wire to read the data from this sensor. Also this is better for this project because of the metal probe, or it would be difficult to make a custom metal probe to make the contact point and the other major reasons are, the sensor is supported by a variety of libraries with Arduino and consumes only 5uA when it’s on sleep mode.
Step 2: Interfacing DS18B20 With a Microcontroller
To interface this. You can use any microcontroller because the sensor uses a protocol called one wire which is totally dependent on the software rather than the hardware, all you need is a single GPIO pin of the microcontroller.
Just for the sake of this example I will use the Nodemcu. The circuit connection is easy as it gets. 152
Connect the power supply i.e red wire to +3.3V, black wire to ground and the yellow data wire to D2 of the NodeMCU, that’s it. finally Don't forget this important step, add a 4.7k pull resistor between the 3.3v and the data pin. If not, the microcontroller won’t read the data from the sensor.
Step 3: Testing DS18B20
Now we can program the Nodemcu, Just go to your Arduino IDE and download the Dallas temperature sensor library and one wire library. Once that’s been installed. Go to example and open the simple temperature sensor example and change the pin wherever the sensor is connected too, in my case it’s pin D2 which is GPIO 4.
Compile and upload the code.
Once, the code is uploaded you can open the serial monitor. You see the sensor data is shown here, but this DS18B20 sensor doesn’t instantly show accurate temperature readings same as commercial thermometers, it takes a while to settle down at the correct value, you can also see how this affects in the final build. So, for the sake of this experiment, I have reduced it to the measurement time to 15 seconds. But in case you need a better accuracy you can always increase the measurement time in the code. 991