Monitor your home temperature using your Raspberry Pi

At the end of the project you will have a WWW dashboard that looks similar to this:
Multiple Sensors
Display a temperature history graph per sensor
What you need:
  • Raspberry Pi Model A or B
  • The following parts are available through the Ā  Ā PrivateEyePi Store:
    • DS18B20 sensor(s) (TS01), one per temperature reading you want on the dashboard
    • 4.7k resistor (one per sensor) (TS01)
    • Jumper wire cables and breadboard or wire, soldering iron and solder (JW01,Ā BB01)
      Monitor your home temperature using your Raspberry Pi
For support, queries or suggestions please emailĀ [email protected]Ā or leave comments in ourĀ blog.
Step 1: Build and testĀ the Electronics:
Parts can be purchased from our store:Ā
  • Purchase a DS18B20 digital thermometerĀ 
  • Purchase a 4.7kĀ ā„¦Ā (ohm) resistor
  • As perĀ Figure 1 put the resistor between pins 2 and 3 as in the diagram
  • Connect Pin 3 of the temperature gaugeĀ to 3.3v GPIO Pin
  • Connect Pin 2 of the temperature gauge to GPIO4 (Pin 7)
  • Connect Pin 1 of the temperature gauge to ground (Pin 6)

f you want to add multiple sensors daisy chain the middle pin of the sensors. This will work because every DS18B20 sensor has a unique ID that is used to differentiate theĀ signalsĀ coming from the sensors

Once built, follow the following steps toĀ test that it is working:
Log in to your Raspberry Pi
At the promptĀ pi@raspberrypiĀ / $
sudo modprobe w1-gpio
sudo modprobe w1-therm
cd /sys/bus/w1/devices/


You will see a listing of the current directory. There should be a directory that is the serial number ofĀ your temperature gauge.Ā The serial number of my thermometerĀ 28-0000040be5b6, but every one will be unique. Make a note of yours as you will need it later in step 4. If you have multiple sensors there will be multiple directories listed.Monitor your home temperature using your Raspberry Pi schemetic

If you donā€™t see a directory with lots of numbers and letters like the one above then:
  • Check your circuitĀ wiring.
  • Make sure you have the correct resistor (this is very important ā€“ yellow, violet, red, gold).
  • Feel the temperature gauge with your finger. If it feels hot then you have it wired back to front.
If you do see the directory then type cd followed by the directory name:
cdĀ 28-0000040be5b6
cat w1_slave
You will now see a dump of the w1_slave file that contains the temperature data in celcius (referĀ Figure 3). 20812 is 20.812 degrees celcius. The dashboard does support a Fahrenheit setting that we will cover later if that is your preference.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top