We need a way of presenting the temperature data that has been saved to the database in the last tutorial. This tutorial shows how we can create a simple representation of the data and is only intended to as a starting point for the display of data and can be taken much further. For the purposes of this course our data display techniques will remain simple and could become more advanced if you were to take another course like the Making Data Interactive INTD319 course. In the mean time, enjoy this simple effort.

The Code

The following code is a PHP file that we can place on our Raspberry Pi’s web server (in the /var/www directory) that will allow us to view all of the results that have been recorded in the temperature directory on a graph.

Download the following s_temp.php.zip file and decompress it.

Place the file in a folder in your var/www/ directory and view the file by typing localhost/folder_name/s_temp.php. If all goes well, you should be able to see a graph that will look a little like this (except your data will be different).

Simple Line Graph of Temperature