Dot Matrix LCD in Roblox! (with hd44780 bitmaps)
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 thei
th line (Li
) to a string from left to right -
C1
;C2
;C3
… and so on,number
: sets thei
th 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 thej
th character on thei
th 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.
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