In this tutorial, we will show you how to set up your Raspberry Pi as a Google Calendar display.
Google Calendar is a great service that provides you with an easily accessible online calendar. It synchronizes across devices easily, and if you use a service like Gmail, it integrates seamlessly.
Another huge advantage of using an online calendar such as Google’s is that you can synchronize events with multiple people. As a family, this can make planning out your weeks significantly easier, as you can see when people already have things going on.
It can also be a good way to manage small workplaces, as you can map out when certain things need to be achieved.
Of course, while there are a lot of advantages to Google Calendar, sometimes it’s nice to have something you can quickly look at while you walk about your home or office. For this guide, we will show you how to get your Raspberry Pi to power a display with the Google Calendar.
The Raspberry Pi is an excellent device for displaying your Google Calendar as it’s relatively cheap to keep it running 24/7. Additionally, thanks to its HDMI and onboard connections, it can easily connect with most screens.
The one drawback of displaying just the Google calendar is that it isn’t very versatile, but for many people, this is probably all you need. If you want to take things further, you can always set up something like Dakboard on your Raspberry Pi.
Equipment
Below is a list of equipment we used to set up the Google Calendar on our Raspberry Pi.
Recommended
- Raspberry Pi ( Amazon )
- Micro SD Card ( Amazon )
- Power Supply ( Amazon )
- Ethernet Cable ( Amazon ) or Wi-Fi ( Amazon )
- Touch Screen ( Amazon )
Optional
This tutorial was last tested on a Raspberry Pi 5 running the latest version of Raspberry Pi OS Bookworm 64-bit. It should also work fine on 32-bit operating systems.
Setting your Raspberry Pi up as a Google Calendar Kiosk
Over the following sections, we will walk you through setting up your Raspberry Pi as a display for your Google Calendar.
These steps should work on any Raspberry Pi you throw at it, but anything newer than the Pi 3 is recommended.
Preparing your Raspberry Pi
1. Before we can set up our Raspberry Pi as a display for our Google Calendar, we need to ensure the operating system is up to date.
You can update all existing packages on your system by using the following two commands.
sudo apt update
sudo apt upgrade -y
2. Once your system is up-to-date, we must install the Chromium web browser. Thanks to its built-in kiosk functionality, this web browser is perfect for running the Google Calendar on your Pi.
Thanks to this web browser being available directly from the Raspberry Pi OS package repository, all we must do to install it is run the command below.
sudo apt install chromium
Logging into your Google Account
3. If you plan on using a private Google calendar, you must log in to your Google Account before proceeding.
To log in, you simply need to go to the Google Calendar website and log in using your account. Google randomly logs you out after some time has passed, so you may have to repeat this step occasionally.
https://calendar.google.com/
Getting your Google Calendar Embed URL
4. Once you have logged in to your Google account, you can grab the embed code for it.
To get this code, go to the Calendar embed helper within your favorite web browser.,
https://calendar.google.com/calendar/u/0/embedhelper
5. Once on this page, you should see a code box at the top of the page titled “Embed code
“.
Copy this long string down somewhere as you will need it for the next section.
Creating a Simple HTML File for the Google Calendar on your Raspberry Pi
6. Our next step is to create a directory on our Pi where we will write a simple HTML file for our Google Calendar embed.
You can use the mkdir command as shown below to create a folder at “/opt/stacks/googlecalendar
“.
sudo mkdir -p /opt/stacks/googlecalendar
7. Now that we have made a directory to store our HTML file, let us begin to write it by using the following command.
You can use whatever text editor you feel most comfortable with, but personally, we find Nano to be really simple for beginners to use.
sudo nano /opt/stacks/googlecalendar/index.html
8. Within this HTML file, you will want to type in the following lines. These few lines of HTML are basically just a wrapper for the Google Calendar embed. We do some extra things with this, such as forcing the browser to refresh and making the calendar responsive.
While filling out this file, you must replace a few placeholders to get the Calendar loading on your Pi.
[[SECONDS]]
: Replace this with the number of seconds before the page will be automatically refreshed. We get the web browser to automatically refresh the page by setting a particular meta tag.
If you prefer not to automatically refresh the page, simply delete this line.[[EMBEDCODE]]
: You must replace this placeholder with the embed code that you got in the previous section.
However, you must change this line so that it uses the “responsive-iframe
” class. This CSS class is basically there to ensure that the iframe matches the outer container’s size.
At the start of the embed code you should see the text “<iframe
“. After that text, add the text “class="responsive-iframe"
“.
<!doctype html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta http-equiv="refresh" content="[[SECONDS]]">
<title>Google Calendar</title>
<style>
body {
margin: 0;
}
.container {
position: relative;
overflow: hidden;
width: 100vw;
height: 100vh;
}
.responsive-iframe {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div class="container">
[[EMBEDCODE]]
</div>
</body>
</html>
9. After writing out this bit of HTML, save and quit by pressing CTRL + X, Y, and then ENTER.
Testing out your Raspberry Pi Google Calendar Display
10. Before we get the Google Calendar to load on your Raspberry Pi’s screen when it boots, let us verify everything works correctly.
You can load up the HTML we wrote in the previous step from the terminal by running the following command.
/usr/bin/chromium-browser -noerrdialogs --disable-infobars --no-first-run --start-maximized --kiosk /opt/stacks/googlecalendar/index.html
11. If everything is working nicely, you should now have your calendar displayed on your screen.
You can quit out of this calendar by pressing CTRL + C within the terminal or ALT + F4 within the browser window.
Getting your Calendar to Load at Boot
12. Once you have verified everything is working, let us move on to writing a service that will ensure the Google Calendar remains on your Raspberry Pi’s screen.
You can use Nano to write this new service using the following command.
sudo nano /lib/systemd/system/googlecalendar.service
13. Within this file, type out the following lines to define our “Google Calendar” service.
While filling out this file, you must replace some placeholders.
<USER>
: Replace this placeholder with your username. This is the user under whom calendar will run on your Raspberry Pi. In our case, it will be “pi
” but you will have hopefully named your user something else.
[Unit]
Description=Chromium Kiosk
Wants=graphical.target
After=graphical.target
[Service]
Environment=DISPLAY=:0
Environment=XAUTHORITY=/home/<USER>/.Xauthority
Type=simple
ExecStart=/usr/bin/chromium-browser -noerrdialogs --disable-infobars --no-first-run --start-maximized --kiosk /opt/stacks/googlecalendar/index.html
Restart=on-abort
User=<USER>
Group=<USER>
[Install]
WantedBy=graphical.target
14. After writing the service file, save and quit out of Nano by pressing CTRL + X, Y, and then ENTER.
15. We can now get the Google Calendar to load up on our Raspberry Pi immediately by using the following command within the terminal.
With this command, we enable the “googlecalendar
” service we just wrote, and then use the “--now
” option to start it immediately.
sudo systemctl enable googlecalendar --now
Conclusion
Hopefully, by this point in the tutorial, you will have successfully managed to get your Google Calendar displayed on your Raspberry Pi.
While a very basic way of showing off your calendar, it is still quite useful and has a lot fewer things to go wrong than fully-fledged software.
Please feel free to comment below if you have run into any issues with this tutorial.
If you liked this project, we highly recommend exploring some of our many other Raspberry Pi projects.