LED Matrix 8x8 based on ht16K33 I2C

Please add any feature requests for Flowcode version 7 here

Moderator: Benj

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: LED Matrix 8x8 based on ht16K33 I2C

Post by Benj »

I've pushed another update to the component which hopefully fixes the 8x8 module so the hardware should match the others and the simulation.

As for text on the 8x16 backpack I'm going to leave this for now if that's ok as there will likely be a fair bit of code required to get this to function. If you ever need it in the future then give me a shout and I can look again.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: LED Matrix 8x8 based on ht16K33 I2C

Post by medelec35 »

Benj wrote:Oh wow yes I see it now, That is crazy I wonder why they laid it out like that!
I know, that caused me a bit of head scratching at first.
Benj wrote:As for text on the 8x16 backpack I'm going to leave this for now if that's ok as there will likely be a fair bit of code required to get this to function. If you ever need it in the future then give me a shout and I can look again.
Thanks Ben,
I was going to surprise some one with a message of it scrolling long ways as they have a few 8x16 backpack .
But don't want to take too much of your valuable time so it will be fine.

I do have suggestion though for when you revisit component. What about change orientation which just changes direction from right - left to up - down
Benj wrote:I've pushed another update to the component which hopefully fixes the 8x8 module so the hardware should match the others and the simulation.
I'm afraid its not working.
The LED's scroll but pattern looks like chars been cut in half and stitched back with alignment out.

Martin
Martin

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: LED Matrix 8x8 based on ht16K33 I2C

Post by Benj »

Hi Martin,
I do have suggestion though for when you revisit component. What about change orientation which just changes direction from right - left to up - down
Yes this should be possible once I add the extra code, it's certainly possible but means manipulating inner byte rather than moving bytes around. I'll have a quick go if I get chance later this week.
I'm afraid its not working.
The LED's scroll but pattern looks like chars been cut in half and stitched back with alignment out.
I've been over this again and again, please can you double check that your addressing is correct.

Here is the code
HT16K33_1.fcfx.png
(13.61 KiB) Downloaded 4341 times
and here is my working out to get the bits 1-8 back into the correct position.
HT16K33_2.fcfx.png
(4.56 KiB) Downloaded 4341 times
A standard device has 1-8 in the correct position and this is known to work.

The next set of data shows how unmodified data would appear on the 8x8 display.

Shifting right by 1 moves the bits down so that 8-2 are now in the right place.

Finally Oring 0x80 if bit 0 was set should add in the 1 in the right place.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: LED Matrix 8x8 based on ht16K33 I2C

Post by medelec35 »

Hi Ben,
As a sanity check, compiled flowchart:
Tesat2a.png
(15.52 KiB) Downloaded 4337 times
Got the following results:
Test1.png
(13.02 KiB) Downloaded 4338 times
:
8x8 Backpack.jpg
8x8 Backpack.jpg (261 KiB) Viewed 10177 times
I Don't understand as the image of flowchart you posted looks spot on to me. :?

Displaying the letter A:
Printing  A.jpg
Printing A.jpg (276.05 KiB) Viewed 10174 times
Text here from someone else also mentions about the complication:
I’m setting all rows to the value 0xaa (i.e. binary 10101010). However, there is a complication – the bits are actually offset against the LEDs, so writing 0x01 actually illuminates the 2nd LED of each row. So you actually need to do the following (taken from the source code of the library):

bitnum0to7 = (LED + 7) mod 8

So to set the first LED, write the hex pattern 0x80. For the second LED, use 0x01; the third 0x02; fourth 0x04 and so on up to the last LED on the row being 0x40. I assume this is quirk of the wiring of the LED matrix to the driver pins of the HT16K33.
Attachments
HT16K33 Test.fcfx
(21.95 KiB) Downloaded 260 times
Martin

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: LED Matrix 8x8 based on ht16K33 I2C

Post by Benj »

Hi Martin,

Thanks for the images, they help a lot. It looks like I am doing the right thing but it seems to be happening multiple times so I maybe need to be careful about when I apply the manipulation. I've had another play and hopefully we are closer now!

I had a eureka moment last night about how to do vertical text without going round the houses and this is now in and hopefully working, seems fine in the sim so I am hopeful.

I've just pushed a new update so let me know how you get on.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: LED Matrix 8x8 based on ht16K33 I2C

Post by medelec35 »

Hi Ben.
Re 8x8... Scrolling with orientation on 0 is now perfect!
Scrolling chars with orientation on 1 is not working.
Just using

Code: Select all

A
again as an example:
Orientation 1.png
(103.97 KiB) Downloaded 4307 times
8x8 does not scroll at all. Just a static 3 LED's lit
The other two do scroll, just chars are wrong.

Orientation 0 or 1 within DisplayString component is a great idea!
Martin
Martin

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: LED Matrix 8x8 based on ht16K33 I2C

Post by Benj »

Thanks Martin,

Hopefully should be fixed now.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: LED Matrix 8x8 based on ht16K33 I2C

Post by medelec35 »

Hi Ben thank you.
I don't know how you do it without testing on hardware first!
Very clever!
It's so near!

Results:
8x16 Backpack. Works with both orientations.
16x8 Featherwing. Works with both orientations.
8x8 works with orientation 0 but not with orientation 1 (only bottom row are changing, looks like random grouping rather than scrolling.
However can get it to work on orientation 1 if using code from 8x16 Backpack.

Sorry for another suggestion so late in the day but not a vital function, just useful.
Is there way of allowing us to add a few custom patterns.
E.g if we want to add a smiling face.
Perhaps via a kind of LUT?
Martin

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: LED Matrix 8x8 based on ht16K33 I2C

Post by Benj »

Hi Martin

Brilliant nearly there then :D

I could integrate the bitmap drawer components so you can use a monochrome bitmap. Would that do what you need?

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: LED Matrix 8x8 based on ht16K33 I2C

Post by medelec35 »

Yes, you are definitely nearly there!
Benj wrote:I could integrate the bitmap drawer components so you can use a monochrome bitmap. Would that do what you need?
Sounds great to me.
If easy to use then that will be fantastic!
Thanks for all your hard work you have clearly put in to this!
Martin

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: LED Matrix 8x8 based on ht16K33 I2C

Post by Benj »

Hi Martin,

Right I've updated the component again, fingers crossed this fixes all the bugs with the 8x8 module.

I've also added the functionality to the Bitmap drawer components so you can point them at the HT16K33 component. Any problems here then please let me know but I think it should all be ok. I've tested the sim works but that's about it.

Here's an example.
HT16K33_Bitmap.zip
(2.9 KiB) Downloaded 252 times
HT16K33_Bitmap.png
(7.81 KiB) Downloaded 4278 times
Thanks for all your hard work you have clearly put in to this!
Just doing my job :D Also you do a lot for our users so it's nice to give you something back in return.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: LED Matrix 8x8 based on ht16K33 I2C

Post by Benj »

On Monday I'll add bounds checking to the led matrix component so the bitmap can be safely drawn partially off screen for sliding animations. I don't think it's in there at the moment!

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: LED Matrix 8x8 based on ht16K33 I2C

Post by medelec35 »

Benj wrote:so it's nice to give you something back in return.
Thanks Ben,
Do love the Monochrome bitmap idea as there is apps that creating for you for free!
Re Bitmap and 8x16 Backpack.
I can't get the image to orientate across long ways.
I enabled all 128 pixels and got the following with:
All 128 Leds on.png
(7.39 KiB) Downloaded 4261 times
Although change flowchart to featherwing and keep hardware as 16x8 backpack then all leds except row 4 light.

Harware/software Featherwing.
All LED's Light.
With 123 as a bitmap:
Mono Btmap Featherwing.png
(182.84 KiB) Downloaded 4261 times
Hardware matches simulator perfectly!
All is correct so long as orientation is on 1 not 0. I would of thought it would be the other-way around.
It does not matter so long as its known. Just thought I would point it out.

8x8 Backpack: like the feaherwing working with mono bit map. Same information regarding orientation applies.
Re display string. Still working with orientation 0.
With orientation 1 for the character

Code: Select all

A 
the following LED's are scrolling:
8x8.png
(4.17 KiB) Downloaded 4261 times
sliding animations sounds great!
Thank you.

Martin
Martin

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: LED Matrix 8x8 based on ht16K33 I2C

Post by medelec35 »

Hi Ben,
Sorry please ignore:
medelec35 wrote:Although change flowchart to featherwing and keep hardware as 16x8 backpack then all leds except row 4 light.
It was a dry joint.

Martin
Martin

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: LED Matrix 8x8 based on ht16K33 I2C

Post by Benj »

Hello,
I can't get the image to orientate across long ways.
It looks like the orientation parameter in the Bitmap and FAT Bitmap components was only implemented for colour GLCDs. I've now rolled this out to everything which should hopefully fix the problem with the 8x16 Backpack. I can't see anything wrong with my maths for the 8x16 so I'm hoping it's the bitmap drawer components at fault.
All is correct so long as orientation is on 1 not 0. I would of thought it would be the other-way around.
It does not matter so long as its known. Just thought I would point it out.
I was going to invert the orientation but I've left this as was for now just to avoid adding more bugs :D .
8x8 Backpack: like the feaherwing working with mono bit map. Same information regarding orientation applies.
Re display string. Still working with orientation 0.
With orientation 1 for the character
Hmm not too sure on this one, I may have fixed it now but have a go and let me know.
On Monday I'll add bounds checking to the led matrix component so the bitmap can be safely drawn partially off screen for sliding animations.
Bounds checking has now been implemented so hopefully the component is a bit more bulletproof and bitmaps can be drawn partially off screen without nasty things happening such as RAM memory corruption.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: LED Matrix 8x8 based on ht16K33 I2C

Post by medelec35 »

Hi Ben,
here are the results using Bitmap:
Image.png
(107.9 KiB) Downloaded 4188 times
The hardware matches Flowcode simulation using bitmap images.
If you're ok with setting flip to 2 to make it work, then you have cracked it.
Good job!

The only issue is with DisplayString function on 8x8 backpack and only with orientation 1.
Working OK with orientation 0.
I have sent you a short video via email of sending

Code: Select all

123
in orientation 1

Martin
Martin

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: LED Matrix 8x8 based on ht16K33 I2C

Post by Benj »

Thanks for the vid Martin.
The only issue is with DisplayString function on 8x8 backpack and only with orientation 1.
I've had another go for you and pushed the update, fingers crossed.
The hardware matches Flowcode simulation using bitmap images.
If you're ok with setting flip to 2 to make it work, then you have cracked it.
The GLCD components have 0 being the top row but it is the bottom row in the LED array component. I was going to try and auto flip this but couldn't spot a nice place to do this. It might come to me but for now I'm going to leave as is :wink:

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: LED Matrix 8x8 based on ht16K33 I2C

Post by medelec35 »

Hi Ben, thanks for the update.
Re: 8x8 Backpack
Unfortunately with orientation on 0 using DisplayString component, we are back to:
Displaying A.png
(97.85 KiB) Downloaded 4156 times
.
The good news is orientation 1 works perfectly!
so this is the closest to completion so far.
Benj wrote: I was going to try and auto flip this but couldn't spot a nice place to do this. It might come to me but for now I'm going to leave as is
Thanks Ben not an issue at all!
I just had a look at the help for the component and spotted:
Malicious code Warning.png
(100.19 KiB) Downloaded 4156 times
The other zip files for

Code: Select all

Component: Bitmap Drawer ROM
for example does not show such a warning.
I believe the warning will put people off from downloading example?

Martin
Martin

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: LED Matrix 8x8 based on ht16K33 I2C

Post by medelec35 »

Hi Ben,
Would it be possible to add the this component to the existing collection please?
If so, I have made it a lot easier by learning how it works and produced a fully function flowchart.
The functions are:
Increment from 0000 to 9999 to 0000 etc.
When count is = 0020 then enable colon e.g. 00:20, 00:21 etc
When count >= 50 then add the DP to the far right e.g. 00:50. , 00:51. etc
When count is = 100 Clear the colon e.g 0100.
All proven on hardware.
Attachments
LED7SegHT16k33Backpack.fcfx
(26.73 KiB) Downloaded 144 times
Martin

Post Reply