letscontrolit / ESPEasy

Easy MultiSensor device based on ESP8266/ESP32
http://www.espeasy.com
Other
3.27k stars 2.21k forks source link

Is there a RGB 7 segment possible #4111

Closed fly74 closed 2 years ago

fly74 commented 2 years ago

Like in https://werner.rothschopf.net/202005_arduino_neopixel_display_en.htm described.

I want to make a 7 segment 8 digit display with the color depending on values.

tonhuisman commented 2 years ago

This is already possible to do (mind you, I didn't say easy 😄) using the basic NeoPixel plugin, by using the NeoPixelLine command. That would best be implemented by creating a rule or rules that can 'draw' each character on a virtual 'digit', where each digit starts at a certain (fixed) offset from the previous one. Of course it can be done in C++ code, but that would require settings for all those different display configurations and will probably add quite a bit of code, but I think that would fit in the Neopixel builds.

fly74 commented 2 years ago

What do we need in hardware, WS2812B 7segment modules? :)

tonhuisman commented 2 years ago

What do we need in hardware

Any set of NeoPixel leds supported by the plugin should be usable, it is up to your creativity to cobble them together, there are some pictures of these leds in the link you shared. AliExpress has lots of them 😺

I also found this similar library, though it is less flexible than what you linked. Another limitation of that library is that it only supports the regular ASCII character set/font, not something like Siekoo (or Siekoo with uppercase 'KNORUS') as available in the 7dgt plugin, for displaying some special characters, like the degree ° symbol.

fly74 commented 2 years ago

@tonhuisman Thanks, I will look for some hardware.

tonhuisman commented 2 years ago

Well, you have now closed this, but it is a nice idea for a plugin or extension to a plugin 😉 It's not that I have no ESPEasy projects to work on (😛), but all these display/output related things I'm interested in.

fly74 commented 2 years ago

@tonhuisman Let's play with it when I have a fitting hardware :)

fly74 commented 2 years ago

@tonhuisman I want to print this thing. And now the question, can we put random values to a defined count of neopixel WS2812B leds with a timer rule?

Link

tonhuisman commented 2 years ago

Check out #3899, that has been merged recently, it offers a lot of special effects for NeoPixel strips of configurable length

fly74 commented 2 years ago

I think I print it and we test it.

fly74 commented 2 years ago

Hi @tonhuisman I think we need an option max brightness like in the neopixelmatrix in NeoPixel (BusFX) [TESTING]. For example the "

nfx,rainbow[,speed[,fadetime]] | Run a rainbow effect color loop effect using speed and fadetime timings (in milliseconds). -- | --

"

uses full brightness wich takes a lot of power with 300 leds and I brick an ESP :) without separate power supply, but with low brightness it would be possible. The option should be strong without overuling.

tonhuisman commented 2 years ago

I'll see if that's doable, not entirely sure if it's technically possible though.

tonhuisman commented 2 years ago

@fly74 can you please create a new issue for this request, so it can be tracked separately from this, not directly related, issue? I am able to add this feature (already working on it 😃).

fly74 commented 2 years ago

@tonhuisman He it is https://github.com/letscontrolit/ESPEasy/issues/4121

fly74 commented 2 years ago

Check out #3899, that has been merged recently, it offers a lot of special effects for NeoPixel strips of configurable length

@tonhuisman Looks nice, but brightnesscontrol would be fine too :) look:

https://user-images.githubusercontent.com/38754941/177758966-f905b3c7-def4-42a4-9416-03f6c4aef70f.mp4

Dino.zip

tonhuisman commented 1 month ago

@fly74 I have added the requested NeoPixel (7-segment) display in a new PR, please join in testing 😄

fly74 commented 1 month ago

But we need to solder something to have a test. :)

tonhuisman commented 1 month ago

I have 2 strings of these: https://aliexpress.com/item/1005006350041884.html (15 cm wires)

fly74 commented 1 month ago

I'll use this density Link and I want to print 15 cm high digits. That means that a vertical segment is nearly 7 cm high what need 10 led per segment at 1,44led/cm density. Horizontal maybe 2 leds less. 4 vertical and 3 horiz. segments take 64 led for a digit + 2x4 led for dots makes 4 digit 268. As I wrote this, this is to much :). Enough would be 100led/m Link 60/m is too less.

Let's discuss any further.

The config should be easier. Maybe select count of digits, leds per horizontal and vertical segments for small digits e.g. Wiring should be fix, maybe first led upper/left around the clock, middle last...

tonhuisman commented 1 month ago

IMHO, the number of LEDs per segment you're using is quite high, knowing that these NeoPixels can be 'quite bright', to use an understatement 😄 If I want to increase the number of LEDs per segment, I will have to do a breaking change to the settings (no conversion, as we're still in beta, hadn't expect to use > 7 LEDs per segment) and will have to do some UI changes, as the current limit is 5 pixels per segment. Might be better to use 100 or 72 LEDs/m strips, or better yet, get the wired strings I linked to (probably also available from Amazon) where you can determine exactly the LED-distances, and have some more freedom in placing the LEDs. Or as TD-er suggested to me, to design a pcb digit board with the desired size (10x15 cm euro-card?) and number of LEDs, and have that produced by JCLPCB, including the smd-mounted LEDs. That would look awesomely professional 😎

As shown in the screenshots I made, the current maximum of LEDs that can be configured in a single display is 816, but I don't have a power supply available that can handle that... 🤔

Mounting a diffuser in front of each segment or digit will help even out the light per segment, and prevent users being blinded when they look at the display from a really close distance.

TD-er commented 1 month ago

Diffusor is quite easy, just 3D print a thin layer white filament in front of the LEDs and have the 'segment' surrounded with a white border. Then add a 3D printed black border around it to block the light from spreading.

image

Just like what I did here with a board with 29x5 neopixels But then combining some LEDs to a larger segment

fly74 commented 1 month ago

I know like it works, I've done some diffusors before 😎 Like: IMG_9161

fly74 commented 1 month ago

But I think about to make a (really) big clock. I can print sizes to 18cm. Maybe the digit or a segment. And stick it together. Just brainstorming.

fly74 commented 1 month ago

Something like that Link but not transparent and each digit separately to build a 8 digit e.g.

TD-er commented 1 month ago

Or maybe just the 'segments' in a square or "U" shape and place them in a way similar to "infinity grid". This way you can print a lot larger than the 180x180 mm of a Prusa mini :)

fly74 commented 1 month ago

Or maybe just the 'segments' in a square or "U" shape and place them in a way similar to "infinity grid". This way you can print a lot larger than the 180x180 mm of a Prusa mini :)

That's the plan.

tonhuisman commented 1 month ago

About increasing the number of pixels per segment: There is a technical limit of 64 pixels per digit. Each digit-pixel map is stored in an uint64_t type and that's the largest unsigned numerical that's available (bits are read from that by shifting a bit from right to left across that long word). To change that limit will require a major rewrite of the used library, and large parts of the plugin code. The pixels in the decimal point, and 6 pixels for overlapping corners when enabled, also count into that 64 pixels. The offsets before and after the digit(group) do not count into that 64 pixels.

If we can stay within that 64 pixels per digit limit, then it's doable.

fly74 commented 1 month ago

64 was to much as recognize by myself. So if assume one segment is max. 10cm high and led density 0,6led/cm make 6 led per segment x7=42 + dot leds should be enough for the biggest.

Here a sample of a 7-seg.svg Screenshot 2024-08-26 214843

I think I have to do the connectors and it would be fine, maybe @TD-er 's o and u shape.

fly74 commented 1 month ago

@tonhuisman can we use the same fonts as in 7-seg. plugin?

tonhuisman commented 1 month ago

Well, currently I have settings-space for up to 7 pixels per segment (3 bits...), it just needs some UI changes so the preview will be ok. I'll do that after I push a bunch of other changes and fixes I did today 😉

tonhuisman commented 1 month ago

@tonhuisman can we use the same fonts as in 7-seg. plugin?

It uses the exact same fonts, even most of the commands, incl. 7dbin and 7dtext are the same, except that we can have max. 16 digits, instead of 8 😉

TD-er commented 1 month ago

First few layers white PETG and then change filament to black PETG for the 'walls' Then make some frame to connect them and have the wires output through that frame. Those "connectors" can be only connecting the "triangle" parts as you can extend the "walls" to fill up the height difference of those "connectors".

I think it can be quite professional looking like that and since the segments can be printed diagonally you can have segments of roughly 1.4x 180 mm in length :) Thus nearly the size of a single "Philips Hue Play" element, only then like 50 euro less per segment :)

fly74 commented 1 month ago

@TD-er I think we start with a full segment 15cm, and I will connect the segments like this:

Screenshot 2024-08-26 221006 Screenshot 2024-08-26 221032

and from the back the inner shape in black with the taped leds inside.

TD-er commented 1 month ago

I would make the link a bit different as now it is harder to print with the flat side down. You can't print those large surfaces with only 2 layers thickness on top. Also if you start at the build plate you can even make the diffusion layer more 'compressed'

fly74 commented 1 month ago

No, it's easy to print, is only a little bridging, no problem for my printer. Front down 2 layer = 0.8mm thin.

TD-er commented 1 month ago

Ehh how big is your nozzle? With 0.4mm nozzle I typically use 0.2 mm layer thickness and the first layer is often compressed to effectively 0.1 mm.

fly74 commented 1 month ago

Sorry I mean 2x0.2 as my diffusor above.

fly74 commented 1 month ago

Tried a testprint of 2 segments with transition, looks good. Have to find some led to check the diffusor.

IMG_9162 IMG_9163

TD-er commented 1 month ago

I think you need to add a black surrounding to it or else it will shine through the side of the segments. You could make the "walls" a bit smaller so the white first layers are "overhanging" and then print the black "walls" only which you can then slide over it. Or even make the connections between the segments for the cabling in this black. As it is now, the bridge between the segments will also light up.

fly74 commented 1 month ago

No, the whole should be white from outside. There will be a black shape which fits in from behind, holding the led and seal off the side light.

TD-er commented 1 month ago

White on the inside will help the diffusion.

fly74 commented 1 month ago

Not bad without inner shape.

3 led for the big segment and 2 led for the smaller one is enough. Needed 6 layers 0.2 for 1.2mm diffusor.

IMG_9164 IMG_9166

fly74 commented 1 month ago

Screenshot 2024-08-27 223950

That's the inner shape, so enough from 3d printing.

fly74 commented 1 month ago

@tonhuisman What would the wiring be? I need a 4 digit with 2 dots as a clock t first :) "88:88" but the dots must be separately lit up to show temperatures as 18.7° e.g.

TD-er commented 1 month ago

Just from a traditional 7-segment design, I would expect each "digit" to have like 8 segments of which the dot is one. It does not really make sense to have the last digit with a dot, so maybe this one could be used as a ":" ? Then you have like 3 dots right above each other.

I think from a wiring perspective it would make the most sense if you have the digit "rotated" and the "DP" next to the F/A segment image And maybe "F" and "G" swapped?

TD-er commented 1 month ago

Not bad without inner shape.

3 led for the big segment and 2 led for the smaller one is enough. Needed 6 layers 0.2 for 1.2mm diffusor.

IMG_9164 IMG_9166

Maybe also check in full sunlight during the day?

TD-er commented 1 month ago

Oh and just a cautionary advice... White filament is abrasive to the nozzle and the PTFE tube inside the print head. (contains titanium oxide to make it white) So you may want to print some other color inbetween after some larger white prints, to clean the print head.

tonhuisman commented 1 month ago

I'll try to explain how the number plan works: (This will also go in the documentation 😉)

Let's start with a pixel layout for 2 digits, 3-pixel segments, 1 dot-pixel, 2 extra-pixels: P165_2-digit-3x3-dp1-ex2-layout

The default number plan starts arranging from segment a (Left-Top), b, c, dp, d, e, g, f, repeat for the second digit, and then add the extra pixels: P165_2-dgt-3x3-dp1-ex2-numplan

If you want to start from segment b (Right-Top), c, dp, d, e, g, f, a, repeat for the second digit, and then add the extra pixels: P165_2-dgt-3x3-dp1-ex2-righttop-numplan

To ease the wiring for the g segment, enabling the Split g-segment option, b (Right-Top), gr, c, dp, d, e, gl, f, a, repeat for the second digit, and then add the extra pixels: P165_2-dgt-3x3-dp1-ex2-righttop-spl-G-numplan (The algorithm favors the larger halve to the gr segment for no particular reason)

If you want the dot pixels to be near the end, that's also an option, b (Top-Right), c, gr, d, e, gl, f, a, dp, repeat for the second digit, and then add the extra pixels: P165_2-dgt-3x3-dp1-ex2-righttop-spl-G-dpLst-numplan

Segment naming: a = top b = right-upper c = right-lower d = bottom e = left-lower f = left-upper g = middle gr = middle, right-half gl = middle, left-half dp = dot position/decimal point extra pixels = used for colon/seconds indicator

When designing digit units, my suggestion is to choose a digit layout as the standard, including a dp, and create a separate 'colon' extra-pixels unit, similar to how it's shown in the first screenshot, so you can determine how many digits are to be used before adding a colon unit. When showing a date on an 8 digit display you might want to have multiple colons... you'll be defining multiple groups (up to 4) for that.

This does not yet include the Right to Left digits option, as I've discovered that there is some work to do in the group/digit ordering. I'm working on fixing that 😅

fly74 commented 1 month ago

But there is no option to have different led counts for horizontal and vertical segments. As wrote in the sample design "3 led for the big segment and 2 led for the smaller one is enough". 3 don't fit in the small segments and 2 not enough in the big segments. And the dot maybe should be the last led because it's transition to the next digit, otherwise I think of placing the ESP in the middle under the colon and so this would be a starting point :/

tonhuisman commented 1 month ago

But there is no option to have different led counts for horizontal and vertical segments.

So you haven't used the UI yet? 😸 You can independently configure the number of pixels for: horizontal (width, 1..7) and vertical (height, 1..7) segments, dot segment (1..7) , extra pixels (1..12) and offset-before (1..15)

Edit: So you can make silly layouts like this: image

or this: image

But I'm not saying you should... 🤣

fly74 commented 1 month ago

Was busy with 3d prints. Now I have a look into. :)