Example of data acquisition and plotting on a
Raspberry Pi using Python
This simple example uses the commercially
available add-on Sense
Hat board in conjunction with a program
written in Python. It's applied here to measuring and
plotting temperature vs time. The Python code is shown below. (If
you don't already have it, install SciPi,NumPy, andMatplotlib into Python according those
Plug in the Sense Hat board onto the 40 GPIO pins of the Pi, boot
it up, install the sense hat software according to instructions,
save the Python script to the /home/pi
directory as temptime.py, then at the
terminal prompt type:
sudo python temptime.py
The results are shown in the animation below.
You can see as the temperature of the system warms up and is
cooled at time=35 by blowing on it.
I've created modifications of this code to measure and plot atmospheric pressure in millibars,
using pressure = sense.get_pressure(), the percent relative humidity, humidity = sense.get_humidity(), and to calculate and plot the
dewpoint from the relative humidity and temperature.
The Sense Hat also comes with a built-in gyroscope, accelerometer,
and a magnetometer that can be read in a similar way according to