Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brainstorming NeoPixel with 8x8 Display #3958

Closed
fly74 opened this issue Feb 18, 2022 · 138 comments · Fixed by #3990
Closed

Brainstorming NeoPixel with 8x8 Display #3958

fly74 opened this issue Feb 18, 2022 · 138 comments · Fixed by #3990

Comments

@fly74
Copy link

fly74 commented Feb 18, 2022

As like in issue discussed, we could make this display more usable when we could put some pixel map to the flash to use it easily from rule to show maybe arrow, stop or other signs.

@TD-er
@tonhuisman

@fly74
Copy link
Author

fly74 commented Feb 18, 2022

Or maybe a charset implementation like in the 7 segment display.

@tonhuisman
Copy link
Contributor

tonhuisman commented Feb 18, 2022

Well, there is the challenge of custom matrix sizes. I know there are standard 'slabs' with 8x8 up to at least 16x32 and 8x64 NeoPixels, but you can of course configure to your own preference.

@fly74
Copy link
Author

fly74 commented Feb 18, 2022

But it's alway a factor of 8. so we could make it for 8x8 and scale for other sizes.

@fly74
Copy link
Author

fly74 commented Feb 18, 2022

Upload.from.GitHub.for.iOS.MOV

An example

@tonhuisman
Copy link
Contributor

tonhuisman commented Feb 19, 2022

I've been investigating this a bit, and found this rather extensive (commercial) über-guide to NeoPixels in several forms and shapes.
For the matrix form factors I am thinking about adding a separate plugin, that I'd expect to use the AdaFruit NeoMatrix library, as that seems the most appropriate (read: time-saving 😉).

I'll probably end up with a somewhat similar, though much less complex, configuration like I did for P104 - Display - MAX7219 dot matrix, except that there will be only 1 zone.
I'm not sure (didn't investigate that yet) if scrolling text is an available option, or I might need to add that.
Image support can be a bit challenging, as that's not yet implemented in ESPEasy, but would be a really welcome addition for other display types as well, as the AdaFruit GFX library has support for that, and that is used by the NeoMatrix and most graphic displays supported by ESPEasy.

@fly74
Copy link
Author

fly74 commented Feb 19, 2022

I don't know if we can use a binary part of the flash to store 3byte x 64 (and other sizes) as a picture. Maybe classical files in flash as the config for example.

Text scrolling would be nice too.

@tonhuisman
Copy link
Contributor

ESPEasy does use a file-system, and you can upload any type of file there, but there are limits on available space, though, depending on the configuration used (128 kB for 1M Flash devices up to ~8 MB on the MAX 16M8M ESP32 configuration), and they all use somewhere between 64 kB and 200 kB (depending on the number of tasks, and size of rules files) for storing the configuration, so that has to be subtracted. And then some free space is required to be able to overwrite an existing file during config save.

TL;DR: Image files should be read from the file-system, indeed.

@tonhuisman
Copy link
Contributor

I've reserved plugin ID P131 for this plugin, no ETA though 😃

@fly74
Copy link
Author

fly74 commented Feb 19, 2022

Size is very small 8x8x64 = 192 byte for an rgb picture is not so much.

@fly74
Copy link
Author

fly74 commented Feb 19, 2022

File format could be BMP ,it's uncompressed and maybe easy to assign to the pixels.

@TD-er
Copy link
Member

TD-er commented Feb 19, 2022

Size is very small 8x8x64 = 192 byte for an rgb picture is not so much.

For a single standalone "picture" it's not much, but I guess you may want a bit more flexibility here in what to show :)
Support for 2D pixel displays tend to get large very quickly. Adding color does speed this up even more.

@fly74
Copy link
Author

fly74 commented Feb 19, 2022

Is it possible to make plugin only available for ESP32 or 4M devices?

To load pictures via HTTP from a server would be nice too. So we don't have to save them on the device.

@tonhuisman
Copy link
Contributor

tonhuisman commented Feb 19, 2022

8x8x64 = 192 4096

Well, my calculator says that result is 4096, but the real calculation should be 8x8x(24/8) = 1536 192, as each (neo)pixel supports 24 bit colors, so it would be feasible to use 24 bit BMP files.
The Adafruit GFX library reduces that to 16 bits, btw, as the standard supported TFT displays only support up to 65535 colors (RGB565 coded), and converts the colors to RGB565 when reading such file.

Edit: Corrected for bit/byte mix-up 😅

@TD-er
Copy link
Member

TD-er commented Feb 19, 2022

Well, my calculator says that result is 4096, but the real calculation should be 8x8x24 = 1536, as each (neo)pixel supports 24 bit colors, so it would be feasible to use 24 bit BMP files.

Bits ;)
24 bit = 3 bytes => 8x8x3 = 192 bytes

@fly74
Copy link
Author

fly74 commented Feb 19, 2022

8x8x64 = 192 4096

Well, my calculator says that result is 4096, but the real calculation should be 8x8x24 = 1536, as each (neo)pixel supports 24 bit colors, so it would be feasible to use 24 bit BMP files.

The Adafruit GFX library reduces that to 16 bits, btw, as the standard supported TFT displays only support up to 65535 colors (RGB565 coded), and converts the colors to RGB565 when reading such file.

You mix up bytes and bit. 24 bit= 3 byte 😅

@tonhuisman
Copy link
Contributor

😅

@fly74
Copy link
Author

fly74 commented Feb 19, 2022

And I've seen some things with Neopixel flow pictures like waterfall wich move the lines up to top and things from left to right. For that we need picture 8 x X lines and need to move them with a value of speed.

@tonhuisman
Copy link
Contributor

I think that's called a 'sprite' 🛸

@fly74
Copy link
Author

fly74 commented Feb 20, 2022

Like this at 0:42

@TD-er
Copy link
Member

TD-er commented Feb 20, 2022

Hmm that looks like code that needs a lot of CPU time to run.
Scrolling in 1 direction (based on the orientation and order of the LEDs) is just like adding 1 row of pixels. But scrolling in the other direction needs to repaint the entire "display".
So not sure how doable this scrolling is on an ESP8266 while maintaining WiFi connection.
On an ESP32 it might be doable by running it on the 2nd core, or at least as a new RTOS task.

@fly74
Copy link
Author

fly74 commented Feb 20, 2022

It's a full repaint with every line no matter what direction. Maybe it should be a version only esp32neopixelultra16M.bin 😃. But scrolling is for sure not the main reason to make it.

@tonhuisman
Copy link
Contributor

The NEOPIXEL builds are already planned/prepared in PR #3899 so I'd expect to include this one in those builds as well.

@fly74
Copy link
Author

fly74 commented Feb 25, 2022

With multiple panels in a row it's a little tricky. 2 panels 2 solutions should be an option for the orientation because, with first pixel left/bottom it would be a flow of an picture with 8x16 pixel from an bmp. With the first pixel left top, the picture must be divided in the parts of the size from one panel - if you know what I mean. with 4 panel I have no idea.

Screenshot 2022-02-25 203746

@tonhuisman
Copy link
Contributor

tonhuisman commented Mar 6, 2022

Received my ordered NeoPixel matrixes (8x8 leds, 4 units), wired them up and started working on a plugin.
This is a first impression of how it could look:

NeoMatrix-first-impression

(I really should have ordered an extra matrix to be able to fit ESPEasy on it 🤣)
I'll implement some form of text scrolling, like done on the P073 7-segment display, and built into the library used on P104 MAX7219 Dotmatrix.

Still lots of work, and testing, to do, here is an impression of the Device configuration and its options:

Screenshot - 06_03_2022 , 20_43_56

(Many options and the entire AdafruitGFX_helper shared with P116)

@fly74
Copy link
Author

fly74 commented Mar 6, 2022

Hey looks nice. I think the interesting part would be to select an BMP from filesystem to display with an assignable brightness 🔆.

@tonhuisman
Copy link
Contributor

BMP from filesystem to display

I have some ideas on how to apply that, if you have a few of those available, preferably in a .zip file to avoid tampering by github, for me to experiment with what you want to use, that would be nice.

@fly74
Copy link
Author

fly74 commented Mar 8, 2022

@tonhuisman sure here are some by me. For the arrow it would be nice have a rotation angle to display 4 directions with one bmp. The RGB values must be reduces by the brightness value to not BBQ the panel with full yellow :)

BMPs.zip

arrow_y.bmp
black.bmp
stop.bmp

Maybe we could limit to 8 bit pictures, I think it could be enough.

and on for 8x16 pixel 2 panels:

arrow_8x16.zip

@tonhuisman
Copy link
Contributor

Status update:
(sorry for the poor photo quality)

IMG_20220310_213559
IMG_20220310_213734
IMG_20220310_213921

So, yes, we can display (small) bmp files on these displays, and by playing with rotation and x/y coordinates, you can place them anywhere 😉 No scaling, btw, so when configured for 16x16 pixels, you can use a 16 pixel high bmp, on an 8 bit pixel height display the image will be clipped.
Code is not yet ready for prime-time, but it will be part of the AdafruitGFX_helper module I've added for P116, which implies we'll be (optionally, build-size permitting) able to display (bmp) bitmaps on TFT displays too 🛩️
And that implies that you can use the drawing and text features (doc.) (<trigger> will be neomatrix or neo) of this module on this display type 😄

@fly74
Copy link
Author

fly74 commented Mar 10, 2022

Hey @tonhuisman sounds great. Is it ready for the 90 degree version of my hand painted paper above? I have to use it because of the modules I own. They can only with this orientation used. 👍

Will it be an extra bin for neopixel with only this plugin and maybe the switch plugin and only für ESP32? Can you provide a test build?😉

TFT display is interesting, is there a display module wich is usable?

@tonhuisman
Copy link
Contributor

Is it ready for the 90 degree version of my hand painted paper above?

It should be, that's why I have added all these configuration options 😉,
like Matrix start-pixel and Tile start-matrix:
Screenshot - 06_03_2022 , 20_46_20
Rows/Columns mode:
Screenshot - 06_03_2022 , 20_48_01
and flow-direction
Screenshot - 06_03_2022 , 20_50_59

Your 90 degree drawing should have width: 8, height:8, Bottom/Left, Columns, Progressive for Matrix, and width: 2, height: 1, Top/Left, Rows, Progressive for Tile configuration.
NB: All matrices must be of the same, rectangle, size, and the resulting set of tiles is always a rectangle.

All inspired by this library documentation (I'll probably add examples of that in the documentation)

I'll provide a test-build here after some more testing (and probably bug-fixing 😆)

@tonhuisman
Copy link
Contributor

When searching for small NeoPixel matrix displays, add either 3535 or 2020 (from the default/most encountered 5050), indicating the size of the individual pixels. That;'s how I found f.e. this and this 😃

@fly74
Copy link
Author

fly74 commented Aug 10, 2022

The second one is really nice.

@fly74
Copy link
Author

fly74 commented Sep 1, 2022

@tonhuisman Hi Ton in ESP_Easy_mega_20220809_neopixel_ESP32_4M316k is P131 not included?

Screenshot 2022-09-01 093618

@tonhuisman
Copy link
Contributor

It was merged just after that release...

Screenshot - 1-09-2022 , 09_40_56

@fly74
Copy link
Author

fly74 commented Sep 1, 2022

Then it will be in next build?

@TD-er
Copy link
Member

TD-er commented Sep 1, 2022

Then it will be in next build?

Yep, merged stuff will be in the next build, unless for whatever reason it will be reverted (not likely here, but just to be complete)

@fly74
Copy link
Author

fly74 commented Sep 7, 2022

@tonhuisman I tried a rule:

On System#Boot do
neomatrixcmd,settext,1,A
endon

with our:

Git Build:⋄ feature/p131-neopixel-matrix-display_2e3d0c3
Plugin Count:⋄ 52 [Normal]
Build Origin: Self built
Build Time:⋄ Jul 16 2022 11:30:47
Binary Filename:⋄ ESP_Easy_mega_20220716_neopixel_ESP32_4M316k

but it don't writes an A.

@fly74
Copy link
Author

fly74 commented Sep 7, 2022

neomatrixcmd,txt,A don't work too.

@TD-er
Copy link
Member

TD-er commented Sep 7, 2022

please try neocmd or nonecmd

Edit:
The command selected at Write Command trigger should be either neomatrix, or neo.
This + cmd is then your command.
However if the stored setting is incorrect, this may return None, with cmd appended is nonecmd.

So it is purely diagnostic right now to see where we might have to look for what's happening here.

@tonhuisman
Copy link
Contributor

The generic (AdaGFX) commands use neo or neomatrix (selectable on the device configuration page), the device specific commands have a cmd postfix. (Docs)

But I expect that the device isn't properly initialized yet when the on System#Boot do event is fired. It's usually better to wait for on WiFi#Connected do to put something on the display, or you could just enter it in the device configuration Lines area, so it will be displayed as soon as the device is initialized.
And maybe you have a build where the Splash option was still included, that should better be turned off, as during the splash-display/delay any commands are ignored.

@fly74
Copy link
Author

fly74 commented Sep 8, 2022

neomatrix,bmp,0,0,arrow_8x16.bmp for example works, but you know it was our first build for BMPs in this thread.

@tonhuisman
Copy link
Contributor

Can you update to the latest neopixel build from latest merge Actions build? Maybe in your version the settext subcommand wasn't included yet.

neomatrixcmd,txt,A don't work too.

That should be like neomatrix,txt,A as it is a generic AdaGFX command.

@fly74
Copy link
Author

fly74 commented Sep 8, 2022

Yeah, it was the old build, the action build works. I not expected the dark web mode, nice.

@fly74
Copy link
Author

fly74 commented Sep 8, 2022

Another thing the rule should write the hour and second to the matrix, but only the first fire of the time writes the value and keeps it. The log says the event fires with new values but not changing the matrix. :/

on WiFi#Connected do
timerSet,1,1
endon

On Rules#Timer=1 do
neomatrix,txt,%syshour_0%%syssec_0%
neomatrixcmd,txt,%syshour_0%%syssec_0%
timerSet,1,4
endon

Screenshot 2022-09-08 101204

IMG_3046

@TD-er
Copy link
Member

TD-er commented Sep 8, 2022

neomatrix,txt,%syshour_0%%syssec_0%
neomatrixcmd,txt,%syshour_0%%syssec_0%

One has neomatrix and the other neomatrixcmd

Edit:
Based on what I see in the source code, the subcommand should be settext, not txt

edit2:
Full command should be something like this:
neomatrixcmd,settext,<line>,<text>

@fly74
Copy link
Author

fly74 commented Sep 8, 2022

You're right, it works.

@tonhuisman
Copy link
Contributor

the subcommand should be settext, not txt

Well, both work, but the txt subcommand is handled by the AdaGFX helper, but doesn't position the cursor on the next line, or wrap text, as you might have expected/intended...
Usually the txp subcommand could be used to place the 'cursor' at a specific position, then use txt to place the text there, or combine that into one txtfull command

What you want to display can also be achieved by adding the %syshour_0% and %syssec_0% variables in the 2 lines you probably have configured there (looking at the display layout), and set the Interval to a reasonable interval (1?) to update automagically, without the need for any rules 😃

@fly74
Copy link
Author

fly74 commented Sep 8, 2022

The 2 lines waste some space.

Screenshot 2022-09-08 152258

IMG_3048

but the BMP feature from @tonhuisman ist great.

IMG_3047

@tonhuisman
Copy link
Contributor

tonhuisman commented Sep 8, 2022

Ah, that Lines display could use a little optimization, indeed. I'll put it on my TODO list Resolved in #4260

@fly74
Copy link
Author

fly74 commented Sep 8, 2022

Why I can't write 3 characters over 2 displays, is the font monospaced?

@tonhuisman
Copy link
Contributor

The default font is indeed mono-spaced, but some fonts have the digits mono-spaced while still being proportionally spaced. There are compile-time flags to include proportionally spaced fonts, have a look at src/src/Helpers/AdafruitGFX_helper.h, you'll see that most fonts are disabled by default to be able to compile it into the limited available .bin size.
For a Custom build you can probably include a couple of them, but I'm not sure if the smaller fonts (8pt) are available in proportionally spaced, I tried to avoid these... And the larger fonts are only feasible to use on TFT displays.

@fly74
Copy link
Author

fly74 commented Sep 8, 2022

Can you only one proportionally font add to the neopixel build?
Maybe a number font only to display eg. 12.3° on 2 matrixes.

I think it is helpfully for a matrix build.

@fly74
Copy link
Author

fly74 commented Nov 30, 2022

@tonhuisman Hi ton how can I get a leading space for values 0-9 in the rule:

neomatrix,txz,0,0,[BLK#Dummy]

in the plugin "Display - NeoPixel Matrix"
IMG_3280

@fly74
Copy link
Author

fly74 commented Nov 30, 2022

Got it

If [BLK#Dummy] <10
  If [BLK#Dummy] >-1
    neomatrix,txz,6,0,[BLK#Dummy]
  Endif
Else
  neomatrix,txz,0,0,[BLK#Dummy]
Endif

@tonhuisman
Copy link
Contributor

Adding quotes around the value, and using the value formatting features, could help too

@fly74
Copy link
Author

fly74 commented Dec 2, 2022

@tonhuisman It don't really work.

Floating point transformations:

Dx: Minimal ‘x’ digits zero filled in front of the decimal point, no decimal digits. Same as Dx.0
d: Same as D but spaces insted zeros

So (BLK#Dummy=0):

rule:
neomatrix,txz,0,0,[BLK#Dummy#d2]

show zero values as "0 °" instead of " 0°"

@tonhuisman
Copy link
Contributor

rule: neomatrix,txz,0,0,[BLK#Dummy#d2]

show zero values as "0 °" instead of " 0°"

You will need quotes around the value to fix that:
neomatrix,txz,0,0,"[BLK#Dummy#d2]"

else that leading space will be eaten by the command parser 😉

@fly74
Copy link
Author

fly74 commented Dec 2, 2022

Sorry, you wrote it before. It's fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants