Introduction: Computer/Laptop Temperature Monitor USB With Optional Alarm

About: I am a college student; I enjoy hacking electronics and DIY projects

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.

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:

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
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


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:


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,

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: aray);

- Now that you initialized and selected your device. You can issue a ROM command, followed by a Function command using


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.

USB Contest

Participated in the
USB Contest