A Raspberry Pi (Zero, 1 or 3) software which automatically pulls photos from Google Photos and displays them on the attached screen, just like a photoframe. No need to upload photos to 3rd party service or fiddle with local storage or SD card.
Unlike most other frames out there, this one will automatically refresh and grab content from your photo collection, making it super simple to have a nice photo frame. Also uses keywords so you can make sure the relevant photos are shown and not the reciepts for your expense report.
It also has more unique features like ambient color temperature adjustments which allows the images to meld better with the room where it's running.
- Simple web interface for configuration
- Google Photo search integration for more interesting images
- Blanking of screen (ie, off hours)
- Simple OAuth2.0 even though behind firewall (see further down)
- Shows error messages on screen
- Supports ambient room color temperature adjustments
- Uses ambient sensor to improve powersave
- Power control via GPIO (turn RPi on/off)
- Non-HDMI displays (SPI, DPI, etc)
- Raspberry Pi 1, 3 or Zero
- Display of some sort (HDMI or SPI/DPI displays)
- Google Photos account
- Internet
On the release page, you'll find prepared raspbian image(s) for RaspberryPi 1, 3 or Zero
To use these (and I really recommend that to doing the manual steps), here's how:
- Download the image from the release page
- Use your favorite tool to load image onto a SD card, I recommend https://etcher.io/ which works on Windows, OSX and Linux
- Open the new drive called
boot
and edit the file calledwifi-config.txt
Change the two fields to point out your wifi and the password needed for it - Save the file
- Place SDcard in your RPi3 which is connected to a monitor/TV
- Start the RPi
- Wait (takes up to a minute depending on card and the fact that it's expanding to use the entire SDcard ... slower still on non-RPi3)
- Follow instructions shown on the display
The default username/password for the web page is photoframe
and password
. This can be changed by editing the file called http-auth.json
on the boot
drive
Flash image to SDcard, edit wifi-config.txt
and boot the RPi3 with the SDcard and follow instructions. Username and password is above this paragraph.
You have to tell photoframe about OAuth2.0 secrets.
First step, login to your google API console (you have this by default if you have a google photos account). You'll find the console at https://console.developers.google.com/apis/dashboard
Next, you're going to create a new project, you can call it whatever you want, for this example, I'm using Photo Frame
.
Once created, we're going to click on Credentials
in the menu on the left. After it loads, click Create credentials
and select
OAuth client id
. This leads to a new screen where it will ask you to create a consent screen, so click the button to get that started.
Next, you're going to fill out the form. All but two fields are optional, so it's an easy thing to do.
Email Address: <Your email>
(usually prefilled with your google email)
Product name shown to users: Photo Frame
Hit save
and it will take you to a screen where you choose what kind of application you're making. It's important you choose Web Application
.
Doing so opens up a couple of extra fields. First, change the name from Web Client 1
to something better (for example Photo Frame
). You also need
to fill out Authorized redirect URIs
.
Please add https://photoframe.sensenet.nu
to this list and then press Create
This action will open a box with client ID and secret. Don't worry about it, just click OK
. On the new screen, you'll find your newly created client id.
On the line with the name of your app, there will be a download button at the right-most side.
Click it, and it downloads a JSON file. It is the contents of this file which needs to be copy-n-paste:ed into the box you see in photoframe.
Once you've copy-n-paste:ed this and submit it to photoframe, it will unlock the main settings and allow you to perform the google photos link, configure parameters, etc.
Yes, photoframe can actually adjust the temperature of the image to suit the light in the room. For this to work, you need to install a TCS34725, see https://www.adafruit.com/product/1334 . This should be hooked up to the I2C bus, using this:
3.3V -> Pin 1 (3.3V)
SDA -> Pin 3 (GPIO 0)
SCL -> Pin 5 (GPIO 1)
GND -> Pin 9 (GND)
You also need to tell your RPi3 to enable the I2C bus, start the raspi-config
and go to submenu 5 (interfaces) and select I2C and enable it.
Once all this is done, you have one more thing left to do before rebooting, you need to download the imagemagick script that will adjust the image,
please visit http://www.fmwconcepts.com/imagemagick/colortemp/index.php and download and store it as colortemp.sh
inside /root/photoframe_config
.
Don't forget to make it executable by chmod +x /root/photoframe_config/colortemp.sh
or it will still not work.
You're done! Reboot your RPi3 (So I2C gets enabled) and from now on, all images will get adjusted to match the ambient color temperature.
If photoframe is unable to use the sensor, it "usually" gives you helpful hints. Check the /var/log/syslog
file for frame.py
entries.
Just ground the LED pin (for example by connecting it to Pin 9 on your RPi3)
Yes, using the same sensor, you can set a threshold and duration, if the ambient light is below said threshold for the duration, it will trigger powersave on the display. If the ambient brightness is above the threshold for same duration, it will wake up the display.
However, if you're combining this with the scheduler, the scheduler takes priority and will keep the display in powersave during the scheduled hours, regardless of what the sensor says. The sensor is only used to extend the periods, it cannot power on the display during the off hours.
Photoframe listens to GPIO 26 to power off (and also power on). If you connect a switch between pin 37 (GPIO 26) and pin 39 (GND), you'll be able to do a graceful shutdown as well as power on.
Since Google doesn't approve of OAuth with dynamic redirect addresses, this project makes use of a lightweight service which allows registration of desired redirect (as long as it's a LAN address) and then when Google redirects, this service will make another redirect back to your raspberry. The registered addresses are only kept for 10min and is only stored in RAM, so nothing is kept.
User RPi3 Google Sensenet
|--[Start linking]--->| | |
| | | |
| |-------[Register LAN address]------------->|
| | | |
| |<---------[Unique ID to use]---------------|
| | | |
|<--[OAuth2.0 begin]--| | |
| | | |
|<-[OAuth2.0 exchange, state holds unique ID]-->| |
| | | |
|<---[Redirect to photoframe.sensenet.nu]-------| |
| | | |
|----[Load photoframe.sensenet.nu with unique ID]---------------->|
| | | |
|<---[New redirect to registered LAN address from earlier]--------|
| | | |
|--[Load local web]-->| | |
| | | |
It's somewhat simplified, but shows the extra step taken to register your LAN address so redirection works.
If you want to see how it works and/or run your own, you'll find the code for this service under extras
and requires
php with memcached. Ideally you use a SSL endpoint as well.
You could run the same service yourself (see extras/
). It requires a DNS name which doesn't change and HTTPS support. You'll also need to change the relevant parts of this guide and the frame.py
file so all references are correct. You might also be able to use server tokens instead, but that would require you to do more invasive changes. I don't have any support for this at this time.
Check out the photoframe
branch on https://github.com/mrworf/pi-gen ... It contains all the changes and patches needed to create the image. Starting with v1.1.1 it will match tags.
Place a file called ssh
on the boot drive and the ssh daemon will be enabled. Login is pi/raspberry (just like raspbian). Beware that if you start changing files inside /root/photoframe/
the automatic update will no longer function as expected.
By default, it logs very little and what it logs can be found under /var/log/syslog
, just look for frame entries
If you're having issues and you want more details, do the following as root:
service frame stop
/root/photoframe/frame.py --debug
This will cause photoframe to run in the foreground and provide tons of debug information
Tracks ideas and improvements planned. No specific timeframe is mentioned, but the order of things should be fairly true
- Use fileupload for oauth data instead of copy-n-paste
- Make photo sources modular (allow multiple Google Photos)
- More services: Instagram, Amazon, local network share...