pitrix/README.md

108 lines
8.6 KiB
Markdown
Raw Permalink Normal View History

# pitrix
## What is pitrix?
pitrix is a software to run on an ESP8266 microncontroller connected
to a LED matrix. It will display the time and a few other nice effects
and stuff.
pitrix fetches the current time via NTP, is controllable via MQTT and
can be flashed over-the-air, so you don't need to disassemble your
nice-looking LED matrix everytime you want to update the software.
2019-09-04 04:13:00 +00:00
### Effects
| Name | Description | Image |
2019-09-25 04:07:17 +00:00
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| bell | An example for a blinking sprite. Can be used for home automation, for example. | <img width="128" height="128" src="https://git.schle.nz/fabian/pitrix/raw/branch/master/docs/effects/bell.gif" /> |
| big_clock | A big clock. Seconds are moving around the edge. | <img width="128" height="128" src="https://git.schle.nz/fabian/pitrix/raw/branch/master/docs/effects/big_clock.gif" /> |
| big_dynamic | Big squares appearing in sequential colors. | <img width="128" height="128" src="https://git.schle.nz/fabian/pitrix/raw/branch/master/docs/effects/big_dynamic.gif" /> |
| clock | The small clock at the bottom. Usually used by other effects to integrate a clock. | <img width="128" height="128" src="https://git.schle.nz/fabian/pitrix/raw/branch/master/docs/effects/clock.gif" /> |
| cycle | Meta effect: Cycles through some of the other effects. | - |
| confetti | Random pixels lighting up in sequential colors and fading out again. | <img width="128" height="128" src="https://git.schle.nz/fabian/pitrix/raw/branch/master/docs/effects/confetti.gif" /> |
| dvd | The bouncing-around dvd logo we all know and love. High chance of hitting cordners because of the low resolution of the LED panel. | <img width="128" height="128" src="https://git.schle.nz/fabian/pitrix/raw/branch/master/docs/effects/dvd.gif" /> |
| fire | Fireplace-like effect. Needs more tweaking. | <img width="128" height="128" src="https://git.schle.nz/fabian/pitrix/raw/branch/master/docs/effects/fire.gif" /> |
| firework | Firework-like effect. Needs more work. | <img width="128" height="128" src="https://git.schle.nz/fabian/pitrix/raw/branch/master/docs/effects/firework.gif" /> |
| gol | Conway's Game of Life. | <img width="128" height="128" src="https://git.schle.nz/fabian/pitrix/raw/branch/master/docs/effects/gol.gif" /> |
| matrix | That green effect from The Matrix. | <img width="128" height="128" src="https://git.schle.nz/fabian/pitrix/raw/branch/master/docs/effects/matrix.gif" /> |
| multi_dynamic | Space is divided in 2x2 squares which are changing their color random-sequentially. | <img width="128" height="128" src="https://git.schle.nz/fabian/pitrix/raw/branch/master/docs/effects/multi_dynamic.gif" /> |
| pixel_clock | A clock using single pixels to display the current time. | <img width="128" height="128" src="https://git.schle.nz/fabian/pitrix/raw/branch/master/docs/effects/pixel_clock.gif" /> |
| rainbow_matrix | Like matrix, but not just green but displaying a rainbow across the columns. | <img width="128" height="128" src="https://git.schle.nz/fabian/pitrix/raw/branch/master/docs/effects/rainbow_matrix.gif" /> |
| random_matrix | Like matrix, but with random colors and random directions. | <img width="128" height="128" src="https://git.schle.nz/fabian/pitrix/raw/branch/master/docs/effects/random_matrix.gif" /> |
| sinematrix3 | Colorful pastel images, slowly moving about. | <img width="128" height="128" src="https://git.schle.nz/fabian/pitrix/raw/branch/master/docs/effects/sinematrix3.gif" /> |
| single_dynamic | 2x2 squares random-sequentially changing their color one after another. | <img width="128" height="128" src="https://git.schle.nz/fabian/pitrix/raw/branch/master/docs/effects/single_dynamic.gif" /> |
| snake | Snake. Without self-collision detection or AI. | <img width="128" height="128" src="https://git.schle.nz/fabian/pitrix/raw/branch/master/docs/effects/snake.gif" /> |
| twirl | A colorful twirl. | <img width="128" height="128" src="https://git.schle.nz/fabian/pitrix/raw/branch/master/docs/effects/twirl.gif" /> |
2019-09-04 04:18:51 +00:00
2019-09-04 04:13:00 +00:00
## How to use
Checkout the code, rename `include/config.sample.h` to `include/config.h`
and edit it to match your preferences / environment.
2019-06-12 18:57:31 +00:00
Then compile and flash it, preferably using PlatformIO.
## Control it
2019-06-12 18:57:31 +00:00
Currently, control is possible via MQTT and / or HTTP REST API.
To use MQTT, you have to define `MQTT_ENABLE` and configure your MQTT sever's credentials. MQTT_TOPIC` is set in `include/config.h` and defaults to `pitrix`.
To use the HTTP REST API, you have to define HTTP_SERVER_ENABLE and set a port number
to listen on (80 is set by default).
Possible commands / topics are:
2019-06-12 18:57:31 +00:00
* `MQTT_TOPIC/mode` / `POST /mode` lets you select an effect to show. See `src/effects.cpp`
for a list. Default effect is `cycle`, which will cycle through some of
the available effects. Another effect is `off`, which will just display
black, effectively turning the display off. (pitrix stays running, so you
can turn it on again by simply selecting another mode.)
2019-06-12 18:57:31 +00:00
* `MQTT_TOPIC/brightness` / `POST /brightness` sets the brightness of the display. Valid values
are between 1 (darkest possible setting) and 255 (maximum brightness).
2019-06-12 18:57:31 +00:00
* `MQTT_TOPIC/reboot` / `POST /reboot` reboots pitrix. Send any value.
You can set retained values to have pitrix read them at startup, effectively
setting a default effect or brightness. (Do NOT set a retained value for
`MQTT_TOPIC/reboot` unless you want pitrix to reboot all the time.)
## Monitor it
The current status ("ONLINE" or "OFFLINE") of pitrix will be set at
`MQTT_TOPIC/status`.
If you enabled `MQTT_REPORT_METRICS`, metrics are sent via MQTT every 15
seconds:
* `MQTT_TOPIC/free_heap` contains the free heap memory in Bytes.
* `MQTT_TOPIC/uptime` contains the uptime of pitrix in seconds.
2019-06-12 18:49:37 +00:00
* `MQTT_TOPIC/fps` contains the currently reached frames per second.
2019-06-12 18:57:31 +00:00
If you enabled HTTP server, you can always make GET requests to `/free_heap`, `/uptime` or `/fps` to get those values.
If you enabled `DEBUG`, log messages will be sent to `MQTT_TOPIC/log`.
## Aknowledgements
### Libraries
| Library | Author | Link |
| ------- | ------ | ---- |
| PubSubClient | knolleary | https://pubsubclient.knolleary.net/
| FastLED (with small modifications) | Daniel Garcia & Mark Kriegsman | https://fastled.io
| NTPClient (with modifications) | | https://github.com/arduino-libraries/NTPClient
| ESP8266WebServer | | https://github.com/esp8266/Arduino/tree/master/libraries/ESP8266WebServer
| ESPAsyncTCP | me-no-dev | https://github.com/me-no-dev/ESPAsyncTCP
### Inspirations and stuff
* This whole project was inspired by
https://github.com/orithena/Arduino-LED-experiments/tree/master/Ribba16x16_v2_ESP32.
The sinematrix3 effect was also taken from there.
* The firework effect was heavily inspired (aka copied) from
https://gist.github.com/kriegsman/68929cbd1d6de4535b20
* The sines effect is based upon
https://github.com/atuline/FastLED-Demos/blob/master/sinelon/sinelon.ino