maxbbraun / accent

Accent Smart Picture Frame
https://accent.ink
MIT License
199 stars 16 forks source link

Accent

Accent is a smart picture frame with a pop of color and no cables. Read more about it on Medium.

Accent

Client

The Accent client uses the PlatformIO Arduino toolchain for the Waveshare ESP32 board. See the client control flow for a high-level overview of the client code.

To push the client code to the board:

  1. Configure the IDE or CLI with platformio.ini.
  2. Pick one display type via build_flags in platformio.ini:
  3. If you want to point the client to a custom server, change kBaseUrl in Client.cpp.
  4. Compile and upload with pio run -t upload.

Follow the on-screen instructions to connect the client to a Wifi access point. The settings will be preserved across uploads and can be reset manually. See the setup documentation for details.

Server

The Accent server is built on Google App Engine using the Python 3 runtime in the standard environment. See the server control flow for a high-level overview of the client code.

The database backend uses Cloud Firestore. User-specific data is stored in the users collection with each user identified by a key generated by the client to identify it.

To populate the cross-user data after setting up:

  1. Obtain an API key for Google Maps and add it the api_keys collection under /api_keys/google_maps/api_key. Ensure that the Maps Static API, Directions API, Geocoding API, Maps Elevation API, and Time Zone API are all enabled and added to the key's restrictions. The Cloud Vision API and Google Calendar API also need to be enabled, but they do not need a key.
  2. Obtain an API key for OpenWeather and add it in the api_keys collection under /api_keys/open_weather/api_key.
  3. Obtain an OAuth client ID for the Google Calendar API with scope https://www.googleapis.com/auth/calendar.readonly in the OAuth consent screen. You will either need to make your OAuth app public or add your account to the list of test users. Configure the full /oauth URL of your App Engine app as an authorized redirect URI for the OAuth client. Write OAuth Client ID and Client Secret to the client_id and client_secret fields of the google_calendar document in the oauth_clients Firestore collection (/oauth_clients/google_calendar).

To test and deploy the server:

  1. Install the Google Cloud SDK, create a project, and authenticate with a service account.
  2. Run cd server && python3 -m venv venv && . venv/bin/activate.
  3. Run pip install -r requirements.txt (which also builds the C extension).
  4. Run the server locally with export GOOGLE_CLOUD_PROJECT=$(gcloud config get-value project) && python main.py.
  5. Test the local server with:
    • /hello/ for the settings UI to edit user-specific data.
    • /next?key= for the time in milliseconds until the next schedule entry.
    • /epd?key= for the currently scheduled client image used by the e-paper display.
    • /gif?key= for a GIF version of the currently scheduled image for testing.
    • /artwork?key= to bypass the schedule and get the artwork image directly.
    • /city?key= to bypass the schedule and get the city image directly.
    • /commute?key= to bypass the schedule and get the commute image directly.
    • /calendar?key= to bypass the schedule and get the calendar image directly.
    • /everyone?key= to bypass the schedule and get the everyone image directly.
    • /wittgenstein?key= to bypass the schedule and get the wittgenstein image directly.
  6. Deploy the server with gcloud app deploy.

Frame

Files describing the Accent frame hardware include: