Introduction: 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 ;>

Step 1: 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:

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.

Step 2: 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

Step 3: 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)

Step 4: Setting & Upload

  1. Download the program at GitHub: (press "Clone or Download" -> "Download ZIP") https://github.com/moononournation/GooglePhotoClo...
  2. Open GooglePhotoClock.ino with Arduino IDE
  3. Fill your WiFi AP settings into SSID_NAME and SSID_PASSWORD
  4. Fill local timezone information to GMT_OFFSET_SEC, DAYLIGHT_OFFSET_SEC and TZ
  5. Prepare a shared album in Google Photo, create a share link and fill the GOOGLE_PHOTO_SHARE_LINK
  6. If you are not using ILI9341 LCD, comment out line 133 and uncomment the correct LCD class declaration
  7. Connect ESP Dev Board to computer
  8. Press Upload button to compile and upload the program to the ESP Dev Board

Step 5: 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:

  1. Open Arduino IDE
  2. Connect ESP8266 dev board to computer
  3. Select Tools menu
  4. Select ESP8266 Sketch Data Upload
  5. Wait upload finish

Step 6: How Does It Works?

  1. Connect to predefined WiFi AP
  2. Get current time from NTP server
  3. Make the Google Photo shared link HTTPS request
  4. HTTPS response code 302 and included a redirect location in the response header
  5. Make the redirect location HTTPS request
  6. 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)
  7. For every minitues, random select a photo in photo list
  8. For ESP8266 only, try to find cached photo file in SPIFFS first
  9. Make a photo link HTTPS request
  10. For ESP8266 only, cache the photo file to SPIFFS
  11. Display the photo
  12. Print current time on the photo

Step 7: Enjoy!

It's time to add more favor photos to the shared Photo Album and place this Google Photo Clock on your desk.

Clocks Contest

Participated in the
Clocks Contest