Introduction: Computer/Laptop Temperature Monitor USB With Optional Alarm
This instructable will show you how to construct your own Laptop/ desktop temperature monitor, with optional alarm that will trigger a piezo buzzer for an audible notification. After completing this project, you can use the device to monitor other temperatures such as indoor/outdoor temperatures.
Attachments
Step 1: Parts List
- USB Port
- Arduino
- Arduino IDE
- MAXIM DS18s20 1-WIRE Digital thermometer
- Standard 16x2 LCD
- 10k Resistor
- 10k Potentiometer
- Breadboard
- hookup wire/ Jumpers for breadboard
- one wire library from:
pjrc.com/teensy/td_libs_OneWire.html
--Optional:
Piezo buzzer
Step 2: Overview
In this tutorial, we will be using a Maxim DS18S20 digital thermometer to read the temperature of a laptop/desktop computer. The DS18S20 is a 1-Wire device, which minimum connections only require a data line and ground in parasite mode, or +5V, GND, and data in regular mode. This device is great because it comes in a small TO-92 package and only requires one pin on the Arduino to transmit and receive data. We will be using the One Wire library from PJRC website (link to the download will be in the "Parts" step). A 10k pullup resistor for the thermometer will be used, the data sheet calls for a 5K, but 10k seems to work fine, and is what I had readily available in my parts bin. Additional DS18S20's can be put in parallel to have multiple readings of different areas.
When completed, this circuit will display the temperature reading in both Fahrenheit and Celsius in a whole number. If chosen, an audible alarm will sound if the reading reaches a predefined alarm temperature, and will continue to sound while the reading is above the alarm temperature.
Since this tutorial is about the temperature sensor, I will not be going much into detail about connecting the LCD display.
-Piezo buzzer is optional.
Step 3: Wiring Up the Connections!
Connections are as follows:
Arduino [+5v output] to Positive power rail on breadboard
Arduino [GND] to Ground rail on breadboard
DS18s20 [VDD] to power rail on breadboard
DS18s20 [GND] to ground rail on breadboard
DS18s20 [DQ] to digital pin 10 on Arduino
10K&resistor from DS18s20 [DQ] pin to +5v power rail on breadboard
With pins on the LCD display facing up, Leftmost pin 1, rightmost pin 16
LCD pin 1 to ground
LCD pin 2 to +5v rail on breadboard
LCD pin 3 to wiper (center) pin on 10k pot
LCD pin 4 to Arduino digital pin 2
LCD pin 5 to ground on breadboard
LCD pin 6 to Arduino digital pin 3
LCD pin 11 to Arduino digital pin 7
LCD pin 12 to Arduino digital pin 6
LCD pin 13 to Arduino digital pin 5
LCD pin 14 to Arduino digital pin 4
LCD pin 15 to +5v rail on breadboard
LCD pin 16 to ground rail on breadbaord
10k pot leftmost pin to ground
10k pot center pin to LCD pin 3 (already mentioned)
10k pot rightmost pin to +5v rail on breadboard
Optional:
Piezo [Positive] to Arduino digital pin 13
Piezo [Negative] to ground
Step 4: Find Your DS18s20 Unique Address
Now that you have everything wired up, its time to find your DS18s20's unique address. Each one wire device has its own unique address, So it is important to remember this when talking to any 1 wire device as they will only respond after being properly addressed.
Before opening the sketches provided, make sure you have installed the 1 wire library in correct directory for your Arduino to recognize it. For me, its in the following folder:
arduino-0022\arduino-0022\libraries
Once you have installed the library, its time to read the address from your device. Open up the
Roguelabz_1Wire_Temp_addr_finder sketch.
This sketch is written to show your devices address and nothing more. I wrote it to have the bare minimum to minimize confusion for anyone that would like to see how to the sketch works.
- Upload the sketch to your Arduino, make sure the USB is plugged in
When it is done uploading, You won't see anything on the LCD display. Thats fine for now.
Open up the serial monitor on the IDE, and it will display your device's address in hex, with the "0x" subscript.
Highlight the entire line that contains the address, and press CTRL + C to copy
( your screen should look similar to this image)
Step 5: Heart of the Code
Now that you have run the first sketch, and copied your device's adress, we can move on the the main code of this project,
Roguelabz_1Wire_S_temp_display
Open up the sketch, and you will see within the first few lines, " byte address[8] = {INSERT COPIED ADDRESS HERE}; "
Delete the part that says "insert copied address here" and press CTRL + V to paste your address, or you can right click and select paste. Be sure that when you paste your address, it does NOT run off to the next line like this:
byte address[8] = {0x10, 0x79, 0xB0, 0x3F, 0x2, 0x8, 0x0, 0x51
}; // Address of our one wire device
Not a big deal if it does. Just simply click right before the } bracket, and press backspace once and it will return to a single line of code
byte address[8] = {0x10, 0x79, 0xB0, 0x3F, 0x2, 0x8, 0x0, 0x51};
Now that you have pasted your address, upload the sketch to your Arduino, when it is done uploading, you should see the temperature displayed in the bottom row of the LCD display, in both Fahrenheit and Celsius.
In addition to the LCD display, you can monitor the temperature via USB by cliking the Serial Monitor in the IDE, and the temperature will also be displayed there. When the Alarm temperature is reached, a "!Warning!" will be displayed on the serial monitor.
If you would like the audible alarm, connect the piezo buzzer to pin 13 and ground. Scroll down to the bottom of the code, and find the alarm temperature. I commented on the line where this is located. Simply change the value to one of your desire, and the alarm will be triggered once this temperature has been reached, and will continue to alarm while the temperature is above this limit. The piezo is optional, but you can also substitute the piezo for an LED for a visual alarm, or have nothing connected for no alarm.
Step 6: How the Code Works
Now that you have a working temperature display and alarm, you might want to tweak the provided code, or would just like to know how 1 wire works. Its actually very simple.
First specify the pin your devices will be connected to, and name the pin:
OneWire myWire(10) This makes "mywire" on pin 10
OneWire yourWire(10)
OneWire theirWire(9)
both of these would also be correct
To begin using a 1 wire device, you must first find its address.
Before making any type of communication with a 1 wire device, you must first initialize the devices on the bus with a reset pulse.
A reset pulse is requires for each set of instruction to the device.
myWire.reset() (myWire is substituted with the name you assigned in the above step. ex. yourWire.reset();
After the initialization reset pulse, you select your specific device with:
yourWire.select(address aray);
- Now that you initialized and selected your device. You can issue a ROM command, followed by a Function command using
yourWire.write();
Don't forget! after each set of instructions, you must reissue the initialization sequence, reset pulse, and address the specific device to be communicated with.
In summary:
1. Initialize
2. Rom Command
3. Function command
4. data exchange( for some function commands)
Step 7: Put It to Use!
After you have constructed a working circuit on the breadboard, you can put it in a project box, and solder on a length of wire to the thermometer, and place the thermometer in your computer tower, or next to the exhaust vent on your laptop.
Here is a video of my circuit put to use, monitoring the temperature of my computer. I set the alarm temperature at only 90 degrees Fahrenheit, just to demonstrate the circuit in action. The audio seemed to have lowered during the conversion process of the video.
Attachments

Participated in the
USB Contest
16 Comments
10 years ago on Step 5
I commented out the "lcd.write" line and everything works fine now ??
Reply 10 years ago on Introduction
Hi Andy,
this code was written in Arduino 22 ide. After the Arduino 1.0, there were some changes in function names. if you can the lcd.write to lcd.print, it should compile just fine.
Reply 10 years ago on Introduction
Thanks! All is good now. Any thoughts about a logging version perhaps to memory card or web etc using php? Looking forward to more from you.
Reply 10 years ago on Introduction
I have a logging sketch , uses the ramtron fm24c04 fram memory on I2c protocol , if you are interested in that sketch. Also, I believe there is an eeprom library that is very easy to use, and it uses the eeprom in the atmega chip, so no extra parts are needed
Reply 10 years ago on Introduction
I'm interested for sure. Whatever makes it easier or best to get the data to my pc for graphing etc. My ultimate goal is a weather station and temp monitor for inside and outside my super-insulated house I'm building. The house uses sip panels for everything - basement walls, above-grade walls an floors and the roof. The data is critical for the design process to determine the best sip thickness etc. There is a growing self-build community here in Canada looking for low cost efficient homes we can build ourselves. I really appreciate your help.
Reply 10 years ago on Introduction
i will work on an update to be compatible with arduino 1.0+ and upload it to this page
10 years ago on Introduction
Hi, I just uploaded the sketches in a zipfile "RL_1Wire_temperature.zip", which you can download straight from this instructable's page. Both the address finder sketch and the temperature reading sketch, are included within the zip. Let me know if it helped.
Reply 10 years ago on Introduction
Im wondering if there is anyway to calibrate the MAXIM DS18s20 1-WIRE Digital thermometer because mine reads 90 degrees and I know its not 90 in here,lol. Do you know?
Reply 10 years ago on Introduction
I dont think they can be calibrated
Reply 10 years ago on Introduction
it does seem to be going down but it is slow now its reading 82, maybe it takes a while, who knows.
Reply 10 years ago on Introduction
yes, I got it, that was my mistake trying to get it off the webpage when you had it posted, lol, thx,
10 years ago on Step 5
I received an error while uploading;
"call of overloaded 'write(int)' is ambiguous"
referring to this line of code;
lcd.write(0);
11 years ago on Step 2
can you use the one wire library for arduino to arduino communication.
11 years ago on Step 7
you could add an fann control if you want :D
(this is verry nice :-D )
Reply 11 years ago on Introduction
That is a great idea. I will start working on a version 2 with fan control, with possibly increments of 20% power. Next version may also show how to mount it in an empty drive bay to give it a cleaner look. Thanks for the idea.
Reply 11 years ago on Introduction
:D no problem
maybe you could ad energy schemes.. for switching to high performans (like a gaming profile etc)