# FBDASH - lightweight dashboard for the RaspberryPi without X (using framebuffer only) - [Installation and Setup](#installation-and-setup) - [Get the sources](#get-the-sources) - [Connect the display to the RaspberryPi](#connect-the-display-to-the-raspberrypi) - [Full connection diagram (9 wires needed)](#full-connection-diagram-9-wires-needed) - [Minimal connection diagram (7 wires needed)](#minimal-connection-diagram-7-wires-needed) - [Some explanation about the wiring](#some-explanation-about-the-wiring) - [Configure the display](#configure-the-display) - [Enable SPI interface on the RaspberryPi](#enable-spi-interface-on-the-raspberrypi) - [Activate modules to be loaded on boot](#activate-modules-to-be-loaded-on-boot) - [Setup fbdash binary](#setup-fbdash-binary) - [Build the sources](#build-the-sources) - [Install in /usr/bin](#install-in-usr-bin) - [Test it](#test-it) - [Use systemd for regular updates](#use-systemd-for-regular-updates) - [Install unit files](#install-unit-files) - [Check timers](#check-timers) - [Controlling the backlight](#controlling-the-backlight) # Installation and setup ## Get the sources In order to setup the dashboard start with cloning this repo ;) git clone https://git.klelifo.de/flo/fb-dash cd fb-dash ## Connect the display to the RaspberryPi Here is some info on how to wire the display to the RaspberryPi. ### Full connection diagram (9 wires needed) Wire the display connector according to the connector scheme below.\ **NOTE:** The 56 Ohm resistor is suggested for safety reasons - but it also seems to work fine wihtout it ILI9341 RaspberryPi =============================================================== SDO/MISO ---------------------- MISO | GPIO 9 | PIN 21 LED ----------| 56 Ohm |------- PWM | GPIO 18 | PIN 12 SCK --------------------------- SCLK | GPIO 11 | PIN 23 SDI/MOSI ---------------------- MOSI | GPIO 10 | PIN 19 DC/RS ------------------------- | GPIO 24 | PIN 18 RESET ------------------------- | GPIO 25 | PIN 22 CS ---------------------------- CE0 | GPIO 8 | PIN 24 GND --------------------------- GND | | PIN 9,14,20,25 VCC --------------------------- 3,3V | | PIN 1,17 ### Minimal connection diagram (7 wires needed) Wire the display connector according to the connector scheme below.\ **NOTE:** The 56 Ohm resistor is suggested for safety reasons - but it also seems to work fine wihtout it ILI9341 RaspberryPi =============================================================== SDO/MISO ---------------------- MISO | GPIO 9 | PIN 21 LED ----------| 56 Ohm |------- VCC (soldered directly onto the display connector) SCK --------------------------- SCLK | GPIO 11 | PIN 23 SDI/MOSI ---------------------- MOSI | GPIO 10 | PIN 19 DC/RS ------------------------- | GPIO 24 | PIN 18 RESET ------------------------- VCC (soldered directly onto the display connector) CS ---------------------------- CE0 | GPIO 8 | PIN 24 GND --------------------------- GND | | PIN 9,14,20,25 VCC --------------------------- 3,3V | | PIN 1,17 ### Some explanation about the wiring |---------> Power GND --| VCC --| |---------> SPI Interface (data transfer) MISO -| MOSI -| SCK --| CS ---| |---------> Data/Command switch DC/RS | (indicates whether the transfered data is a command or display data) |---------> Power to the backgroud lighting LED --| |---------> Resets the display controller when pulled low RESET | ## Configure the display **TL;DR** just run ```make rpi-config``` Some work is needed before we can actually use the ILI9341 display with the RaspberryPi.\ Essentially we need to * Enable the SPI interface * Load the fbtft_device kernel module with the correct parameters to get a working /dev/fb1 framebuffer device. ### Enable SPI interface on the RaspberryPi echo "dtparam=spi=on" | sudo tee -a /boot/config ### Activate modules to be loaded on boot echo "spi_bcm2835" | sudo tee -a /etc/modules echo "fbtft_device" | sudo tee -a /etc/modules echo "options fbtft_device name=rpi-display gpios=reset:25,dc:24,led:18" | sudo tee -a /etc/modprobe.d/fbtft_device.conf ## Setup fbdash binary **TL;DR** just run ```sudo apt install -y libmariadb2 && make install``` After the display is setup we can build and install the fbdash binary. ### Build the sources sudo apt install libmariadb2 make ### Install in /usr/bin sudo make install ### Test it fbdash ## Use systemd for regular updates While we could also use cron for regular execution of the fbdash binary I opted to use systemd this time.\ The future is now ... ;) ### Install unit files **TL;DR** just run ```make systemd-config``` The following files use systemd to setup a regular update of the dashboard screen (60s by default).\ If you like to change the default, just edit the ```fbdash.timer``` file before reloading systemctl sudo cp setup/fbdash.service setup/fbdash.timer /etc/systemd/system sudo systemctl daemon-reload sudo systemctl enable fbdash.timer sudo systemctl start fbdash.timer ### Check timers systemctl list-timers NEXT LEFT LAST PASSED UNIT ACTIVATES Wed 2022-05-04 14:16:10 CEST 28s left Wed 2022-05-04 14:15:10 CEST 31s ago fbdash.timer fbdash.service ... ## Controlling the backlight It's a bit counterintuitive but according to [Notro's wiki](https://github.com/notro/fbtft/wiki/Backlight) you can control the backlight like this (tested, works!): Write a "1" to turn it **off** echo 1 | sudo tee /sys/class/backlight/fb_ili9341/bl_power and a "0" to turn it **on** echo 0 | sudo tee /sys/class/backlight/fb_ili9341/bl_power