- Muchas notas - Fran Acién

20241213 - X LED screen

I wanted to come back doing projects with LEDS, and I got some spare materials from a course, so I designed a screen with an X.

d4a2287941c8829ec5fffbe49ae68c58.png

I will program it as a +, that means vertically, and then do a trasponse of 45 degress.

In that case:

  • The screen is 39 leds in the Y axis
  • Real 22 leds (8+6+8), on the X axis, but, I am gonna make virtual 40 leds on the X axis, so I skip some, to give the effect to be a square screen
  • That makes a screen of 44 x 40. Where some leds are skipped.

In LEDS and Pixels:

  • A -> X 8 Leds Y 14 Leds | X 16 Pixels Y 14 Pixels
  • B -> X 8 Leds Y 11 Leds | X 16 Pixels Y 11 Pixels
  • C -> X 8 Leds Y 14 Leds | X 16 Leds Y 14 Leds

  • D -> X 6 Leds Y 14 Leds | X 12 Leds Y 14 Leds
  • E -> X 6 Leds Y 11 Leds
  • F -> X 6 Leds Y 14 Leds

  • G -> X 8 Leds Y 14 Leds | X 16 Leds Y 14 Leds
  • H -> X 8 Leds Y 11 Leds
  • I -> X 8 Leds Y 11 Leds

I need a function that transform X and Y to Leds color.

  • If X is odd, discard, cuz we are discarting odds
  • If X is >= 42 or Y is >= 39 discard
  • If part of A or C or G or I, discarted. That is:
    • A -> (X >= 0 and X < 16) and ( Y >= 0 and Y < 14)
    • C -> (X >= 0 and X < 16) and ( Y >= 25)
    • G -> (X >= 28 ) and (Y >= 0 and Y < 14)
    • I -> (X >= 28 ) and (Y >= 25)

Pixel (X, Y) | Expected Led number:

  • (0, 0) -> Discarted
  • (0, 14) -> (0)
  • (0, 15) -> (1)
  • (0, 24) -> (10)
  • (2, 24) -> (11)
  • (2, 25) -> Discarted
  • (2, 23) -> (12)
  • (2, 22) -> (13)
  • (2, 14) -> (21)
  • (4, 14) -> (22)
  • (4, 15) -> (23)
  • (16, 0) -> (88)
  • (16, 1) -> (89)
  • (16, 2) -> (90)
  • (16, 38) -> (126)
  • (18, 38) -> (127)
  • (18, 37) -> (128)
  • (18, 0) -> (165)
  • (20, 0) -> (166)
  • (20, 1) -> (167)
  • (28, 0) -> Discarted
  • (28, 14) -> (322)
  • (28, 15) -> (323)
  • (28, 24) -> (332)
  • (30, 23) -> (333)

Software

Upload files

I will use something like this to upload pictures.

File format

I will make a python script to create the binary structures. Something like the next:

from PIL import Image

def convert_to_grb(image_path, output_path, width, height):
    img = Image.open(image_path).resize((width, height))
    img = img.convert('RGB')
    with open(output_path, 'wb') as f:
        for pixel in img.getdata():
            g, r, b = pixel  # Convert to GRB
            f.write(bytes([g, r, b]))

convert_to_grb('image.png', 'image.grb', 16, 16)