After having successfully set up the Raspberry Pi it’s time to add some value.
The first project will be to have a Dashing board up and running.
To get dashing to the pi we first need to install some prerequisites and configure the pi to start up chromium in kiosk mode with a URL of our choice. Next is to install dashing and start a demo project.
Let’s start with packages. Luckily some of the required ones are already installed in the image we chose like: nodejs x11-xserver-utils ttf-mscorefonts-installer xwit sqlite3 libnss3
$ sudo apt-get install matchbox # leightweight window manager $ sudo ln -s /usr/lib/arm-linux-gnueabihf/nss/ /usr/lib/nss $
The last command prevents the error “Failed to load NSS libraries.” you may see when you start the x-server.
Now we have to tell
xinit to start what we want to see. I found this script somewhere on the web which mostly does what we need, and made some small changes.
$ vi ~/.xinitrc $
and put the following lines of code into it.
#!/bin/sh while true; do # Clean up previously running apps, gracefully at first then harshly killall -TERM chromium 2>/dev/null; killall -TERM matchbox-window-manager 2>/dev/null; sleep 2; killall -9 chromium 2>/dev/null; killall -9 matchbox-window-manager 2>/dev/null; # Clean out existing profile information rm -rf /home/pi/.cache; rm -rf /home/pi/.config; rm -rf /home/pi/.pki; # Generate the bare minimum to keep Chromium happy! mkdir -p /home/pi/.config/chromium/Default sqlite3 /home/pi/.config/chromium/Default/Web\ Data "CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR); INSERT INTO meta VALUES('version','46'); CREATE TABLE keywords (foo INTEGER);"; # Disable DPMS / Screen blanking xset -dpms xset s off # Reset the framebuffer's colour-depth fbset -depth $( cat /sys/module/*fb*/parameters/fbdepth ); # Hide the cursor (move it to the bottom-right, comment out if you want mouse interaction) xwit -root -warp $( cat /sys/module/*fb*/parameters/fbwidth ) $( cat /sys/module/*fb*/parameters/fbheight ) # Start the window manager (remove "-use_cursor no" if you actually want mouse interaction) matchbox-window-manager -use_titlebar no -use_cursor no & # Start the browser (See http://peter.sh/experiments/chromium-command-line-switches/) chromium --app=http://localhost:3030/ done;
If you now start the xserver with
$ startx $
you should see a running chromium in kiosk mode pointing to a web page that doesn’t exist yet, so let’s create it.
First let’s deactivate docs for gems. This just takes time and we don’t need it on the pi.
$ cat > ~/.gemrc gem: --no-ri --no-rdoc install: --no-rdoc --no-ri update: --no-rdoc --no-ri ^D $ cp ~/.gemrc /home/pi $ chown pi:pi /home/pi/.gemrc $
Then we install dashing and create a dashboard - be free to choose a wiser name.
$ cd $ gem install bundler dashing $ dashing new whatever $ cd whatever $ bundle $ dashing start $
To see the results we would have to reload the browser. If you have a mouse attached, right click and hit Reload. If you have a keyboard attached, hit ctrlr. You should see the demo dashboard of dashing.
Next time we will fill the dashboard with meaningful data.