Skip to content

Fun little project - upload images to a server and display them either on a window, or a led matrix!

Notifications You must be signed in to change notification settings

FredericoCoelhoNunes/send-memes-pls

Repository files navigation

send-memes-pls

This project allows uploading images to a server and sending them to two possible destinations:

  • a simple window that runs in your desktop;
  • an RGB led matrix!

Components:

The application has two components:

  • The server:
    • app.py: a Flask server that receives images, or URLs pointing to images, and sends them to the client,
  • The client(s):
    • window.py: runs a window that listens to the image server using the WebSocket protocol, and displays new images when they are set.
    • pyled-client.py: runs a program that received the uploaded images and sends them to a led matrix (tested with a Raspberry Pi since it can both run the client and control the matrix).

Running locally

You can test the application locally with the simple window client by following these steps:

  • Install requirements.txt and client-requirements.txt
  • Run run_local.sh
  • Go to localhost:5000 on your browser and upload images; they should appear in the window
  • (Optional) If you want to open that port to external connections, to show the app to someone, you can use a tool like ngrok

Deploying the server to Heroku

You can also deploy the image server to Heroku (a cloud platform) using their free tier.

First, install Heroku: https://devcenter.heroku.com/articles/heroku-cli

Then, follow these steps to deploy the application to Heroku:

  • heroku login
  • heroku create
  • heroku git:remote -a
  • heroku config:set FLASK_SECRET_KEY= (it's only used to flash error messages to the user)
  • git push heroku master
  • set the following environment variables with export:
    • HOST: the URL of the Heroku server;
    • PORT: the port used by Heroku (443)
  • Run window.py locally
  • Open your browser, go to you app's URL, and send memes

Connecting to a led matrix

Sending images to a led matrix was tested with a Raspberry Pi.

First, read the information on this repository: https://github.com/hzeller/rpi-rgb-led-matrix

You must be able to run the sample programs provided by them.

Afterwards, install the Python bindings.

Finally, it should just be a matter of running pyled-client.py, and the images should show up in the matrix as they're uploaded!

This is quite a complex process and it varies a lot depending on which matrix or controller you're using. If things aren't working for you, but something shows up in the matrix, try changing the parameters on the pyled-client.py file.

About

Fun little project - upload images to a server and display them either on a window, or a led matrix!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published