Sensorbox config commands

From P2P Food Lab
Jump to: navigation, search

Setup internal and external temperature sensors

Modify your config.json and edit the line saying "trh" and "trhx"

{
 ...
 "sensors": {
        ...
       "trhx": "yes", //or "trh":"yes" for the internal sensor
        ...
   },
   ...
}

Set fixed hour to upload data to server

Fixed hour:

{
 ...
 "sensors":{
     ...
     "upload":"fixed",
     "fixed":[
         {"h":"10","m":"00"},
         {"h":"","m":""},
         {"h":"","m":""},
         {"h":"","m":""}],
     ...
 }
}

Periodicaly:

{
 ...
 "sensors":{
     ...
     "upload":"periodical",
     "period": "30",
     ...
 }
}

How to upload data from Arduino to RPi

The Arduino keeps data in its memory until RPi upload them (depending on your configuration)

It's possible to upload them at any time through the terminal by typing

$ /var/p2pfoodlab/bin/sensorbox -l - store-data

Data will be written in file /var/p2pfoodlab/datapoints.csv


How to change update period

{

 ...
 "sensors":{
     ...
     "update":"1",
     ...
 }

}

'update' value is measured in minutes.

Nota: The Arduino doesn't have much memory. It can store around 150 measures. Thus, if you increase the sensor update frequency you should increase the upload value, that means start the RPi more often and use more power.

There is a space for a memory chip on the board, but code is not ready yet.

How to change IP settings

For IP static :

{ ...

 "wired":{
     "enable":"yes",
     "inet":"static",
     "static":{
         "address":"x.x.x.x",
         "netmask":"255.255.255.0",
         "gateway":"x.x.x.y"
     }
 },

... }

For DHCP :

{ ...

 "wired":{
     "enable":"yes",
     "inet":"dhcp"
 },

... }

Modifications are taken into account after a reboot. It's possible to apply them without rebooting by typing:

$ sudo /var/p2pfoodlab/bin/sensorbox -l - generate-system-files