P3 RGB pixel panel #1792
Replies: 36 comments
-
Posted at 2018-06-11 by @gfwilliams I haven't heard of anyone doing it, but I think it's possible. I believe those things need active scanning - probably not easy to do for greyscale without custom firmware, but I think you could scan out with 3 bit colour from JS. I'd look at http://www.espruino.com/LPD6416 - it uses this module: http://www.espruino.com/modules/LPD6416.js You'd need to add the extra colour channel and more rows, but I think that could be ok. The only think is it'd likely flicker if other JS code took more than 20ms or so to execute, but it's definitely usable (and there are some other hacks you could do with inline C as well that might fix that). |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-06-13 by Owen Thanks Gordon. I'm not great with hardware coding but LPD6416 looks like a good starting point. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-09-21 by @gfwilliams Did you ever have any success with this? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-09-24 by JumJum I would like to do some testing on this. Pins are the same as used in an working ESP32-only solution. This part should be correct. I've some questions:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-09-24 by @gfwilliams Looks good - I think you actually want to leave out Also The code in the module is designed to run really quickly - so it uses a few hacks (most of which I think you picked up on!)
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind
is the same as:
Except that it's significantly faster when you're calling it multiple times, since all the arguments that don't change have already been precalculated
There's an explanation in http://www.espruino.com/Reference#l__global_digitalWrite - again, it's a very fast way of pulsing the pin on and off while also setting the address pins.
:) These RGB LED arrays scan out two rows at once. That's why you have R1 and R2, G1,G2,B1,B2. Address 0 = row 0 and 16, 1 = 1 and 17, etc. I think I mentioned in my email, but it means that you'll have to precalculate a new array that contains the image of the first 16 rows plus the image in the next 16 rows shifted left by 3 bits (and then use However for testing the current code should work, and will drive the top or bottom 16 rows depending on what colours you use.
It looks like a good idea - but I doubt it'll matter too much as it'll get sorted once scan is called. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-09-25 by JumJum @gordon, thanks for your help, but looks like this will not run, at least on ESP32. There is a pure ESP32 solution using I2S in parallel mode, having density and full colors using PWM. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-09-25 by @gfwilliams Wow, that is crazy slow - just tried the code on a Pico and it's 20ms even unminified. You used basically the code above you uploaded, so it's As you mention, a purely native solution is going to be better, but I really don't want to be stuck having to maintain ESP32 specific library code for this one type of device inside the main Espruino repo - I guess you could just keep a fork with it in? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-09-26 by JumJum hmm, there must be something different in our testing.
Result in Millisconds of running test on both boards
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-09-26 by @gfwilliams Wow, that stumped me - then I found:
The Array copy does take a bunch of time - but if you use That might well sort out your ESP32 issues :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-09-27 by JumJum Life could be much easier, doing things correctly , ..... Good news first, I got it running. I'm pretty sure there are better ways for converting, but I'm pretty sure it will always be slow. Anyway, if somebody wants to test with other boards, this could be a good start
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-09-28 by @allObjects @jumjum, is there reason for attaching the methods to each instance of LedMatrix instead of using prototype?... for a singleton that works... but then the constructor and new would not be needed either. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-09-28 by @allObjects @jumjum and @gfwilliams, regarding the slowness: would writing .convert() and .scan() in compiledC and running them independently help? Scan would have to run always on interval w/ decent frequency, convert would run like on flip, and buffers would always be full buffers? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-09-28 by @allObjects Regarding ESP32 always slow as figures in post #9 'hint' makes me believe that there is something else under the (ESP32) hood running... I have not dealt with ESP32 yet, but could see that RTOS - or what ever kernel runs ESP32 - is interpretatively executing what it is told to do through exposed API / SDK? It's hard to believe that such a 'thick layer' would be shoved in between the application and the hardware and down the throat of the 'user'... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-09-28 by @gfwilliams Definitely writing Thanks for posting up the code @jumjum - that's frustrating as it's almost there... If it were 20ms it would be reasonably workable :( |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-09-28 by JumJum @allObjects, agree to your first point, Let me give an answer in (a kind of) german. One more problem of ESPIDF, it's hungry for memory. With V3.1 we reach 1300 kBytes, where V3.0 needs 1100 kBytes. Ok, we have a change around mbedtls, but this should never be the reason for additional 200kBytes. Oh, before I forget, my assumption about speed of set/reset pins was not correct, as you can see in compasion table above. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-10-02 by @allObjects
Sounds like rebirth of good-old 'Centronics' (printer) parallel interface... (IEEE 1284, 36 pins/wires) - just with more option then just nibble and byte... Interestingly on that interface was that slaves (printers) could be implemented without alu / processor... just plain timed TTL logic could do the job. Some early printers could not even interpret control characters, that's why there were so many extra lines to control line feed, page feed, etc. and in the beginning it was not bidirectional either and this added even more lines to provide signals such as out of paper. The pulse/clock stretch was done with 'delaying' the ack... even though it was 'parallel', in the 'bigger picture' it was kind-a async serial... great fun! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-12 by JumJum During my test for this LED board, I tested a driver using setPixel in javascript.
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-12 by @gfwilliams I guess the relative speed depends on how many pixels you set for each frame. The obvious thing would (I guess) be to have something inside the ArrayBuffer graphics class (so not to have setPixel) that just recalculated the address differently: https://github.com/espruino/Espruino/blob/master/libs/graphics/lcd_arraybuffer.c#L20 However it still feels like a very specific workaround. It's a shame we couldn't find a way of making the conversion step more efficient since it's effectively just ANDing one array with another shifted left by 3 bits. What was your final conversion code? We could definitely do 32 bits at a time.:
If
The first option takes 0.15s on a nRF52 at 64MHz, the second takes 0.1s. Hopefully on the ESP32 that might even be a bit faster. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-14 by JumJum I've checked your version and it takes about 0.16s on ESP32. To get a better idea what a setPixel driver in C could be, I created a version for testing. All together it is about 25 lines including initialization. Switching to this driver is done by adding panel:true to config of createArrayBuffer. Wow, now a clear() takes less than 2msec. And I was able to create some kind of simple animation using graphics class. My ideas behind using this panels are things like:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-18 by @gfwilliams I think (with a SAVE_ON_FLASH ifdef) it's something that could make sense to put in (after all we do have Do you have a link to the code you used? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-19 by JumJum @gfwilliams please see attached zip file.
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-20 by @gfwilliams Thanks - that drawEllipse stuff looks great and I'll get that added, but I really don't want a whole new ArrayBuffer implementation shoved in the head of graphics.c when I'm pretty sure it could have been a 2-liner in https://github.com/espruino/Espruino/blob/master/libs/graphics/lcd_arraybuffer.c#L20 as I'd suggested? I'll see what I can add. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-20 by JumJum The better solution always beats the best. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-20 by @gfwilliams I notice in your solution you're writing pixels as what's basically To shift out you'd use |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-20 by JumJum I don't see any problem with 0xrgb0rgb |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-20 by @gfwilliams Great! Just committed:
Hopefully that'll work for you - and who knows, maybe it'll end up being useful for something else later on :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-20 by @gfwilliams Also, just added your ellipse code. I modified it so that it takes x1,y1,x2,y2 so that it can be called in the same way as fill/drawRect - it also works better with However, it seems there are some issues... I'd expected that Also - and this one's my fault - because you can now specify the bounding rect you can effectively ask it to draw something that doesn't have an integer radius. I don't know if that's something that can easily be fixed with that algorithm? No worries if not :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-21 by JumJum @gfwilliams I've checked with
setPixel, drawLine work fine,
Rotating of Ellipse, hmm no idea, I've to check. But Christmas is coming, and family is coming, .... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-21 by @gfwilliams Oops - forgot about the fills. Try now! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-12-21 by JumJum Works perfect now! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-06-07 by Owen
Has anyone used Espruino with a P3 RGB pixel matrix like this? Where would I begin?
https://www.aliexpress.com/item/P3-RGB-pixel-panel-HD-display-64x32-dot-matrix-p3-smd-rgb-led-module/32728985432.html
Beta Was this translation helpful? Give feedback.
All reactions