Setting up a Raspberry Pi to show DataDog stats on TV

Some fire for the Christmas

Even though the title of this post is about Datadog stats but the solution mentioned here works for any web page. In fact we put a full screen YouTube of a chimney creating that Christmassy vibe around this time.

  • The TV should always show the page
  • The URL for the page is put in plain text in a file called url.txt in the /boot folder of the Raspberry Pi microSD card (this partition is visible even on windows so it is easy to update). The reason for putting it on the boot partition is because this is the part of the microSD card that is editable when inserted to a Mac or Windows computer.
  • Raspberry Pi should boot directly to Chrome
  • Chrome should open in full screen
  • Chrome should not require any user input, choices or user profiles

Buy the parts

Download Raspbian

Write the disk

  • /media/boot/ for the boot partition where the url.txt and autostart.sh are supposed to be created
  • /media/rootfs/ for the wifi settings and autostart applications

Setup the Wifi

Run chrome on startup and prevent sleep

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@point-rpi
@xset s noblank
@xset s off
@xset -dpms
@sh /boot/autostart.sh

Set the autostart script

chromium-browser --incognito   --start-fullscreen --start-maximized --disable-sync-preferences --disk-cache-dir=/tmp/cache --no-first-run `cat /boot/url.txt`
chromium-browser --incognito   --start-fullscreen --start-maximized --disable-sync-preferences --disk-cache-dir=/tmp/cache --no-first-run --app=`head -n 1 /boot/url.txt`
  • Start chrome in incognito mode (so it will not nag about creating a user profile and goes directly to the site)
  • Starts the browser in full screen mode to maximize the usable area for showing the page
  • Uses a RAM disk for caching which improves the performance
  • Read the url from a plain text file called url.txt in the boot partition

Put the URL

https://p.datadoghq.com/sb/XXXXXXXXXXXXXXXXXX?tv_mode=true&theme=dark

Tip for YouTube videos

https://www.youtube.com/watch?v=kRXrqURyRy0
https://www.youtube.com/embed/kRXrqURyRy0?controls=0&autoplay=true

Auto update

sudo apt-get install unattended-upgrades
// Split the upgrade into the smallest possible chunks so that
// they can be interrupted with SIGTERM. This makes the upgrade
// a bit slower but it has the benefit that shutdown while a upgrade
// is running is possible (with a small delay)
Unattended-Upgrade::MinimalSteps "true";
// Do automatic removal of new unused dependencies after the upgrade
// (equivalent to apt-get autoremove)
Unattended-Upgrade::Remove-Unused-Dependencies "true";
// Automatically reboot *WITHOUT CONFIRMATION*
// if the file /var/run/reboot-required is found after the upgrade
Unattended-Upgrade::Automatic-Reboot "true";
// If automatic reboot is enabled and needed, reboot at the specific
// time instead of immediately
// Default: "now"
Unattended-Upgrade::Automatic-Reboot-Time "04:00";
// Enables auto clean packages for X days. This configuration displays 7 days
APT::Periodic::AutocleanInterval "7";
// Enables upgrading the Raspbian distro every 30 days
APT::Periodic::Unattended-Upgrade "30";

The environment

Many TVs and monitors have an economy mode which they adjust the backlight to the light in the environment. When people leave the office and all lights are off, they consume less energy. Also a good number of them have a setting for scheduling them to automatically turn off in the evening and turn on in the morning.

Bonus

sudo dd if=/dev/mmcblk0 of=~/Downloads/pi-image.img bs=1M status=progress

References

--

--

--

Sr. Staff Engineer @volvocars, Knowledge Worker, MSc Systems Engineering, Tech Lead, Web Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Platforms and Microservices — Is There a Middle Ground for Engineers and Tech Strategists?

13 things you should know if you are a software developer or entrepreneur in 2020! 🔥

5 Amazing Apps Built By Nigerian Women

Command line筆記

An intro to HTTP status codes and HTTP methods

Apache Airflow on Docker

Building a Games Guide

Why We Use Django At Vafion

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
Alex Ewerlöf

Alex Ewerlöf

Sr. Staff Engineer @volvocars, Knowledge Worker, MSc Systems Engineering, Tech Lead, Web Developer

More from Medium

Serverless vs Containers

Inform 7

Meteor — A metadata collection framework

Publishing Python Packages to AWS CodeArtifact Using Github Actions