Instantly share code, notes, and snippets.

Embed
What would you like to do?
How configure your raspberry pi with dashing to have a awesome dashboard

Raspberry pi dashboard

This is what we did to setup a few dashboards at platanus

You'll need

  • Raspberry Pi
  • Dashing Service
  • Wifi stick (optional)

Preparing the system

We'll install raspbian into our SD card. You can follow instructions from here http://www.raspberrypi.org/downloads

Setting up NTP

This will sync the time time with ubuntu ntp server

sudo apt-get install ntpdate
sudo ntpdate -u ntp.ubuntu.com

Update the OS

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

Install some useful software

sudo apt-get install git-core vim

Updating the RaspberryPi’s firmware

To update the firmware to the latest version, we’ll use Hexxeh’s rpi-update script.

sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update && sudo chmod +x /usr/bin/rpi-update
sudo rpi-update

Configure your monitor resolution

Find the TV supported modes, here I search for 1920x1080 60hz. That is hdmi_mode=16 on the hdmi_group=1 Select the group depending on the results of the supported modes

tvservice -d edid
edidparser edid

Add this to the /boot/config.txt file

hdmi_group=1    # CEA=1, DMT=2
hdmi_mode=16
disable_overscan=1

Also we want to disable overscan to prevent black lines on the edges of the screen. This may produce that your images gets cropped. The best solution is disable overscan in the tv. Check the display menu options (it may be called "just scan", "screen fit", "HD size", "full pixel", "unscaled", "dot by dot", "native" or "1:1)

Configure wifi (optional)

You'll need a wifi stick for this. Plug the stick and run the following command to check if the stick was detected.

ifconfig

This will list your network interfaces, and you should search for one named wlan0

Now you need to edit the configuration to setup dhcp and wich SSDI and password use to connect to the network

Edit /etc/network/interfaces and add the following code at the end

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
        wpa-ssid "ssid"
        wpa-psk "password"

iface default inet dhcp

Start the browser on boot

Install Chromium

First, you’ll want to install Chromium on your RaspberryPi. I tried several browsers alternatives, midori, iceweasel, kweb.

sudo apt-get install chromium-browser

Configure chromium so it start maximized to the size of our tv

Edit ~/.config/chromium/Default/Preferences and edit the following section

"window_placement": {
   "bottom": 1080,
   "left": 0,
   "maximized": true,
   "right": 1920,
   "top": 0,
   "work_area_bottom": 1080,
   "work_area_left": 0,
   "work_area_right": 1920,
   "work_area_top": 0
}

X server

Install x11 server utils to controll video parameters and unclutter to remove the mouse from over our dashboard

sudo apt-get install x11-xserver-utils unclutter

Create a script in /etc/pi/dashboard with the code that will run chromium in kiosk mode

#!/bin/sh
chromium-browser \
--kiosk \
--ignore-certificate-errors \
--disable-web-security \
--disable-restore-session-state \
--start-maximized \
--incognito \
http://dashboard.herokuapp.com/default

Add execution permition to the script

chmod +x dashboard

Add this code to your ~/.xinitrc

unclutter &

xset s off         # don't activate screensaver
xset -dpms         # disable DPMS (Energy Star) features.
xset s noblank     # don't blank the video device

exec /home/pi/dashboard

To start on boot we will create a init script in /etc/init.d/dashboard

sudo touch /etc/init.d/dashboard
sudo chmod 755 /etc/init.d/dashboard

Now add this code to the script

#! /bin/sh
# /etc/init.d/dashboard
case "$1" in
  start)
    echo "Starting dashboard"
    # run application you want to start
    /bin/su pi -c xinit
    ;;
  stop)
    echo "Stopping dashboard"
    # kill application you want to stop
    killall xinit
    ;;
  *)
    echo "Usage: /etc/init.d/dashboard {start|stop}"
    exit 1
    ;;
esac

exit 0

We need to register the script to start on boot as kiosk

sudo update-rc.d dashboard defaults

Turn off automatically

I wanted to be able to turn on and off the tv using the CEC standard via HDMI, but the tv we bought wasn't CEC compilant :(
One alternative was to turn of the HDMI signal with a cronjob and set the tv to auto turn off after a few minutes without signal.
But the power coming from the USB port stops flowing when the tv is off so I'd prefer to shut down the PI from a cronjob.

Add it to the root cronjob service running sudo crontab -e and adding

0       20      *       *       1,2,3,4,5 /sbin/shutdown -h now

References

@drandreaskrueger

This comment has been minimized.

drandreaskrueger commented Feb 11, 2016

Wow, that is a superb collection. Kudos!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment