Chapter 19:
GOOGLE CALENDAR
Integrating Google Calendar on a Raspberry Pi Display
This guide will help you display a Google Calendar on your Raspberry Pi using a full-screen Chromium browser. It includes steps to automatically refresh the page and hide the cursor when inactive.
Setting Up Google Calendar Display
Get Public Link from Google Calendar:
In Google Calendar settings, copy the public link of your calendar.
Create an HTML file that includes this link.
Install Necessary Packages:
Unclutter (to hide the cursor when not in use):
sudo apt-get install unclutter
xdotool (for simulating keyboard input):
sudo apt-get install xdotool
Create Scripts for Browser Launch and Auto-refresh:
Start Chromium in Kiosk Mode: Create a script named start_chromium.sh:
sudo nano start_chromium.sh
Add the following lines:
# Run browser after boot to desktop
/bin/sleep 3
sudo -u pi chromium-browser --kiosk --incognito http://your.favorite.website &
# End of script
Auto-refresh the Browser: Create another script named start_URLrefresh.sh:
sudo nano start_URLrefresh.sh
Add these lines:
# Start a loop to refresh the browser every 90 seconds
/bin/sleep 6
/usr/bin/lxterminal --command watch -n 90 xdotool key ctrl+F5 &
# End of script
Configure Autostart for Scripts:
Edit the LXDE-pi autostart file:
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
Add these lines:
@xset s off
@xset s noblank
@xset -dpms
@unclutter -idle 5 -root
@/home/pi/start_URLrefresh.sh
@/home/pi/start_chromium.sh
These commands disable screen blanking, power management, and ensure the scripts run at boot.
Note: Replace http://your.favorite.website in the start_chromium.sh script with the URL of your HTML file that contains the Google Calendar link. This setup ensures that your Raspberry Pi will display the calendar in full-screen mode and refresh it periodically.