Page 1 of 1

TILE36 experiences

Posted: Fri Apr 12, 2019 7:42 pm
by marfis
So I received my D series togehter with 2 Tiles36 modules (6x6 RGB matrixes) :)

The Tiles are really cool, but the documention is a bit short and doesn't provide code samples for displaying text etc.

So I digged around in the datasheet and was able to come up with a few code snippset that some of you might find useful. In the end I was able to display scrolling text across 2 tiles in rainbow color with the following code:

Code: Select all

from micropython import const
import time, machine

LED_ADDR = const(60)        # default LED36 address

i2c = machine.I2C(1)        # select I2C1

def set_text_color(r,g,b,rb,gb,bb,addr=60):
    ba = bytearray(b'\x02c      ')
    ba[-6] = b
    ba[-5] = g
    ba[-4] = r
    ba[-3] = bb
    ba[-2] = gb
    ba[-1] = rb    
    i2c.writeto(addr, ba)

def set_rot(angle, addr=60):
    ba = bytearray(b'\x02\x14 ')
    ba[-1] = angle
    i2c.writeto(addr, ba)

def text(data, addr=60, col_cycle=False):
    if col_cycle:
        ba = bytearray(b'\x02k ')
    else:
        ba = bytearray(b'\x02l ')
    ba[-1] = len(data) & 0xff
    i2c.writeto(addr, ba)
    for i in data:
       i2c.writeto(addr, i)

def show(delay=50):
    while True:
        i2c.writeto(1, b'\x01')
        time.sleep_ms(delay)

def brightness(b=100, addr=1):
    ba = bytearray(b'\x02\x16 ')
    ba[-1] = b & 0xff
    i2c.writeto(addr, ba)

set_rot(1,addr=1)
brightness(100)
text('Micropython is sooo cool..', addr=1, col_cycle=True)
show()
Some explanation to this:

1) First you'll need to setup your tiles with different I2C addresses. The default is 60, so set your second tile to 61 (and more if you have more tiles). The docs https://pybd.io/hw/tile_led36.html provide functions on how to do that (set_i2caddr and save_nvram).

2) I had to rotate the orientation to 1 so that is can scroll to the left.

3) text data is sent to all modules by writing to address 1. It is then sufficient to just write a `1`to address 1 to instruct the display to scroll to the left.

4) set_text_color is not used in this rainbow example, but if you don't want to cycle through the colors, this function can be used to define the foreground and background color of the text.

It's just a quick and dirty example but I guess it helps to get you started. It's really a cool little led display.

Re: TILE36 experiences

Posted: Thu May 23, 2019 8:31 pm
by Surej
Hi,

Will this code work for single tile? I tried loading the code, still, LEDs are not turning ON..

Thanks

Surej

Re: TILE36 experiences

Posted: Fri May 24, 2019 6:25 am
by jimmo
marfis wrote:
Fri Apr 12, 2019 7:42 pm
So I digged around in the datasheet and was able to come up with a few code snippset that some of you might find useful. In the end I was able to display scrolling text across 2 tiles in rainbow color with the following code:
...
It's just a quick and dirty example but I guess it helps to get you started. It's really a cool little led display.
Mine just arrived today too! I agree, it's a really neat little tile. Thanks for this snippet above - works perfectly. :)
Surej wrote:
Thu May 23, 2019 8:31 pm
Will this code work for single tile? I tried loading the code, still, LEDs are not turning ON..
Surej - which WBUS adaptor are you using? If it's the little one (WBUS28), then you'll need to change the example code to machine.I2C(2) (it uses the Y positions instead, where as the WBUS68 uses the X positions). (You can also write machine.I2C('Y') to be clearer).

Re: TILE36 experiences

Posted: Fri May 24, 2019 9:48 am
by Surej
Hi,

I am using the longer one with four tile connectors. I tried changing machine.I2C(1) and also to machine.I2C(2) with no luck. I have connected the tile to the fourth connector far from the pyboard, is it socket specific when using only one tile?

Thanks
Surej

Re: TILE36 experiences

Posted: Fri May 24, 2019 10:37 am
by jimmo
Surej wrote:
Fri May 24, 2019 9:48 am
I am using the longer one with four tile connectors. I tried changing machine.I2C(1) and also to machine.I2C(2) with no luck. I have connected the tile to the fourth connector far from the pyboard, is it socket specific when using only one tile?
That's the WBUS68. It uses the 'X' position (i.e. machine.I2C('X') or machine.I2C(1) ). It's the short one (WBUS28) that you would need to change it to 'Y' for.

It's working for me in the fourth connector on the WBUS68. Can you share the code you're using? Are you calling brightness(100) first?

I copied the code exactly from https://pybd.io/hw/tile_led36.html into a file named led36.py, then on the REPL:

Code: Select all

>>> import led36
>>> led36.brightness(100)
>>> led36.random_dots()

Re: TILE36 experiences

Posted: Fri May 24, 2019 10:53 am
by Surej
Thanks that worked for me :) :D

Re: TILE36 experiences

Posted: Fri May 24, 2019 7:59 pm
by marfis
does that mean that the devices on the same bus are aware of eachother and can automatically sequentially-assign addresses? How does that interact with setting the i2c address manually?
My interpretation of it was that the i2c addresses can only be set manually via i2c. They cannot auto assign. It would have been neat if the breakout board had a HW ID per slot so that the tile knows in which slot it is attached. That would have solved the somewhat awkward user experience if you have orderes several tiles.

The FW of the tiles seems to contain logic that interprets the address as input what to display. Consider the way how text is displayed. text is broadcasted to all modules at once. Then each module interprets the following scroll commands differnetly, based on their address.

E.g. tile on address 60 displays the first letter, address 61 the second one etc. I also tested this by reassigning one tile to adress 62. And indeed the letter in between is then missing....

Re: TILE36 experiences

Posted: Wed Mar 25, 2020 9:33 pm
by BenY
Hi,
When using address 62 or anything not 60/61 i have problem with #, this is not shown with all dots.
in any of the 4 directions, on address 62 only 2 dots are lost, other address values even show a totally different char or nothing at all.
All pixels on my tiles are working.
example code
addr=62
r = i2c.writeto(addr, b'\x02l\x01 \x01') # wipe
r = i2c.writeto(addr, b'\x02\x14\x00') # 0 = usb low
r = i2c.writeto(addr, b'\x02l\x01#\x01')
time.sleep(2)
r = i2c.writeto(addr, b'\x02\x14\x01') # 1 = usb left
r = i2c.writeto(addr, b'\x02l\x01#\x01')
time.sleep(2)
r = i2c.writeto(addr, b'\x02\x14\x02') # 2 = usb high
r = i2c.writeto(addr, b'\x02l\x01#\x01')
time.sleep(2)
r = i2c.writeto(addr, b'\x02\x14\x03') # 3 = usb right
r = i2c.writeto(addr, b'\x02l\x01#\x01')
Can anyone confirm this behavior ?

Re: TILE36 experiences

Posted: Tue Apr 14, 2020 7:19 am
by jimmo
BenY wrote:
Wed Mar 25, 2020 9:33 pm
Can anyone confirm this behavior ?
Yes. Very weird. I notice on addr=63, then two columns no longer work. I wonder if this is somehow related to cascaded tiles?

I've sent the details to George Robotics.