DAKboard: Create an interactive wall display from a PocketCHIP

Ever wanted a nice dashboard that will display the time, weather forecast and your upcoming calendar events? I did, and I was planning to write some application to achieve that, but then I saw DAKboard. It does have everything I wanted, it’s free and can run on PocketCHIP.

DAKboard sells a pre-built model, which is a monitor containing a Raspberry Pi. You can reuse an old monitor and build one yourself using the instructions from here.
In my case I already had a PocketCHIP laying around, it already has a small screen and was perfect for my use case.

Configure PocketCHIP for DAKboard

There are a couple of challenges having the dakboard displayed on the PocketCHIP. The screen will turn off after 10 minutes, the browser crashes and due to small screen size (480 x 272 pixels), the style of the page is broken.

As for the DAKboard configuration choose the following settings to fit on a small screen.

Inject CSS styles to DAKboard page

PocketCHIP comes with a browser already installed (surf) that supports JavaScript and has a very cool feature. For any page you visit, it can inject Javascript or CSS on the fly.

In your home directory create a file named .surf/style.css 

vi ~/.surf/style.css

and add:

.layout-portrait #weather {
    margin-bottom:0px!important;
    padding:20px;
}

.layout-portrait .weather-moon {
    display: none!important;
}
li {
    margin-top:5px!important;
}

.events .time-container {
    float:left;
    padding-right:10px;
    width:30px!important
}

.events .event-description {
    margin-left:40px!important;
}

#events-table {
    height:100%;
    width:70%!important;
}

.font-medium {
    font-size: 85% !important;
}

.medium {
    font-size: 1em !important;
    letter-spacing: 0px !important;
}

This CSS will nicely align everything on a small screen and will leave space for your calendar events as well.

Keep PocketCHIP’s screen on and launch the browser

A small bash script will take care to instruct the device to keep the screen on and launch the browser.

vi run_dakboard.sh

and add:

#!/bin/bash
TERM=linux /usr/bin/setterm -blank 0 > /dev/tty1
export XAUTHORITY=/home/chip/.Xauthority
export DISPLAY=:0
xset dpms force off
xset s off
xset -dpms
xset s noblank

surf https://dakboard.com/app?p= danger danger danger danger danger dangerxx

Now if you run this script from a terminal window it will keep the screen on and will run the browser in full-screen mode with the DAKboard displayed.

Add shortcut to the PocketCHIP home screen

PocketCHIP home screen
PocketCHIP home screen

By default, there is no way to launch the browser from the home screen, just via the terminal window. This is quite annoying but luckily we can control the applications on this screen via a config file.

sudo vi /usr/share/pocket-home/config.json

replace:

{
"name": "Make Music",
"icon": "appIcons/musicsequencer.png",
"shell": "sunvox"
}

with:

{
"name": "DAKboard",
"icon": "appIcons/window.png",
"shell": "/home/chip/run_dakboard.sh"
}

Monitor the surf process is still running

surf is a simple web browser based on WebKit2/GTK+. It is able to display websites and follow links. However for some reason sometimes the process crashes and I had to manually restart the browser until I automated the process.

vi monitor_dakboard.sh
#!/bin/bash
result=`ps aux | grep -i "surf" | grep -v "grep" | wc -l`
if [ ! $result -ge 1 ]
 then
 echo "script is not running"
 /home/chip/run_dakboard.sh
fi

Schedule screen off at night and on for daytime

I wanted to turn off the screen of the PocketCHIP at night time and turn back on at daytime. The kill_dakboard.sh will turn off the screen and kill any potential process of surf and the shell script.

vi kill_dakboard.sh
#!/bin/bash

DISPLAY=:0 xset dpms force off
killall -9 surf
killall -9 run_dakboard.sh

For scheduling tasks, I used the cron jobs.

crontab -e
# m h dom mon dow command
30 0 * * * /home/chip/kill_dakboard.sh
30 6 * * * /home/chip/run_dakboard.sh
*/1 7-24 * * * /home/chip/monitor_dakboard.sh

00:30 screen off, 6:30 screen on and monitor the process every minute between 7 and 23. Eventually, instead of running the surf process again I could just reboot the device since on restart the monitoring process will restart the browser.

I hope you enjoy your PocketCHIP with DAKboard. Drop me a line if you managed to set up one as described above.

If you are adventurous and want to set up a monitor with Raspberry Pi running DAKboard check the link below:

DAKboard: Create an interactive wall display from a monitor and Raspberry Pi

Csaba is passionate about Cyber Security, Pentesting and just making things work.

Leave a reply:

Your email address will not be published.

 

Site Footer

Sliding Sidebar