Dot Matrix LCD in Roblox! (with hd44780 bitmaps)

Dot Matrix LCD in Roblox! (with hd44780 bitmaps)

Images



After looking around on Roblox for 2x20 LCDs like the ones using in hardware projects (arduino, esp32s, etc.), I stumbled upon a popular solution by “craigery”, (used in the roblox fire alarm community). It used custom images for each character (such hard work!), and finally inspired me to create something hopefully more efficient and easier to configure.

It’s configurable, and creates all the pixels on game startup (instead of having to go through each in studio and customize them there)

It can be controlled using Display:SetAttribute(k,v)
Here’s a list of currently supported controls (k,v)

  • L1; L2; L3… and so on, string: sets the ith line (Li) to a string from left to right
  • C1; C2; C3… and so on, number: sets the ith line cursor to that character position. Negative cursor will use a block cursor instead of the underline. cursors do not blink, you will have to implement it on the controlling script
  • CR, number: used to customize the LCD contrast (pixel transparency)
  • BR, number: used to customize SurfaceGui brightness
  • CBM, I1I1i1 I1I1I1I1I1I1I1I1: used to set a character to a custom bitmap, uses string.pack
    Format: line, charpos, cursor, c1,c2,c3,c4,c5,c6,c7,c8
    Example (sets the jth character on the ith line to be full black:
workspace.Display:SetAttribute("CBM", string.pack("I1I1i1 I1I1I1I1I1I1I1I1", i, j, 0, 31,31,31,31,31,31,31,31))

The bitmap format works similarly to the LiquidCrystal library on arduino and uses an array of 8 5-bit rows (for the 5x8 characters). Keep in mind most fonts use 5x7 taking into consideration the cursor underline.

image
The default Font module uses hex values, but it’s no different from binary 0b00000 or decimal 0-31.

The bitmap data from the HD44780 was extracted using this website: HD44780 LCD controller pixel font data ‐ eleif.net
You can modify the font to use your own characters or send custom bitmaps using the CBM attribute; here’s an useful tool that generates compatible character bitmaps: LCD Custom Character Generator

Keep in mind some characters in the Font module are repeated, and each character is in a specific order according to the utf8 character code.

To increase screen size, please increase part size and decrease resolution (and vice-versa).

Beta, please offer constructive criticism and suggestions
Display.rbxm (35.4 KB)

Make sure to share pictures of anything cool you might create!
The display and relevant scripts are licensed under the Gnu General Public License v3.0.
You may also ask for support in the relevant communities: https://indirecta.tech

25 Likes

Just… WOW… This is absolutely amazing, Can’t wait to see this in realistic showcases, bus games, train games, open world games, roleplay games, NAME THEM ALLL!!!

3 Likes

Documentation there and the wording is overwhelmign and confusing.

Hi! You’re very more than welcome to point out the parts you don’t understand and ask for explanations!


The size is incredibly small and the screen clips through itself. No matter what commands I give it, it does nothing.

image
Did you change anything in the script or display sizes? This is the model file by default; the display only responds to attributes changes if you are playing (either in game or studio), if you’re actually playtesting and it isn’t working, something may have caused it to error before starting to listen to commands, do you see any errors?

P.S. You can resize the display by decreasing resolution and scaling display size uniformly

All I did was delete the black box. I was playing. I used a couple strings but even your example string didn’t work. No errors. And also the documentation is hard to read which makes debugging hard.

If the pixels weren’t created automatically, it means something errored (and if there isn’t any errors, it’s probably a wait for chield yielding because of a hierarchy change)

1 Like