I wanted to share a project I am working in my free time. I was willing to send data from my Raspberry PI to the PI Data Archive.

 

I have seen similar projects using the PI HTML interface and PI Web API. Finally decided to use the PI UFL interface in order to share another way of doing it.

 

Setup

 

I am using a PI UFL interface in order to send data from the Raspberry PI into the PI Data Archive. The Raspberry PI gets the data logged in the .txt files. This files are stored into a shared file, which is in the Raspberry PI. Those files are then process by the PI UFL interface in order to send the data to the PI Data Archive.

 

  • Data Source: Information provided by the Raspberry PI (Model B+) running Raspbian.
    • Processor temperature
    • Processor clock frequency
    • Processor voltage
  • This information would be logged in a .txt file and save in a shared folder from the Raspberry PI.
  • Interface node: File processing with a PI UFL interface.
    • PI UFL version 3.4.21.21
    • PI Buffer Subsystem version 4.3.0.32
  • Gateway device: Home router through the Ethernet connection. For future projects I am planning on using a dongle WiFi USB.
  • PI Data Archive node: Physical machine with PI Data Archive 2012 SP1 32 bits.

 

Positive points of this setup:

 

Scenario 1:  If at some point there is a connection issue between the interface node and the Raspberry PI, the logs are going to be stored in the shared folder without being process. Once the connection is back between the interface node and the Raspberry PI, the .txt files with the data will be process. I see this as a file "buffer".

 

Scenario 2: If at some point there is a connection issue between the PI Data Archive, and the interface node but the connection between the interface node and the Raspberry PI is up. The .txt files will be process and the data will be stored in the PI Buffer Subsystem until the connection between the PI Data Archive and the PI UFL interface resumes.

 

Bash Script

I have used a bash script in order to collect the data from the Raspberry PI at the time of the event and to log it into a .txt file. Go the idea of getting information of the Raspberry PI processor for testing, in the following learning blog from Raspberry PI Worksheet - Temperature Log | Raspberry Pi Learning Resources . The bash script was modify to fulfil my needs.

 

#!/bin/bash

 

echo "Starting to record"

for i in {1..30}

do

    temp=`/opt/vc/bin/vcgencmd measure_temp`

    volt=`/opt/vc/bin/vcgencmd measure_volts`

    clock=`/opt/vc/bin/vcgencmd measure_clock arm`

    temp=${temp:5:16}

    volt=${volt:5:16}

    clock=${clock:14:22}

    echo "PTempPI "$temp `date +%F_%H-%M-%S`" ">>/home/pi/share/temperature_log_`date +%F_%H-%M-%S`.txt

    echo "VoltPI "$volt " ">>/home/pi/share/temperature_log_`date +%F_%H-%M-%S`.txt

    echo "ClockPI "$clock >>/home/pi/share/temperature_log_`date +%F_%H-%M-%S`.txt

    sleep 10

done

echo "Finish of the record"

 

In this script, I am logging the: processor temperature, processor clock frequency and processor voltage every 10 seconds, with the Raspberry PI timestamp, for 5 minutes each time the script is manually started.

On order to run the script I use the following command.

sudo bash /home/pi/temperature_log.sh

 

Results

The Raspberry PI processor information from the Raspberry PI is correctly logged into the .txt files, those files are process by the PI UFL interface and sent to the PI Data Archive.

 

In the trend there is a representation of a normal behavior of the Raspberry PI before a shutdown of it at 19:02 and start of it at 19:17. The temperature drops from 44,3 degrees Celsius to 27,3 degrees Celsius in 17 minutes.

 

 

This information could be useful if you are willing to test or put your Raspberry PI under stress, for example overclocking.

Got the idea of monitoring the Raspberry PI overclocking in the following blog Raspberry Pi • View topic - Overclocking

 

Conclusion

Yet another example in how to send data to PI with a Raspberry PI. I have some projects in mind that I will be sharing with time. I am still a bit amateur programming wise, but looking to learn. Hope this example is useful for you and shows you how easy is to play a little bit with the Raspberry PI and the PI System.

 

I will be studying how to do this test by sending the data to the PI Data Archive using the Setup provided in the example Raspberry Pi to the PI System Daphne Ng using PI Web API.