Giter VIP home page Giter VIP logo

rpi-pico-rplace-e-paper-frame's Introduction

Raspberry Pi Pico r/Place e-paper frame

A digital frame powered by the Raspberry Pi Pico, displays a piece of Reddit's r/place canvas at a random position.

demo

Hardware

  • Raspberry Pi Pico W
  • Waveshare 3.7inch 480ร—280 E-Paper Display, 4 Grayscale

How to Cook

Canvas preparation

The canvas needs to be preprocessed before feeding it to Pico. Ensure you have ImageMagick installed. Download the canvas from https://www.reddit.com/r/place/comments/15bjm5o/rplace_2023_data/ and execute the following command from the command line:

magick convert final_2023_place.png -dither FloydSteinberg -define dither:diffusion-amount=85% -remap eink___epaper_eink-4color.png -type truecolor BMP3:!!final_2023_place_encoded.bmp

Execute the following script to convert the resulting BMP into the color sequence to be fed to Pico:

python canvas_transformer.py input_bmp_file output_file height width

Server Side

RP Pico doesn't have enough memory to store the entire canvas. This is why the solution is divided into two parts: the server and the client sides. The server part can be hosted on a Raspberry Pi Zero W using Flask framework:

@app.route('/picture', methods=['GET'])
def picture():
    f = open('/home/pi/final_2023_place_color_sequence.txt', 'r')
    real_w = 6000 #image width
    x = request.args.get('x', default = 0, type = int)
    y = request.args.get('y', default = 0, type = int)
    w = request.args.get('w', default = 1, type = int)
    h = request.args.get('h', default = 1, type = int)
    page = request.args.get('page', default = 0, type = int)
    totl = request.args.get('totl', default = 1, type = int)
    res = ''

    f.read(x * real_w + y)
    for i in range (0, h):
        res += f.read(w)
        f.read(real_w - w)
    f.close()

    p_size = int(len(res) / totl)
    last_size = p_size + len(res) - p_size * totl

    if page >= totl - 1:
        return res[-last_size:]

    return res[page * p_size:page * p_size + p_size]

Client Side

Amend main.py with your WiFi SSID and password, update the server-side URL, and save the file on the Pico.

Demo

demo

demo

demo

rpi-pico-rplace-e-paper-frame's People

Contributors

flodek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.