IOT Stack on the Raspberry Pi

Bill of Materials

  • Raspberry Pi 4: This outstanding single-board-computer offers great software support, adequate hardware power and very low power consumption. Its core operating system and libraries are kept up to date. Everything from sensor reading headless servers to media center and full blow desktop computers is possible with this unique board. The Raspberry Pi 3B+ comes with 1GB RAM and USB2.0 for 45€, the Raspberry Pi 4 with 4GB Ram and USB 3.0 for 65€
  • 500GB SSD: There are three options to get a 500GB SSD connected, and it depends on which disk speed you want to achieve. These options are: a) Portable SSD disk (38€) b) 2.5 Inch SATA Drive and SATA USB Adapter (56€), c) M3 NVME SSD with USB 3.0 Adapter (72€). Be aware that ultimately your Raspberry Pi USB2.0 or USB3.0 limits the data transfer speed
  • Power Supply: USB power adapter with 5V & 5A for about 10€

Basic OS Installation

  1. Make the Raspberry Pi Bootable from USB
  2. Flash the SSD Drive with the latest Raspian OS

IOT Stack

git clone https://github.com/SensorsIot/IOTstack.git ~/IOTstack
> ./install.shIOTstack Installation
Enter in the sudo password when prompted, to install dependencies
Reading package lists... Done
Building dependency tree
Reading state information... Done
git is already the newest version (1:2.20.1-2+deb10u3).
0 upgraded, 0 newly installed, 0 to remove and 97 not upgraded.
fatal: destination path 'IOTstack' already exists and is not an empty directory.
IOTstack cloned
Python Version: 'Python 3.7.3'. Python is up to date.
...
cd ~/IOTstack
./menu.sh
cd ~/IOTstack/
curl -fsSL https://techoverflow.net/scripts/create-docker-compose-service.sh | sudo bash /dev/stdin
systemctl status IOTstack.service
● IOTstack.service - IOTstack
Loaded: loaded (/etc/systemd/system/IOTstack.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2021-08-26 14:24:41 CEST; 9min ago
Process: 17992 ExecStartPre=/usr/bin/docker-compose -f docker-compose.yml down (code=exited, status=0/SUCCESS)
Main PID: 18228 (docker-compose)
Tasks: 8 (limit: 2062)
CGroup: /system.slice/IOTstack.service
└─18228 /usr/bin/python3 /usr/bin/docker-compose -f docker-compose.yml up
Aug 26 14:33:01 raspberrypi docker-compose[18228]: mosquitto | 2021-08-26T12:32:00: Client auto-0EE1733D-00F1-DC2A-FEBA-3A04A8DBCC94 closed its connect
Aug 26 14:33:01 raspberrypi docker-compose[18228]: mosquitto | 2021-08-26T12:32:01: New connection from 192.168.178.40:48271 on port 1883.
journalctl -u IOTstack.service -f
-- Logs begin at Wed 2021-08-25 01:09:01 CEST. --
Aug 26 14:34:01 raspberrypi docker-compose[18228]: mosquitto | 2021-08-26T12:34:00: New connection from 192.168.178.23:49280 on port 1883.
Aug 26 14:34:01 raspberrypi docker-compose[18228]: mosquitto | 2021-08-26T12:34:00: New client connected from 192.168.178.23:49280 as auto-F53F2BB8-CCC4-68F7-5E34-7AEF57EF9FA9 (p2, c1, k60).
Aug 26 14:34:01 raspberrypi docker-compose[18228]: mosquitto | 2021-08-26T12:34:00: Client auto-F53F2BB8-CCC4-68F7-5E34-7AEF57EF9FA9 closed its connection.
Aug 26 14:34:01 raspberrypi docker-compose[18228]: mosquitto | 2021-08-26T12:34:01: New connection from 192.168.178.40:54539 on port 1883.
Aug 26 14:34:01 raspberrypi docker-compose[18228]: mosquitto | 2021-08-26T12:34:01: New client connected from 192.168.178.40:54539 as auto-EC2A2465-2F79-00CC-1C08-E675A4EDB6F9 (p2, c1, k60).
Aug 26 14:34:01 raspberrypi docker-compose[18228]: influxdb | [httpd] 10.77.60.5 - root [26/Aug/2021:12:34:01 +0000] "POST /write?db=telegraf&p=%5BREDACTED%5D&precision=n&rp=&u=root HTTP/1.1 " 204 0 "-" "-" e4a780b0-0669-11ec-8024-02420a4d3c04 7045
Aug 26 14:34:09 raspberrypi docker-compose[18228]: influxdb | [httpd] 10.77.60.6 - telegraf [26/Aug/2021:12:34:09 +0000] "POST /write?consistency=any&db=telegraf HTTP/1.1 " 204 0 "-" "telegraf" e9091e28-0669-11ec-8025-02420a4d3c04 7591
Aug 26 14:34:11 raspberrypi docker-compose[18228]: grafana | t=2021-08-26T12:34:11+0000 lvl=warn msg="Request Origin is not authorized" logger=live origin=http://192.168.178.40:3000 appUrl=http://localhost:3000/ allowedOrigins=
Aug 26 14:34:11 raspberrypi docker-compose[18228]: grafana | t=2021-08-26T12:34:11+0000 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=GET path=/api/live/ws status=403 remote_addr=192.168.178.23 time_ms=2 size=10 referer=
Aug 26 14:34:39 raspberrypi docker-compose[18228]: influxdb | [httpd] 10.77.60.6 - telegraf [26/Aug/2021:12:34:39 +0000] "POST /write?consistency=any&db=telegraf HTTP/1.1 " 204 0 "-" "telegraf" faeb0e4a-0669-11ec-8026-02420a4d3c04 19294

Additional Tool: NAS with OpenMediaVault

wget https://raw.githubusercontent.com/OpenMediaVault-Plugin-Developers/installScript/master/install
chmod +x install
sudo ./install
Current / permissions = 755
New / permissions = 755
Forcing IPv4 only for apt...
Updating repos before installing...
Get:1 file:/var/cache/openmediavault/archives InRelease
Ign:1 file:/var/cache/openmediavault/archives InRelease
Get:2 file:/var/cache/openmediavault/archives Release
...
  • Click on Access Right Managements/Shared Folder, press the Add button, and select the share
  • Select the new share, then press the privileges folder and add the local user and group
  • Go to Services/SMB/CIFS and enable the Service
  • Then, click on the table Shares and add the shared services
  • Check the Dashboard to see if all services are working

Conclusion

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store