Next project
Outreach Initiatives and Community Awareness

Make A Portable Digital Temperature Meter for Weather, Science Labs, Sick Patents


The manual can be used to inexpensively build high precision and customizable-to-the-use temperature sensor for work that involves quantifying and studying the dissipation or absorption of heat in general thermal physics, or thermal reactions in thermo-chemistry, or weather, etc. The lab teaches general public or students about building a DIY B-accurate (about 70% accurate, statistically) temperature sensor-meter with 3 decimal reading precision. It is ideal for beginner engineering students since it allows them to implement programming and instrumentation theory they had, or soon will have exposure to. End of lab exercises guide the students to answer comprehension questions and write solutions to real case studies.

Raspberry Pi eases the creation of fast and easy embedded development through it's Linux Operating System. The Linux Operating System kernel is open source and common to all computing architectures that use it. Each Linux distribution for the Raspberry Pi differ in the apps, for instance, to browse the web, do accounting, draw images, have compilers for programming languages ‐ nevertheless, the kernel is the same. Microcontrollers are the industry industry standard for embedded systems, however necessitate knowledge of circuit analysis, digital systems, signals and systems. This makes them ideal for an institutional setting, over that of an outreach.

Linux, for instance Rhasbian, a derivative of Debian, allows developers ‐ the students ‐ to control their environment using embedded applications that use Raspberry Pi for implementation. Despite Raspberry Pi's limitation to I/O with Digital Signals only, it is tremendously useful. This doesn't hold back Raspberry Pi's powr because the lab coordinator(s) or authors of manual(s) can easily include the DIY circuit schematics analog-to-digital, and digital-to-analog signals that students must make if they are using sensors/actuators that transduce real life signals to analog only.

Most freshmen engineering students will learn from this hands-on DIY about:

  • Instrumentation theory applications

  • Inter-program interactions in Linux

  • GPIO (general purpose input output) pin uses

  • Introduction to Electronic CAD


This project explored to use a

  1. Raspberry Pi, please view it in Figure 1, which is available, but not limited, at components.

  2. And a DS18B20 Digital Temperature sensor, see Figure 2, which is available, but not limited, at

Figure 1 A Raspberry Pi mini-computer with input/output or i/o terminals labelled. Raspberry Pi is $45, and has 512 MB ram, 700 MHz Processor with an ARM architecture.

FIGURE 2 This is a digital temperature sensor, which, unlike analog sensors, allows you to control its sample rate of reading using a shell script or a probing program from your computer.

The three terminals of the D18B20 ‐ power, data, ground ‐ are soldered carefully with Raspberry Pi's GPIO 3v3 pin, GPIO4, connect to GPIO ground pin. See Figure 3 to see Figure 4 to locate these pins.

The program for this lab at is in Python. Once is is called, it will probe the GPIO data pin at a given rate. This sampling is conrolled by the user in the programs source code. See Figure 5 to take a glimpse at the great ease with which the student can manipulate the sampling, for instance from once every hour to once every 1/1 000 0000 th of a second.

The student must check through all of the following materials. Missing components can be ordered from

the websites, i.e.,,,,,, and other website that gives you an inexpensive deal on your component/parts list. The students needs:

Figure 3 The numbered order of GPIO (General Purpose Input and Output) pins in Raspberry Pi. This figure is oriented with Pi's USB facing to the right.

  1. Laptop or any computer with Linux Ubuntu - this could be installed alongside with Mac or Windows.

  2. HDMI compatable monitor ‐ completely optional, not needed, if laptop has SD card reader or student has USB SD card reader.

  3. HDMI cable - ‐ completely optional, not needed, if laptop has SD card reader or student has USB SD card reader.

  4. 1 Raspberry Pi

  5. 1 Micro USB, cable that connects to the computer to power

Raspberry Pi's.

  1. 1 DS18B20 Digital temperature sensor

  2. Figure 4 Specific GPIO descriptor names as accronyms in numbered order.

  3. Breadboard (not bread! It has many perforations) Please see Figure 6.

  4. Jumper wires

  5. Solder station with solder iron, solder, flux in your lab.

  6. Tape, multimeter, measuring tape, cutting tools in lab's station.


    Before beginning read all the steps hereforth. Take some time to visualize the path the workflow below takes toward making the final Tempometer, start each step until the end. Pay close attention to the figures and diagrams.

    Step 1: Prepare Raspberry Pi

    Switch off your laptop. Take out your Raspberry Pi's SD card, and put it inside your laptop's or computer's memory card reader or USB card reader. In case you don't have a reader, only then use your HDMI cable to connect to the Raspberry Pi.

    Now, power your Raspberry Pi by plugging in the Micro USB to the Pi, while connecting the other end to the computer's USB.

    You will see Linux as you boot on your screen. Once it asks you to login, type in default authentication credentials -

    Username: pi

    Password: raspberrypi

    Figure 5 Snippet of code where variable measurement_wait, in seconds, controls the sampling rate of the temperature from sensor.

    Open the file /etc/apt/sources.list.d/raspi.list as root
    sudo leafpad /etc/apt/sources.list.d/raspi.list

    Step 2: Connect the temperature sensor

    Solder carefully ‐ do not mismatch the terminal connections ‐ the power terminal of the DS18B20 temperature sensor to the 3V3 Pin in the Pi, the data terminal to the GPIO 4th pin of Raspberry Pi, the ground terminal to any of the GPIO ground pins of the Pi ‐ does not matter which ground you choose.

    Step 3: Check for functionality

    Figure 6 A breadboard, which permits you to connect circuit elements, like resistors, capacitors, etc., and microcontrollers without soldering any connections physically.

    Before writing yourself or using pre-written program to read temperature, check if your DS18B20 is working.

    To do so, first navigate to the system directory where DS18B20 has a file allocated to.

    Recall your skills from Linux 101 to navigate in the Unix-like file system.


    sudo modprobe w1-gpio

    sudo modprobe w1-therm

    cd /sys/bus/w1/devices


    cd 10-000802824e58

    cat w1_slave

    You should see two lines of text, after you have completed the commands. The first line shows temperature reading 5 seconds or so ago.

    Step 4: Python program that samples temperature

    All is well! Now implement the pre-written temperature reading script written Python.

    Put the script "" in the directory you are currently. Then, do the command:


    This will start the program in your terminal windows.

    You will notice that it will display you the temperature reading at the xth time interval you set the at. By default, it is set to every 5 seconds.

    Step 4: Get data

    Reading temperature is good, but making decisions based on this data is more powerful. The will run for 2 minutes, by default. To change it, just go to your open with a right click, and select "Open With", then, "Gedit".

    Change the variables, intv and endWhen to your custom sampling rate and end time. However, you can end the temperature logging process anytime by pressing Cntrl + C while the program is being executed.

    Once the program ends after the designated end-time or your Cntrl + C signal to stop it, the program automatically saves a text file in the same folder as where you placed your

    This text file has all the temperature readings. Each new line corresponds to the reading at that sample.


    To accelerate a beginner to programming, the choice of language to do all controls and data logging on the Raspberry Pi is Python - a easy to use language where user doesn't have to control the internals of the program, like name spaces, memory allocation, data types, etc. All major Linux distributions come with the Python Compiler pre-installed with it, making it easier to avoid the search for IDE's or rote step-by-step compiler downloads for Python.

    Python is extremely powerful as a prototyping language. It is undesirable for high performance applications or extremely large software, such as an Operating System.

      Example Data

    After you have completed your own data collection, you have the option to view our own test data called temperature-data.txt in the folder you downloaded from

    In-Lab Exercises

    Use this setup in lab for:

    • Thermal chemistry experiment in Grade 12/11 to find the Enthalpy change in a Calorimeter.

    • Thermal physics experiment in Grade 10 to see the trend in which a stove heats ups.

    • See if a patient is ill ‐ read temperature from underarm, while patient is wearing a top.

    Imperative Areas in Need of Improvement

    This consecutive lab could have a GUI interface that allows students to select the sampling rate, end time, command to end the program. The GUI should also show in a window the graph of the data, and have check boxes to conduct curve-of-best fit, to have multiple plots and re-runs with the temperature sensor.

    Plus, at a hardware level, the DS18B20 is limiting due to it not being waterproof. Any touch with finger or water will short the sensor and give awkward resultes on the terminal window, like -0120 readings.

    To solve this, the DS18B20 should be openned, and hacked with an elongated non-conductive substance that can "feel" the temperature, and yet "tell" DS18B20-modified what temperature this extension is "feeling". DS18B20 Data Sheet is publicly available on the internet ‐ it has the circuit schematics, hardware tests, etc.

    Further Readings

    To have a deepened knowledge in Physical Sensorsyou should first gain a "knowledge scaffold and learning directions" of powerful math, science, computer technologies and engineering. Learn more as a student or teacher from free schools:

    Once you are confident, please Search with keywords "Physical Sensors", "Sensor Networks", "Embedded Sensor Applications" at UOIT Library or Open Textbooks and Open Encyclopediae:

Other Projects
Professional Circuit Drafting
Professional Circuit Drafting CAD drawing gives you professional grade circuit schematics and prototype models. Learn to communicate design of electronics and hardware innovation like the professional engineer. Continue >>
Knock to Ring Bell
Knock to Ring Bell Make a complete musical bell system that rings with your knock. Possibly, this may reduce door banging or frustration at dormitory doors that aren't allowed to have buttoned door bells, yikes! Continue >>
Raspberry Pi Tweet to my Door Raspberry Pi Tweet to my Door Raspberry Pi connected to colour display wirelessly. Show your twitter updates on a screen attached to your door at school's club office, classroom, treehouse room. Display to your audience your... Continue >>
Self-Driving Car
Self-Driving Car Robots are smart. Here you transform your old toy car or another vehicle into a bot that follows a wavy line. Use it for shipping goods between unmanned travel ports. Real world uses are endless. Continue >>
Optical Network Made Easy
Optical Network Made Easy Optical communication is fast, cheap, and reliable. Build your own prototype of a peer-to-peer network using laser. Understand how big Rogers, Bell and use Fibre to connect you in lightning speed to... Continue >>
Pedometer for Athletes
Pedometer for Athletes Supercharge your shoe! Use it to find issues in your run during basketball, track or soccer. Or, track the distance and stats of your jog. Help keep others keep their walk at constant pace, such as... Continue >>
Broadcast Your Radio
Broadcast Your Radio Broadcast your music and voice wirelessly. Spread your news with your friends over short distance using radio. It is easy to make, free, and won't get CRT angry at you. Radio podcasts, chatroom uses... Continue >>
Internet Controlled Lights
Internet Controlled Lights Use internet to make lighting during Christmas or other occasions dance! Surprise your buddies with LED sequence control. Make decoration energetic during your sweet holidays. Continue >>
Arduino Tweets to my Door Arduino Tweets to my Door Arduino connected through wire to display. Show your twitter updates on a screen attached to your door at school's club office, classroom, treehouse room. Display to your audience your location at the... Continue >>
Arduino Lilypad Remote Mouse
Arduino Lilypad Remote Mouse Control your computer's mouse with this homemade remote-control. Build touch switches completely in software and then link the remote to the computer via infrared. Continue >>
Gesture Pong Game
Gesture Pong Game Build your own motion tracked game and console similar to Kinect or Wii. Inside is code and design helping you make the classic Pong Game. Play the game as you move on your tv or monitor. See step by... Continue >>
Paper Music Player Tutorial
Paper Music Player Tutorial Play music from paper as if the paper was an "ipod". You build a system that senses capacitive touch on pencil shaded shapes on paper. With these touches music is controlled. Continue >>

Maintained by Qusay H. Mahmoud
Content Contributors: Rudy Lang, Michael Lescisin, Rahma Mahmood, Ahmad Shamshiri, Ahmad Touseef, Mirna Zohiry