Software-Install

If you have bought a SmartPi with preinstalled software, you can skip this chapter.
You have 2 different possibilities to install the SmartPi ­software on your computer:
  • Installation of a ready-made image
  • Manual installation

Own installation vs finished image

We recommend you to take our prefabricated images for installation.
All programs that are important for smooth operation are installed and configured there.
If you want to install the software yourself, you will have to install and configure some programs yourself, a
s they are not included in the repositories.
 
These include:

Installing a finished image

The simplest variant is to install a ready-made image.
You can load a ready configured image at https://files.enerserve.eu/smartpi/smartpi_bookworm_arm64.7z.
In contrast to the original Raspbian, many log files are moved to the ramdisk and some partitions are write-protected. Download the image and unpack the file. You need a program that can unzip 7-Zip files: http://www.7-zip.org).
 
Installation on Windows:
  • ­ Download the program
  • Win32DiskImager from https://sourceforge.net/projects/win32diskimager/
  • Insert the SD­card into the SD­card reader of your PC
  • Note the drive letter of the SD­ card. You can see the drive letter in the left column of Windows Explorer, e.g. G:
  • Run the program you downloaded earlier.
  • Select the unzipped file (*.img) in the "Image File" field.
  • Select the drive letter of the SD­card in the "Device" selection field and click "Write".
  • Wait until the writing is finished

 

Installation under Linux:

Use the dd command.
dd bs=4M if=path_of_your_image.img of=/dev/sdX conv=fsync
 

Manual installation

At this point we explain the installation with the help of a Debian package.
If you want to build the program directly from the source code, please follow the information on Github.
Create user smartpi:
 
In the installation package there are some files with special rights for the user smartpi.
To ensure a smooth installation, you should create this user as well:
sudo adduser smartpi --group --system

 

Add package list:

Add the Grafana repository to the package sources with the following commands:

wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
sudo apt update
sudo apt upgrade

 
Install additional packages:
 
sudo apt-get install -y i2c-tools, sqlite3, ppp, wvdial, libpam0g, npm, influxdb, grafana
 
 
Start InfluxDB and and create all the tables you need:
 
Then edit the configuration file of InfluxDB:
sudo nano /etc/influxdb/influxdb.conf

In the [http] section, verify that the following lines are commented out and have the appropriate values:
enabled = true
bind-address = „:8086“
auth-enabled = true

Activate and start the database:
sudo systemctl unmask influxdb
sudo systemctl enable influxdb
sudo systemctl start influxdb
 
 
After that, create the tables and users of the database:

influx -execute "CREATE USER smartpi WITH PASSWORD 'smart4pi' WITH ALL PRIVILEGES"

influx -username admin -password smart4pi -execute "CREATE DATABASE MeteringData"

influx -username admin -password smart4pi -execute "CREATE CONTINUOUS QUERY minmax_1h ON MeteringData BEGIN SELECT max(CosPhi1) AS MAX_CosPhi1,max(CosPhi2) AS MAX_CosPhi2,max(CosPhi3) AS MAX_CosPhi3,max(F1) AS MAX_F1,max(F2) AS MAX_F2,max(F3) AS MAX_F3,max(U1) AS MAX_U1,max(U2) AS MAX_U2,max(U3) AS MAX_U3,max(I1) AS MAX_I1,max(I2) AS MAX_I2,max(I3) AS MAX_I3,max(I4) AS MAX_I4,max(P1) AS MAX_P1,max(P2) AS MAX_P2,max(P3) AS MAX_P3,max(P3) AS MAX_P3,min(CosPhi1) AS MIN_CosPhi1,min(CosPhi2) AS MIN_CosPhi2,min(CosPhi3) AS MIN_CosPhi3,min(F1) AS MIN_F1,min(F2) AS MIN_F2,min(F3) AS MIN_F3,min(U1) AS MIN_U1,min(U2) AS MIN_U2,min(U3) AS MIN_U3,min(I1) AS MIN_I1,min(I2) AS MIN_I2,min(I3) AS MIN_I3,min(I4) AS MIN_I4,min(P1) AS MIN_P1,min(P2) AS MIN_P2,min(P3) AS MIN_P3,min(P3) AS MIN_P3 INTO hour FROM data GROUP BY time(1h),serial,type END"

influx -username admin -password smart4pi -execute "CREATE DATABASE FastMeasurement"


 
Tempfs Create file systems:
 
A Tempfs file system for the file with the current measured values is absolutely necessary. Therefore open /etc/fstab with a text editor of your choice (e.g. sudo nano /etc/fstab) and add the following entry:
tmpfs /var/tmp/smartpi tmpfs nodev,nosuid,size=20M 0 0
 
To protect the SD card, we strongly recommend the following additional entries in /etc/fstab for secure 24/7 operation:
tmpfs /var/log tmpfs defaults,noatime,mode=1777,size=10M 0 0
tmpfs /var/tmp tmpfs defaults,noatime,mode=1777,size=30M 0 0
tmpfs /tmp tmpfs defaults,noatime,mode=1777,size=20M 0 0
 
 
Installing the SmartPi software from the package:
 
wget [address of the package] (can be found under downloads)
sudo dpkg -i [name of the package].
After a reboot with sudo reboot the SmartPi is ready for use.
Installieren der SmartPi-Software aus dem Paket:
 
wget [Package address] (can be found at Downloads)
sudo dpkg -i [Package name]
After a reboot with sudo reboot the SmartPi is ready for use.

Access

By default, the SmartPi is delivered with DHCP. This means that it is assigned an IP­address by your router. To find out the IP­address of your SmartPi, you can either look in the list of registered on your router or search the IP­address with a network scanner Angry IP (http://www.angryip.org) or Netscan.

The hostname of the correct IP must be "smartpi" or "raspberry". You can now access the website with http://<IP­address>:1080.
A ssh­login is also possible:

Username: smartpi (pi before bullseye)
Password: smart4pi or raspberry

In the case of an Internet share (port share), we strongly recommend that you change the user's password for security reasons (command: passwd). The default password is known and allows hackers very easy access to your SmartPi and thus to your home network.

Web interface

You can reach the web interface at http://<IP­address>:1080
The web page currently displays the current values of power, current, voltage, cos phi and frequency.
A bar display shows the energy of the last 8 days.

A right click on Chart opens the display of the daily history of all measured values. A click on the button of the corresponding value adds the value to the daily history. Another click removes it again. The button "Day back" can be used to go back one day. The button "Day forward" jumps one day forward. The "Add day back" and "Remove day back" buttons can be used to extend or shorten the day view to several days.

 

Table view

The table view can be selected via the drop-down menu at the top left. Here a view or an export of the table is possible. Via the date fields an exact period can be selected.
Please note that it may take some time until the view is loaded.

Configuration page

The configuration page can also be loaded via the drop-down menu.
For access you need user name and password. These cannot be changed at this time:
Username: pi
Password: smart4pi

In the "default settings" you can assign a serial number, a name and coordinates to the smartpi. When using the API (see http://blog.enerserve.eu) this information is already evaluated.
The tab "measurement" contains all settings for the measurement. Here you can select the appropriate frequency for your country (50Hz or 60Hz). Furthermore you can set at which phase the measurement should be done and which sensor is connected. Here you can also set whether the voltage is to be measured or assumed. The corresponding voltage can then be set.

The tabs "mqtt", "ftp", and "mobile communication" contain the access data and settings for the respective points. Also the MQTT­ and FTP­upload can be switched on and off there.
Under "expert settings" you can change the port of the web interface and the format of the CSV­files.