Google Photo Clock
This instructables show how to use a ESP32 and a LCD to make a digital clock with randomize photo display in the background every minute. The photos are come from you shared Google Photo Album, simply input the share link ESP32 will do the job ;>
Hardware Preparation
REUSE PREVIOUS PROJECT HARDWARE
If you have done previous instructables, you can reuse the hardware for this project and can skip the hardware assembly:
- https://www.instructables.com/id/Floating-Display/
- https://www.instructables.com/id/COVID-19-WHO-Dash...
ESP8266/ESP32 Dev Board
Any ESP8266/ESP32 Dev Board should be ok.
LCD Display
Any Arduino_GFX supported LCD is ok, you may find currently supported display at GitHub readme: https://github.com/moononournation/Arduino_GFX
Breadboard
Any breadboard that can fit for the ESP Dev Board and LCD Display.
Jumper Wire
Some Jumper Wires, depends on the dev board and LCD pins layout. In most case 6-9 male to female jumper wires are enough.
Hardware Assembly
Push the ESP32 Dev Board on the breadboard and connect LCD with jumper wires.
Here are the sample connection summary:
ESP8266 -> LCD
Vcc -> Vcc GND -> GND GPIO 15 -> CS GPIO 4 -> DC (if available) RST -> RST GPIO 14 -> SCK GPIO 12 -> MISO (optional) GPIO 4 -> LED (if available) GPIO 13 -> MOSI / SDA
ESP32 -> LCD
Vcc -> Vcc GND -> GND GPIO 5 -> CS GPIO 16 -> DC (if available) GPIO 17 -> RST GPIO 18 -> SCK GPIO 19 -> MISO (optional) GPIO 22 -> LED (if available) GPIO 23 -> MOSI / SDA
Software Preparation
Arduino IDE
Download and install Arduino IDE if you are not yet do it:
https://www.arduino.cc/en/main/software
ESP8266 Support
Follow the Installation Instructions to add ESP8266 support if you are not yet do it:
https://github.com/esp8266/Arduino
Arduino ESP8266 filesystem uploader
Follow the Installation Instructions to add uploader plugin if you are not yet do it:
https://github.com/esp8266/arduino-esp8266fs-plugi...
ESP32 Support
Follow the Installation Instructions to add ESP32 support if you are not yet do it:
https://github.com/espressif/arduino-esp32
Arduino_GFX Library
Download latest Arduino_GFX libraries: (press "Clone or Download" -> "Download ZIP")
https://github.com/moononournation/Arduino_GFX
Import libraries in Arduino IDE. (Arduino IDE "Sketch" Menu -> "Include Library" -> "Add .ZIP Library" -> select downloaded ZIP file)
Setting & Upload
- Download the program at GitHub: (press "Clone or Download" -> "Download ZIP") https://github.com/moononournation/GooglePhotoClo...
- Open GooglePhotoClock.ino with Arduino IDE
- Fill your WiFi AP settings into SSID_NAME and SSID_PASSWORD
- Fill local timezone information to GMT_OFFSET_SEC, DAYLIGHT_OFFSET_SEC and TZ
- Prepare a shared album in Google Photo, create a share link and fill the GOOGLE_PHOTO_SHARE_LINK
- If you are not using ILI9341 LCD, comment out line 133 and uncomment the correct LCD class declaration
- Connect ESP Dev Board to computer
- Press Upload button to compile and upload the program to the ESP Dev Board
ESP8266 BearSSL CertStore
Google Photo require all connection in HTTPS. ESP8266 latest version using BearSSL implementation and it requires some preprocessing on CertStore data.
I have generated a CertStore data at 2020 Apr 18, you make regeneration it by running:
python make_spiffs.py
If you are using ESP8266, follow the steps to upload CertStore data:
- Open Arduino IDE
- Connect ESP8266 dev board to computer
- Select Tools menu
- Select ESP8266 Sketch Data Upload
- Wait upload finish
How Does It Works?
- Connect to predefined WiFi AP
- Get current time from NTP server
- Make the Google Photo shared link HTTPS request
- HTTPS response code 302 and included a redirect location in the response header
- Make the redirect location HTTPS request
- Read the photo list from the Javascript array in response HTML (the HTML is over 500 KB, it need some time to read and split the data)
- For every minitues, random select a photo in photo list
- For ESP8266 only, try to find cached photo file in SPIFFS first
- Make a photo link HTTPS request
- For ESP8266 only, cache the photo file to SPIFFS
- Display the photo
- Print current time on the photo
Enjoy!
It's time to add more favor photos to the shared Photo Album and place this Google Photo Clock on your desk.