Skip to content

Recording RPICT Serial stream on local file

This is to record the data from a RPICT series board in a plain CSV file that can be opened with excel or else later on.

We are proposing a basic script template which can be installed as below.

Get the lcl-gateway tool and install it this way.

wget sudo dpkg -i lcl-gateway_2.1.0_armhf.deb

Edit the gateway.conf file to reflect your own settings.

sudo nano /etc/lcl-gateway.conf

In this file you should turn off Emoncms and Influxdb. Then turn on localsave. Also edit the directory if needed.

[system] port=/dev/ttyAMA0 baud=38400

[emoncms] enabled = False hostname = apikey = --apikey-from-emoncms-goes-here-- node = 20

[influxdb] enabled = False url = dbname = mydb user = token passwd = -optional-password-goes-here---- measurement = rpict3t1           # Modify this to match your board

[localsave] enabled = True directory = /tmp/

Insert the RPICT and run

/usr/local/bin/ -d

The data will be stored in the /tmp directory. One file per day in csv format. Titled with the epoch time when it started.

Note that rebooting the pi will erase all that is inside /tmp. Use /home/pi/data if you need to preserve the data between reboots.

start lcl-gateway

You can launch the gateway in the background using

sudo systemctl start lcl-gateway

If you prefer running the program by hand with some debugging to troubleshoot use the command below:

/usr/local/bin/ -d

To make the gateway start automatically at boot time enter:

sudo systemctl enable lcl-gateway