{"id":23752520,"url":"https://github.com/rwbl/lcd-custom-char-maker-v2","last_synced_at":"2025-06-10T14:05:42.623Z","repository":{"id":156024015,"uuid":"362376475","full_name":"rwbl/lcd-custom-char-maker-v2","owner":"rwbl","description":"Create Custom Characters for LCD displays connected to Arduino, Raspberry Pi, Tinkerforge or other","archived":false,"fork":false,"pushed_at":"2021-05-08T08:32:21.000Z","size":1419,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-25T00:21:58.710Z","etag":null,"topics":["arduino","b4r","lazarus","lcd-display","tinkerforge"],"latest_commit_sha":null,"homepage":"","language":"Pascal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rwbl.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-04-28T07:25:04.000Z","updated_at":"2021-05-08T08:32:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"4f450da9-0370-4556-96c1-0078ad4f2fe1","html_url":"https://github.com/rwbl/lcd-custom-char-maker-v2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwbl%2Flcd-custom-char-maker-v2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwbl%2Flcd-custom-char-maker-v2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwbl%2Flcd-custom-char-maker-v2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwbl%2Flcd-custom-char-maker-v2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rwbl","download_url":"https://codeload.github.com/rwbl/lcd-custom-char-maker-v2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwbl%2Flcd-custom-char-maker-v2/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259088555,"owners_count":22803657,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","b4r","lazarus","lcd-display","tinkerforge"],"created_at":"2024-12-31T17:53:14.340Z","updated_at":"2025-06-10T14:05:42.615Z","avatar_url":"https://github.com/rwbl.png","language":"Pascal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lcd-custom-char-maker-v2\r\nCreate Custom Characters for LCD displays connected to Arduino, Raspberry Pi, Tinkerforge or other.\r\n\r\n![lcdccm-1](https://user-images.githubusercontent.com/47274144/117532599-a165aa00-afe8-11eb-8164-95c7b5842a36.png)\r\n\r\n![lcdccm-2](https://user-images.githubusercontent.com/47274144/117532601-a1fe4080-afe8-11eb-94ee-9d7584510617.png)\r\n\r\n## Functionality\r\n* Create custom LCD character with 5 pixel horizontal (cols), 8 pixel vertical (rows).\r\n* Each row is represented by a byte with 5 bits.\r\n* Create DEC, HEX and BIN arrays.\r\n* Save / open the character to / from a textfile located in the application folder.\r\n* Import 8 bytes array string in format 0xNN,0xNN... where NN is HEX value.\r\n* Convert LCD character table high \u0026 low bits to DEC \u0026 HEX values.\r\n* Various language specific examples\r\n* Some example chars in the project source/objects folder.\r\n**Developed for personal use only under the GNU GENERAL PUBLIC LICENSE Version 3.**\r\n\r\n## Development\r\n* Application developed with [Lazarus](https://www.lazarus-ide.org/) v2.0.12, [Free Pascal Compiler](https://www.freepascal.org/) 3.2.0.\r\n* Source included and well documented.\r\n* Application executable not included. Use Lazarus to build.\r\n* Developed and tested under both Windows 10 and Ubuntu 20.04.\r\n\r\n## Install\r\n### Application\r\nUnpack the ZIP archive **lcdccm.zip** to a folder of choice and start ***lcdccm.exe***.\r\n\r\n### Lazarus Source\r\nUnpack the master ZIP archive to a folder of choice.\r\nLoad the Lazarus project file **lcdccm.lpi** in the Lazarus IDE and build.\r\n\r\n## Example Pixel Arrays Custom Character Battery\r\nFor a character 5x8, the 8 entries of the array are holding 5 bits for each row.\r\n```\r\nDEC: 14,27,17,17,17,17,17,31\r\nHEX: 0x0E,0x1B,0x11,0x11,0x11,0x11,0x11,0x1F\r\nBIN: 0b01110,0b11011,0b10001,0b10001,0b10001,0b10001,0b10001,0b11111\r\n```\r\n\r\n## Generated Code Examples\r\n### CPP\r\n```\r\n// lcdcustomcharex.pde\r\n// Arduino CPP LCD Custom Char example \r\n// Tested with Arduino UNO, MEGA and I2C LCD Display 20x4 (LCD2004)\r\n// Additional Libraries: LiquidCrystal_I2C - LiquidCrystal Arduino library for DFRobot I2C LCD displays (https://github.com/marcoschwartz/LiquidCrystal_I2C)\r\n// Wiring: Arduino = LCD I2C: GND = GND,5v = VCC,SDA = SDA,SCL = SCL\r\n#End Region\r\n\r\n#include \u003cWire.h\u003e\r\n#include \u003cLiquidCrystal_I2C.h\u003e\r\n\r\n#if defined(ARDUINO) \u0026\u0026 ARDUINO \u003e= 100\r\n#define printByte(args)  write(args);\r\n#else\r\n#define printByte(args)  print(args,BYTE);\r\n#endif\r\n\r\n// Define the custom character starting with index 0 (of max 7)\r\nuint8_t battery[8]  = {0b01110,0b11011,0b10001,0b10001,0b10001,0b10001,0b10001,0b11111};\r\n// Create the lcd object - Address (1602 = 0x3F,2004 = 0x27)\r\nLiquidCrystal_I2C lcd(0x27,20,4);\r\n\r\nvoid setup()\r\n{\r\n  // Init the lcd and turn the backlight on\r\n  lcd.init();\r\n  lcd.backlight();\r\n  // Create the custom character at index 0\r\n  lcd.createChar(0, battery);\r\n  // Move to home position and write some text\r\n  lcd.home();\r\n  lcd.print(\"Hello World\");\r\n  // Set the cursor at col 0 of line 2 (index 1)\r\n  lcd.setCursor(0, 1);\r\n  // write the custom character with index 0\r\n  lcd.printByte(0);\r\n}\r\n\r\nvoid loop() {\r\n\r\n}\r\n```\r\n\r\n### B4R\r\n```\r\n#Region Notes\r\n'lcdcustomcharex.b4r\r\n'B4R LCD Custom Char example \r\n'Tested with Arduino UNO, MEGA and I2C LCD Display 20x4 (LCD2004)\r\n'Additional Libraries: rLiquidCrystalI2CEx for DFRobot I2C LCD displays (see www.b4x.com \u003eB4R Forum \u003eB4R Libraries)\r\n'Wiring: Arduino = LCD I2C: GND = GND,5v = VCC,SDA = SDA,SCL = SCL\r\n#End Region\r\n\r\n#Region Project Attributes\r\n    #AutoFlushLogs: True\r\n    #CheckArrayBounds: True\r\n    #StackBufferSize: 300\r\n#End Region\r\n\r\nSub Process_Globals\r\n    Public serialLine As Serial\r\n    Private serialLineBaudRate As ULong = 115000\r\n    Private lcd As LiquidCrystalI2CEX\r\n    ' Special characters with location index 0,1...\r\n    Private locationbattery As Byte = 0\r\n    Private arraybattery() As Byte = Array As Byte (0x0E,0x1B,0x11,0x11,0x11,0x11,0x11,0x1F)\r\nEnd Sub\r\n\r\nPrivate Sub AppStart\r\n    serialLine.Initialize(serialLineBaudRate)\r\n    Log(\"AppStart\")\r\n    'Init the LCD: Address (1602 = 0x3F,2004 = 0x27), Columns, Rows\r\n    lcd.Initialize(0x27, 20, 4)\r\n    'lcd.Initialize(0x3F, 16, 2)\r\n    'Turn the backlight on (default is turned off), set cursor 0,0, write some text\r\n    lcd.Backlight = True\r\n    'Write text at row 1 (index 0)\r\n    lcd.SetCursor(0,0)\r\n    lcd.Write(\"Hello World\")\r\n    'Define Special Chars\r\n    lcd.CreateChar(locationbattery, arraybattery)\r\n    'Write Special Chars at row 2 (index 1)\r\n    lcd.WriteCharAt(0,1,locationbattery)\r\nEnd Sub\r\n```\r\n\r\n### Python Tinkerforge\r\nThe LCD 20x4 Bricklet supports up to 8 custom characters 0-7 which are mapped to \\u0008-\\u000F (\\u takes hex numbers).\r\nTested defining and writing custom characters with an LCD 20x4 v1.2 Bricklet having UID=BHN.\r\n```\r\n#!/usr/bin/env python\r\n# -*- coding: utf-8 -*-\r\n#lcdcustomcharex.py\r\n#Tinkerforge LCD Custom Char example  Python\r\n#Tested with Master Brick 2.1, LCD 20x4 Bricklet 1.2\r\n#IMPORTANT=Change #UID# to the UID of the LCD 20x4 Bricklet\r\n\r\nHOST = \"localhost\"\r\nPORT = 4223\r\nUID = \"#UID#\"\r\n\r\nfrom tinkerforge.ip_connection import IPConnection\r\nfrom tinkerforge.bricklet_lcd_20x4 import BrickletLCD20x4\r\n\r\nif __name__ == \"__main__\":\r\n    # Create IP connection\r\n    ipcon = IPConnection()\r\n    # Create device object\r\n    lcd = BrickletLCD20x4(UID, ipcon)\r\n    # Connect to brickd\r\n    ipcon.connect(HOST, PORT)\r\n    # Turn backlight on\r\n    lcd.backlight_on()\r\n    # Clear screen\r\n    lcd.clear_display()\r\n    # Write text at pos row=0,col=0\r\n    lcd.write_line(0, 0, \"Hello World\")\r\n    # Define custom character\r\n    battery = [14,27,17,17,17,17,17,31]\r\n    # Set the custom char at index 0 (from max 7)\r\n    lcd.set_custom_character(0, battery)\r\n    # Write custom char at pos row=1,col=0\r\n    lcd.write_line(1,0,\"\\u0008\")\r\n    # Disconnect\r\n    ipcon.disconnect()\r\n```\r\n\r\n### MQTT Tinkerforge\r\n```\r\n#!/bin/bash\r\n# lcdcustomcharex.sh\r\n# Tinkerforge LCD Custom Char example - Bash script\r\n# Tested with Master Brick 2.1, LCD 20x4 Bricklet 1.2, Tinkerforge MQTT2 API\r\n# IMPORTANT:\r\n# Change #UID# to the UID of the LCD 20x4 Bricklet\r\n# Save the file as uNIX to be able to run after making executable: sudo chmod +x lcdcustomcharex.sh\r\n\r\necho Set custom character\r\nmosquitto_pub -t tinkerforge/request/lcd_20x4_bricklet/#UID#/set_custom_character -m '{\"index\":0, \"character\":[14,27,17,17,17,17,17,31]}'\r\n\r\necho Set backlight on\r\nmosquitto_pub -t tinkerforge/request/lcd_20x4_bricklet/#UID#/backlight_on -m ''\r\n\r\necho Clear display\r\nmosquitto_pub -t tinkerforge/request/lcd_20x4_bricklet/#UID#/clear_display -m ''\r\n\r\necho Write text followed by custom character\r\nmosquitto_pub -t tinkerforge/request/lcd_20x4_bricklet/#UID#/write_line -m '{\"line\": 0, \"position\": 0, \"text\": \"battery: \\u0008\"}'\r\n\r\necho Done\r\n```\r\n\r\n### Hint\r\nTo write a character from the character table of the LCD Display driver.\r\nThe Degree Character ° is located at position upper 4 bits 1101 and lower 4 bits 1111.\r\nThe 8 bits 1101 1111 are HEX DF and DEC 223.\r\nTo write the character to the LCD use lcd.Write(Array As Byte(223)).\r\n\r\n### LCD Character Table\r\nConvert Upper 4 \u0026 Lower 4 bits to HEX and Unicode\r\nExample Cent Character: Upper 4 bits = 1110, Lower 4 bits = 1111\r\nConverted:\r\n11101111 = EF , 0xEF , \\u00EF, 239\r\nUse the LCD display datasheet accordingly.\r\n\r\n## Licence\r\nThis program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of\r\nMERCHANTABILITY or FITNESS for A PARTICULAR PURPOSE.  See the GNU General Public License for more details.\r\nYou should have received a copy of the GNU General Public License along with the samples.  If not, see [GNU Licenses](http://www.gnu.org/licenses/).\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwbl%2Flcd-custom-char-maker-v2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frwbl%2Flcd-custom-char-maker-v2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwbl%2Flcd-custom-char-maker-v2/lists"}