Make A Portable Digital Temperature Meter for Weather, Science Labs, Sick Patents
Objective
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
Description
This project explored to use a
Raspberry Pi, please view it in Figure 1, which is available, but not limited, at canada.newark.com components.
And a DS18B20 Digital Temperature sensor, see Figure 2, which is available, but not limited, at http://www.ebay.ca
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 bit.ly/uoittempometer 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 fromthe websites, i.e. dx.com, fasttech.com, canada.newark.com, ebay.com, sparkfun.com, adafruit.com, and other website that gives you an inexpensive deal on your component/parts list. The students needs:
Laptop or any computer with Linux Ubuntu - this could be installed alongside with Mac or Windows.
HDMI compatable monitor ‐ completely optional, not needed, if laptop has SD card reader or student has USB SD card reader.
HDMI cable - ‐ completely optional, not needed, if laptop has SD card reader or student has USB SD card reader.
1 Raspberry Pi
1 Micro USB, cable that connects to the computer to power
Raspberry Pi's.
1 DS18B20 Digital temperature sensor
Breadboard (not bread! It has many perforations) Please see Figure 6.
Jumper wires
Solder station with solder iron, solder, flux in your lab.
Tape, multimeter, measuring tape, cutting tools in lab's station.
Method
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
Open the file /etc/apt/sources.list.d/raspi.list as root
sudo leafpad /etc/apt/sources.list.d/raspi.listStep 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
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.
Do:
sudo modprobe w1-gpio
sudo modprobe w1-therm
cd /sys/bus/w1/devices
lscd 10-000802824e58
cat w1_slaveYou 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 "temperature-logger.py" in the directory you are currently. Then, do the command:
python temperature-logger.py
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 temperature-logger.py 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 temperature-logger.py will run for 2 minutes, by default. To change it, just go to your open temperature-logger.py 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 temperature-logger.py.
This text file has all the temperature readings. Each new line corresponds to the reading at that sample.
PROGRAMMING TOOL & COMMANDS
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 bit.ly/uoittempometer.
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:
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.