Skip to content

Playing around with P4 Matrix 64x32 LED display with thermometer and internet access (for time, weather) controlled by ESP8266 platform. Created for my dad.

Notifications You must be signed in to change notification settings

AgainPsychoX/P4Matrix64x32Fun

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fun with P4 Matrix 64x32 LED display

Project uses P4 Matrix 64x32 LED display with thermometer and internet access (for time, weather) controlled by ESP8266 platform. Created for my dad.

Features
  • Time synchronization using minimalistic NTP.
  • Digital clock.
  • Thermometer reading and display.
  • Portal website hosted over Wi-Fi with status and configuration.
  • Most of UI uses Polish language.

Hardware

Software

Platform IO is used with Arduino framework for development.

Modules

  • Web server (serving static content, status & assets; handling config & uploaded assets re-encoding);
  • Network code (connect to configured network, incl. IP configuration; or host AP);
  • NTP code;
  • Display code

Configuration

Configuration is divided between EEPROM and file-system based. EEPROM contains configuration related to basic operation, including networking, timezones, weather location and more. File system contains pages configurations and assets (including bitmaps for backgrounds).

EEPROM

EEPROM settings can be set by accessing HTTP /config endpoint (GET/POST) and are saved only if save=true is provided along the overridden settings. Detailed EEPROM in-memory layout is defined in config.hpp file. Some settings of /config are missing in the layout due being saved by internal platform code, i.e. network SSID & password.

"_ TODO: add pretty-printed example /config"

Page configuration

Each page is configured via binary file at /pages/0/config where 0 is page ID/number. Each page can have analog clock and have up to 7 sprites that can be text, special character, time (formatted as text), image or animation. Exact format is defined in pages.hpp file. For example, time-based text sprite that uses strftime with custom extensions (%o or %O for Roman numeral month) can be used to create digital clock and/or display dates.

  • All file-system names are lower-case only.
  • Weather types for file names:
    • unknown (default/secondary fallback)
    • sunny
    • moony (sunny at night)
    • a-bit-cloudy
    • cloudy
    • rainy (high chance for rain)
    • rain (heavy rain)
    • rainbow (raining, but sunny)
    • snowy
    • snow
    • storm (very windy with heavy rain)
    • thunder (little rain)
    • thunderstorm
    • blizzard (snow storm)
    • windy
  • Months file names use english full names.
  • Season names: spring, summer, fall, winter.

Bitmaps encoding

Bitmaps can be used as assets for backgrounds/animations/sprites. Stored bitmaps should be encoded as simple BMP file with standard BITMAPINFOHEADER, with 16 bits per pixel (confirm to RGB565 used by the display PxMatrix library; as opposed to default 24 bits), with mask specified, with no compression. The encoding is assured by re-encoding when handling uploads by web server and when uploading file-system image by PlatformIO pre script.

Bitmaps can be "soft" symlinked, if the file contains path (content starting with / instead BM of regular BMP file header). Bitmaps can be used for animations, if so, often frame duration can be specified from inside file by reusing file header reserved fields (uint16_t right after file size).

Notes

To-do

  • Solve Sprites construction issues

  • Implement pages system as described in README above ;)

    • Load initial page
    • Function to change page
    • Schedule next page changes
    • Should all time be spent on updating the display? Or some smart subscribing mechanism for temperature/time updates?
    • Upload example config & BMP file https://docs.platformio.org/en/latest/platforms/espressif8266.html#using-filesystem
    • Debug & test simple image background
    • Soft symlinking paths in pages config
    • Read frame durations from Animation struct
  • Analog clock

    • Background buffer
    • Clearing as replacing stuff with buffer
    • Temporary code to setup temporary monochromatic buffer
    • Draw 3 lines from center as the time goes
    • Start the lines from center 2x2 pixels?
  • HTTP server

    • Get current state as image
      • Access display buffer
      • Define request handler with right response type
      • Encode the buffer into BMP for output
    • Filesystem? (instead embedding bytes into code)
  • Weather info

    • Find service/API
    • Show as text
    • Show with icon
    • Show with animated icon
    • Configurable location
  • Clock background

    • Configurable by image file (BMP)
    • Download from external (periodic; from configured address)
    • WEBP for animations
  • Themed mini-clocks (nice images/animations with small digital clock)

    • Day (sun & clouds)
    • Night (moon & stars)
    • Snow
    • Aquarium
  • Drawable canvas (via web)

    • Upload file
    • Color pick and drawing
    • Live preview
    • Fill by color
    • Undo/redo
  • Rewrite the display library? Low code quality, draw pixel optimizations possible?

  • Use better library for web server.

  • Snake game? ;)

  • Curious...

    • Does std::setlocale from <clocale> works?

About

Playing around with P4 Matrix 64x32 LED display with thermometer and internet access (for time, weather) controlled by ESP8266 platform. Created for my dad.

Topics

Resources

Stars

Watchers

Forks