use a led matrix 5x7 without driver chip? #1011
Replies: 22 comments
-
Posted at 2018-12-17 by @allObjects Eric, surre, Espruino PICO has enough GPIO pins to do it. I Though strongly recommend that you use current limiting resistors (on column pins) because there is a limit in max current the chip can take... Take a look at Driving LED matrix with shift registers such as 74HC595. The shift register was intentionally used to use the least GPIO pins as possible. Instead of calculating and shifting out the bits, you calculate the bits in an integer and output it to an array of GPI pins in CharliePlexed fashion (see digitalWrite()). For example:
I like the pics you added while I was working on this post... Give me some more time to get something going for you... When you want to use the graphics buffer and Graphics object in Espruino, you declare a black and white (2 colors 7x5 matrix) and then read it out and process it row for row. With that you can use the built in or available fonts. If you go the direct mode as above, you have to get the font bit mapping yourself. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-17 by Mrbbp Hello Markus, I do not have a pinned pico, i've used a pico board and pin header on breadboard without soldering anything (crap work!!!) In an earlier version i was ligthting On dot by dot on the first line and it was working.
but the value from the graphicBuffer are not...
my "brilliant" test :/
é.Attachments: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-17 by @allObjects Eric, where did you dig up these retro red bubble display? ...not that I will ask your for your's, but just like to know, because I resorted to NS board with 12 digit display! Unfortunately, they are not red, were affordable, and working nicely: Retro Bubble Displays driven with 74HC595. Driving those directly - not using shift register - would be quite a number of GPIO pins to burn: 19 or 20 - exactly. PICO as 21... so it still would work. With this large 7 segment display - 12 digits - you might even get in a
8 resistors for the 7 segments and decimal point, and 12 digits... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-17 by Mrbbp ohhh i've tried to read the post on shift register and each time i try to read your code, i fall on my butt and have a headache (i am so far to be able to produce that, i am a 5years old kid in algorithmic...) respect é. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-17 by Mrbbp i've found them at sparkfun so time ago... they are from 1978's HP. but they are out of catalog |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-17 by Mrbbp if you search with "HP bubble display", there is again some pieces on ebay... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-17 by @allObjects Thanks for the picture... you got it in while I was compiling the post #4. I do not know how the dots are arranged in the buffer bytes... but it can be found out... You also may face the 'reverse' issue... but that's easy: you just put out a filled rectangle in 'white' and write in 'black'. Btw, I noticed two resistors going to same B7 PICO GPIO pin instead of B7 and A8. But I guess this will not solve all you problems... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-18 by @allObjects Graphics w/ Buffer may actually work nicely into your hand: vertical bits 8 in one byte... so you play column by column... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-18 by Mrbbp oh it's just a parallaxe mistake, the resistor is plug in H9 for A8... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-18 by Mrbbp I think it should work.
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-18 by @allObjects I'm not sure if column has to be open drain, because it is connecting to the anodes. Matter of fact you do not need to set any pin modes, because Espruino does automatic modes, and all are outputs. To figure out arrangements of bits in buffer, I create a 5(cols) x 7(rows) x 1(color) Graphics object and put a buffer over it which takes 8 bytes with last 5 bits unused. The drawings are rectangles of height 1, width 1, 2, 3 and 5 in rows 0 and 1. For each drawings the buffer is printed in the log.
Log output - with some formatting - is as expected:
We see that the 1st row - row 0 - uses the first five (5) LSB bits in first byte - byte 0. We also see that 2nd row - row 1 - straddles the first and second byte - byte 0 and 1 - with first three (3) bits in byte 0 and the remaining two (2) bits in byte 1. With this bit arrangement in the buffer it is difficult to write an algorithm that puts out the bits nicely... yes, we can do some 'streaming' to make sure we always - 7 times - have 5 bits per row to put out - with a lot of pushing and shoving around bits (shift, mask, shift, etc...). The Graphics class though allows us a vertical vs the horizontal bit arrangement... and we do not even really loose space: still 5 bytes, one for each column. Since we care about only one text row, it becomes very simple... The Graphics declaration is 8 bits per column (multiple of 8 in height):
And the respective console output is:
The buffer bytes are just perfect to be pushed out column by column... A separate algorithm just pushes the buffer out with a refresh rate defined by an interval. After all columns are put out, column selector has to be disabled to have not the last one be lit for the whole time between the refresh interval. I have a very simple 5x7 (actually only 5x3) RED LED matrix with row anodes and column cathodes from end 70's/early 80's that I used to demo and explain CharliePlexing... and I will use it again here - in the next post. LEDs were still a cost factor - at least for a student budget - dim lit, and some colors were not even on the market yet... ;-) see History of LED. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-18 by @gfwilliams As @allObjects points out above it looks like you're better off using a Graphics instance that's 8 pixels high (with vertical byte). While it 'wastes' one pixel per column (which isn't much for 5 columns!) it means it's way easier to access the Graphics ArrayBuffer's data! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-18 by Mrbbp well i do not understand the interest to display in col vs in row! except to have a smaller ArrayBuffer.
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-18 by Mrbbp i do not understand why by this way vs by the other one.... :( |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-18 by @gfwilliams You can push out line by line, but if so, I'd suggest:
Graphics 'packs' pixels as close together as they will go, so if you have a width of 5 then each row will get spread over your You can also use |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-18 by Mrbbp hello @gordon, i have no predefined solution to switch on led on the matrix. I ask you to forgive my gross ignorance. Shame on me.
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-18 by @gfwilliams
Yes - I think the issue you have is that you have to 'scan' out the LEDs. You can't light them all at once, you have to light up just one row or column and then do them all in sequence. As a simple example, does this light up all the LEDs for you?
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-18 by @allObjects Eric, it all depends... I used the approach of putting out column by column because I know about some of your applications that implement one line of a running text... To finally implement that, it becomes extremely simple: Think about you want to run the text
Regarding point 3: it is actually only 40 cols you shift thru, but with every position I try to show what is going on in 'character graphics' below. After writing to the buffer with a 6x4 font and 1
First you push out the first ten columns for n times -
Then you push out n times 10 columns starting with col 1.
And so fort...
I guess this is enough to show - and see - what is going on... With this setup, the algorithm becomes very very simple
The lower n, the faster the text shifts thru... Conclusion: Single line text plus as many blanks before and
PS: Sorry, the show and tell on my almost 40 years old DIY LED matrix has to wait another post... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-18 by @allObjects ...btw, found this interesting device: https://learn.adafruit.com/adafruit-15x7-7x15-charlieplex-led-matrix-charliewing-featherwing/overviewAttachments: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-19 by @allObjects Finally 'almost final' working example with picture and clip of 7 seconds: testing the scan algorithm that puts out an Espruino Graphics buffer onto a LED matrix. The test uses the drawing of a sequence of rectangles (rs[]) to show the workings. Two independently and 'continuously' running loops do the job:
'Continuously' is achieved by delayed self re-invocation at the end of each function after first invocation in INTERESTING due to low-light condition: The second pic catches a transition between two drawings - shorter time scanning the 'outgoing' 4x3 rectangle and longer time of scanning begin of 'incoming' indented 3x3 rectangle - and the clearing of the display and drawing of the new rectangle in between. The transition is caught by the shutter time straddling the two drawings. That the display time of the outgoing drawing is shorter is noticeable by the first column being less bright (more dim) than the incoming drawing... :) . One should even be able to notice that the LED second from left and top is less bright than the other ones of the incoming rectangle, because the other ones are lit in both of the rectangles / frames... :O. It would be noticeable if LEDs would be properly aligned to project light in exact same direction (to the focal point), which they clearly do not... :/ sorry for that... With the low duty cycle and the diodes in the cathode lines I was not worried about the average forward voltage and current... about 2.6V from Espruino PIC on 2..2.2V red LEDs... - 'old' LEDs, not able to handle the today's regular 20mA (I have anyway not to worry about their life time hours). The diodes are there to protect these LEDS with their weak / low reverse voltage breakdown... Was thought just reading up on it and became aware that older manufacturing techniques yield actually better / higher reverse voltage breakdowns than newer ones... but when I bought them decades ago w/ student money, it was too expensive to take the risk... hahah). Also, I'm not worried about the LEDs taking down Espruino or 'over sinking' the STM32F4 chip: only max three (3) LEDs can be up at one time, way below the max of the chip's supply capability. For more about this particular DIY and other LED matrix' with close pictures, see conversation about Driving LED matrix with shift registers such as 74HC595.
Attachments: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-19 by @allObjects Eric, the
is to make algorithm life easy, have less code to be executed, and thus a brighter display - more scans resulting in more 'ON'-time are possible in a given time. In computer science, Algorithm and Datastructure are complementing elements, like amount of memory and performance (execution time/speed), and same as in many other areas of engineering disciplines: one thrives on the cost of the other one and vice versa. But if a good balance can be struck, Résultats imprévus exceptionnels se manifestant! (...I hope I got that right - google helped me with the details... no kidding. It's 25+ years past my fluency). In engineering, there are areas of freedom and 'non-negotiable' ones, or - as I like to point out - life goes much easier not thinking in black boxes or only inside or only outside boxes: the freedom to budge or choose in one area is key to success in the or another one. In this case at hand - having 8 vertical bits store in a 1 byte - makes the algorithm simple, because all information for one scan cycle stays within one whole byte - no straddling or figuring out or complicated picking of individual bits out of many different bytes to put out in one scan cycle... ;-). If the LED matrix would be taller than 8 pixels, it would just be multiple bytes with a skew factor, such as the first, the 51st, the 101st,... with a buffer supporting a with of 50 pixels / columns. I hope this answers your thoughts. Btw, what does Mr BPP mean?.... now response required... just for curiosity, that can stay unanswered. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-25 by @allObjects a next step... Pulled some TBC20-12/... from junk - bi-color green/red and orange 5x7 LED modules... and I did - for testing them before investing more work - drive them directly with PICO... When both LEDs are on, the color is an orange. Attached you find some clips and pictures. Below you find the code - which goes through each individual LED with given color. In console I then entered instant setInterval to indefinitely scroll through the colors while the display goes through all LEDs, one by one.
The first shot is taken with flash: you can barely see green in 6th row and 1st column on. I could increase the supply (Anode) voltage to 5 Volt, for example, but that would already require some driver... even if it is just a buffer... or level shifter. Second shot is taken with normal light and color can be seen better... of course, it is also red, which is easy to detect. Last shot is interesting: because taken in low light, the shutter picked up an outgoing and an incoming LED... ;O Putting multiples of these 5x7 LED modules into a panel requires lots of losts of lots of wiring... therefore, the post about running text out of an Espruino Graphics buffer will come a bit later. Attachments: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-17 by Mrbbp
Hello, i'm playing with led matrix.

I've bought some small 5x7 matrix and want to display some char on it with the espruino pico
i do not use any hardware driver because i just need 12pins to solder on the board with small resistor to limit current... i did it on an arduino (with a different display but the same pb)
I would like to use the powerfull of js to generate text.
On the Arduino i've used a lib (sevensegment) to declare pin as cathode and anode to drive the display.
Is there something similar to declare a list of pins to connect to a graphicArray? (hope i'm understandable)
best regards
éric
Attachments:
Beta Was this translation helpful? Give feedback.
All reactions