International Journal on Engineering Technologies and Informatics (IJETI)

Review Article Volume2-Issue5

Design and Implementation of a Home Temperature Monitoring System

Jean Jiang*, Michael Acosta

Department of Engineering Technology, Purdue University Northwest, USA

*Corresponding author: Jean Jiang, Department of Engineering Technology, Purdue University Northwest, Indiana, USA.
Article History
Received: October 16, 2021 Accepted: October 19, 2021 Published: October 21, 2021
Citation: Jiang J, Acosta M. Design and Implementation of a Home Temperature Monitoring System. Int J Eng Tech & Inf. 2021;2(5):127‒130. DOI: 10.51626/ijeti.2021.02.00025

Download PDF

Abstract


In this paper a home temperature monitoring system which is controlled by a Raspberry Pi as the micro-controller is designed and implemented, and the system can be accessed from anywhere there is an active internet connection. The design for this project includes building the sensor network, programming the Raspberry Pi, setting up the MySQL database, and establishing the internet connectivity. The system is capable of detecting the home temperature via a sensor network, in which three sensors are connected using wires. Then a microcontroller, Raspberry Pi, is to collect and process the data from the Serial Peripheral Interface (SPI) as a data communication channel. In addition, the database access from a web browser is created by making a website that uses a web server language PHP to supply data from a relational database MySQL to a client browser upon demand. Finally, the system displays the date, time and channel number as well as the temperature.

Keywords: Temperature monitoring; Microcontroller; Raspberry pi; Sensor network; MySQL database; Signal processing; Analog-to-digital (ADC) converter; Data acquisition

Introduction


In real life, it is beneficial to design and build a low-cost home temperature monitoring system [1]. In this paper a special inexpensive and real-time home temperature monitoring system is developed and implemented, in which home temperatures are controlled by a Raspberry Pi, and the data can be accessed from anywhere there is an internet connection for convenience [2,3]. This project includes building a sensor network [4], programming the Raspberry Pi, setting up a MySQL database, and establishing the internet connectivity [3]. The general framework of a detecting and monitoring system is depicted in Figure 1.

As shown in Figure 1, there are three temperature sensors connected using wires at the first stage. The second stage includes an ADC (Analog-to-Digital Converter) unit, which utilizes a Microchip model MCP3008 to convert an analog temperature signal from a sensor to a 10-bit digital result. The last stage is a microcontroller, a Raspberry Pi, which serves as the data processor and display.
Figure1
Figure 1: General framework for a temperature monitoring system.
On the other hand, software development also comprises a major design of the home temperature monitoring. The Serial Peripheral Interface (SPI) is one of the several data communication channels that the raspberry Pi supports. It is a synchronous serial data link in which one master device and/or more slave devices are used. Then we create and run the SPI Python programs for the development environment, therefore, the Raspberry Pi as a controller can process and display a continuous stream of temperature values generated by three TMP36 sensors. In addition, the database access from a web browser is created by making a website where uses a web server language PHP to supply data from a relational database MySQL to a client browser upon demand.

The paper is organized as follows: Section II describes the hardware design. Section III illustrates the data collecting technique and the software design. Section IV presents the system overall function and testing results. Finally, we give the conclusions and possible improvements in Section V.

Hardware Design


The system contains three major hardware components: a temperature sensor network, an ADC unit, and a Raspberry Pi as a microcontroller.

Temperature Sensors
There are three temperature sensors used in the system as a sensor network, in which TMP36 devices serve as sensors. Figure 2 shows the function block diagram for a TMP36 sensor. Note that those sensors are connected using wires. The reason for using wires is to simplify both hardware and software designs. This decision assists us on focusing on creating a successful sensor system without being concerned with the potential difficulties that can take place when using wireless sensors. A TMP36 temperature sensor is built in standard TO-92 plastic form, similar to a common transistor. However, a TMP36 is far more complex than a simple transistor because it contains circuits to both sense ambient temperature and convert that temperature to an analog voltage.
Figure2
Figure 2: TMP36 block diagram.
ADC Unit
The raspberry Pi does not contain any means by which analog signals could be processed. This means that an analog-to- digital converter (ADC) must be used before the Pi can deal with the temperature signals. The specific type of ADC used in our system is a Microchip model MCP3008, which is described in the Microchip datasheet as a 10 bit, SAR ADC with SPI data output. This means that the MCP3008 uses a Successive Approximation Register (SAR) technique to create a 10-bit digital result (output signal), that is, an output in a serial data stream using the serial peripheral interface (SPI) protocol. The ADC board is very inexpensive yet it has impressive specifications despite its low cost. The MCP3008 chip is in a dual-in-line package which indicates that either a custom printed circuit board (PCB) or a solderless breadboard must be used for it to interface with the Pi. A block diagram of the MCP3008 chipset is included in Figure 3.
Figure3
Figure 3: MCP3008 functional block diagram.
Firstly, an analog signal is selected from one of eight channels that are connected to the Input Channel Multiplexer. Using one channel at a time is called an operation in a single-ended mode. The MCP3008 channels can be paired to operate in a differential mode if desired. A configuration bit named SGL/DIFF selects single-ended or differential operating modes. The selected channel is then routed to a Sample/Hold circuit, which is also the input to a comparator. The other input to the comparator is from a Digital-to-Analog Converter (DAC) that receives its digital input from a 10-bit Successive Approximation Register (SAR).

The SAR starts at 0 and rapidly increments to a maximum of 1023, which is the largest number that can be represented with 10 bits. Now each increment increases the voltage appearing at the DAC’s comparator input. The comparator will trigger when the DAC voltage precisely equals the sampled voltage, and this will stop the SAR from incrementing. The digital number that exists on the SAR at the moment the comparator outputs is the ADC value. This number is then been outputted, one bit at a time through the SPI circuit discussed in serial peripheral interface. All this takes place between sample intervals. The actual voltage represented by the ADC is a function of the reference voltage, VREF, which is from the MCP3008. In the case of our project, VREF is 3.3 volts, thus each bit represents 3.3/1024 or approximately 3.223 millivolts. For example, an ADC value of 500 would represent an actual voltage of 1.612V, which is evaluated by multiplying .003223 by 500.

Microcontroller- A raspberry pi 3
The Serial Peripheral Interface (SPI) is one of the several data communication channels that a raspberry Pi supports. It is a synchronous serial data link in which one master device and/ or more slave devices are used. There is a minimum of four data lines with the SPI. There are usually two shift registers involved in the data link; these registers may be hardware or software depending upon the devices involved. The Raspberry Pi implements its shift register in software while the MCP3008 contains a hardware shift register. Both registers form the inter-chip circular buffer arrangement that is the heart of the SPI. Data communication is initiated via a master device to select the required slave. During each clock cycle, the master sends a bit to the slave, which reads it from the MISO line. This operation is known as the full duplex communication, where there is simultaneous reading and writing between master and slave. Figure 4 shows a Raspberry Pi 3.
Figure4
Figure 4: A Raspberry Pi microcontroller.

Software Design


Software development comprises a majority of the design of the home temperature monitoring system. Enter sudo nano/etc/modprobe.d/raspi-blacklist.conf into the command window. Add the # symbol in front of the line spi-bcm2708. Use CTRL-O to save and CTRL-X to exit the nano editor. Then reboot the Pi by entering sudo reboot. By entering the lsmod command again within the terminal window, we are able to see the spi-bcm2708. Then we have to load the Pyhton libraries that will allow programs to run by the SPI circuits that we just enabled Figure 5. In the python terminal window enter sudo apt-get install python-dev, after this install finishes, create a special directory to run the SPI Python programs [1]. The Python code segment is listed below which displays a continuous stream of temperature values generated by the TMP36 sensors [2].
Figure5
Figure5
Figure 5: Single Channel Code Segment for a Raspberry Pi.

Integration and Results


The system design starts with the sensor network, in which three temperature sensors are connected to an ADC unit by using wires instead of wireless design. We first test a single-channel data communication, which has proven that the ADC and sensor supporting software function as expected. Using RJ45 cables for the wiring component, we then build a three-channel sensing system similarly. On the other hand, connecting and testing the ADC with the Raspberry Pi is done by connecting the MCP3008 with the Pi using the Pi Cobbler prototype tool along with a solderless breadboard. The TMP36 Vout lead should connect to the MCP3008 Channel 0 input, which is pin 1. The TMP36 sensor is connected with three jumper wires to the breadboard. With the interconnecting RJ45 cables, the cables length should be at least six-feet long depending on the sensor locations and the Pi’s location. The complete system schematic diagram is displayed in Figure 6 and the hardware connection is shown in Figure 7.
Figure6
Figure 6: The Complete System Schematic.
Figure7
Figure 7: The System Hardware Connection.
On the other hand, the software to control multiple sensors is essentially very similar to the single sensor version except for two additional sensors. Then we revise Python program to display the date, time and channel number as well as the temperature in the following Figure 8.
Figure8
Figure8
Figure 8: Multi-Channel Code Segment for a Raspberry Pi.
The database access from a web browser is created by making a website to supply data from a relational database MySQL to a client browser upon demand, and MySQL database is available online [3] and can be accessed on your PC. An open-source Python package named python-mysqldb contains all the libraries necessary to establish connectivity between a Python script and a MySQL database [2].

Conclusion


In this paper, an inexpensive home temperature monitoring system is developed and tested. The system collects different home temperatures via three temperature sensors and displays them on a Raspberry Pi. In addition, the system data can be accessed from anywhere there is an internet connection. All of the detecting and access results are satisfactory.

This monitoring system can be furtherly improved. For example, in order to improve the sensor network, we can place more sensors as a sensor array to the Analog-to-Digital converter, or use two separate Analog-to-Digital boards along with two groups of sensors to monitor the home temperature on different floors in the house. Further development of the sensor array data controlling could allow accurate detection of the temperatures on different home locations.

References


  1. https://www.acurite.com/choosing-a-remote-temperature-monitoring-system
  2. https://www.python.org
  3. https://www.mysql.com/products/community/
  4. Tan L, Jiang J .Digital Signal Processing: Fundamentals and Applications. 3rd edition, Elsevier: Academic Press; 2018.