lcd1602, HD44780 chipset, battery symbol

Overview

LCD_HD44780_BATTERY_SYMBOL

lcd1602, HD44780 chipset, battery symbol

HD44780 LCM battery gauge and symbol design

Read This

http://wp.me/ph3BR-1ZJ

HD44780_LCM_battery_symbols/xiaolaba_LCM_battery_symbols.jpg

The HD44780 LCM or compatible, contain 8 RAM locations for custom symbols to be build or display.

some technical aspect of how to and why to do that, to read these two web pages of which is the most used references and informative.

Reference:

http://www.circuitvalley.com/2012/02/lcd-custom-character-hd44780-16×2.html

https://omerk.github.io/lcdchargen/

To understand how to obtain a table of special char and display to HD44780 LCM, it is the basic idea, HD44780 customer char battery gauge.JPG

example of code to define two battery symbols, one is 13% charge, the other is 88% charge, why 13% of each step ?

100% / 8 step, = 12% / step = around 13%, that is,

byte bat_13%[8] = { 0xe, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x1f};
 
byte bat_13%[8] = {
0b01110, //0x0e
0b11011, //0x11
0b10001, //0x11
0b10001, //0x11
0b10001, //0x11
0b10001, //0x11
0b11111, //0x11
0b11111 //0x1f
};
 
 
 
byte bat_88%[8] = { 0xe, 0x1b, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f};
 
byte bat_88%[8] = {
0b01110, //0xe
0b11011, //0x1b
0b11111 //0x1f
0b11111 //0x1f
0b11111 //0x1f
0b11111 //0x1f
0b11111 //0x1f
0b11111 //0x1f
};

Demo of how the code works.

https://youtu.be/hj6JJ6AlVHE

Finally, to build a complete test program and to see the resultant, also the demo of battery charging with symbol changing, like animation, you put different battery symbol to a fix location for display, it looks like charging of a battery.

/*
xiaolaba, 2017-JUN-12
UNO, Arduino 1.82
Demo my own battery gauge and symbol.
use a 16x2 LCM display, Hitachi HD44780 compatible
LiquidCrystal library driver.
*/
 
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
//modified 2013/may/11, xiaolaba
LiquidCrystal lcd(7, 6, 5, 4, 3, 2); // change D12, D11 to D7, D6, because Atmega328p D12 = MISO, D11 = MOSI, may interfere with max6675 SPI, test ok
 
// ref: http://omerk.github.io/lcdchargen/
// build my degree symbol
byte degreeC[8] = {
0b00000,
0b10000,
0b00110,
0b01001,
0b01000,
0b01000,
0b01001,
0b00110
};
 
 
 
// xiaolaba, custom battery gauge symbols, 13% - 100%, 8 steps
const byte bat_13[8] = { 0xe, 0x1b, 0x11, 0x11, 0x11, 0x11, 0x11, 0x1f};
const byte bat_25[8] = { 0xe, 0x1b, 0x11, 0x11, 0x11, 0x11, 0x1f, 0x1f};
const byte bat_38[8] = { 0xe, 0x1b, 0x11, 0x11, 0x11, 0x1f, 0x1f, 0x1f};
const byte bat_50[8] = { 0xe, 0x1b, 0x11, 0x11, 0x1f, 0x1f, 0x1f, 0x1f};
const byte bat_63[8] = { 0xe, 0x1b, 0x11, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f};
const byte bat_75[8] = { 0xe, 0x1b, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f};
const byte bat_88[8] = { 0xe, 0x11, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f};
const byte bat_100[8] ={ 0xe, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f};
 
 
 
// xiaolaba, custom battery gauge symbols, one table only, 13% - 100%, 8 steps
const byte battery_symbols[64] = {
0xe, 0x1b, 0x11, 0x11, 0x11, 0x11, 0x11, 0x1f, // battery charge, 13%
0xe, 0x1b, 0x11, 0x11, 0x11, 0x11, 0x1f, 0x1f, // 25%
0xe, 0x1b, 0x11, 0x11, 0x11, 0x1f, 0x1f, 0x1f, // 38%
0xe, 0x1b, 0x11, 0x11, 0x1f, 0x1f, 0x1f, 0x1f, // 50%
0xe, 0x1b, 0x11, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, // 63%
0xe, 0x1b, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, // 75%
0xe, 0x11, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, // 88%
0xe, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f // 100%
};
 
// LCM line1 and line2, easy for human
#define line1 0
#define line2 1
 
void setup()
{
// set up number of columns and rows of LCM, 16 colume x 2 rows
lcd.begin(16, 2);
 
// create 8 battery symbols, custom characters, one by one, write to LCM CGM RAM
// 100% by 8 steps, each step about 13% increament
// simple way
lcd.createChar(0, bat_13); // create the first custom battery symbol, 13%
lcd.createChar(1, bat_25); // second battery symbol, 25%
lcd.createChar(2, bat_38); // so on...
lcd.createChar(3, bat_50);
lcd.createChar(4, bat_63);
lcd.createChar(5, bat_75);
lcd.createChar(6, bat_88);
lcd.createChar(7, bat_100);
//lcd.createChar(7, degreeC);
 
lcd.setCursor(0, line1); //move to position 0, line 1
 
// write the battery gauge symbol one by one to the LCM
lcd.write((uint8_t) 0);
lcd.write((uint8_t) 1);
lcd.write((uint8_t) 2);
lcd.write((uint8_t) 3);
lcd.write((uint8_t) 4);
lcd.write((uint8_t) 5);
lcd.write((uint8_t) 6);
lcd.write((uint8_t) 7);
 
//lcd.setCursor(8, line1); //move to position 8, line1
lcd.print("xiaolaba"); // Print a message to the LCD.
 
 
 
lcd.setCursor(0, line2); //move to position 0, line2
lcd.print("hi,line"); // Print a message to the LCM, final display "hi,line2"
lcd.print((uint8_t) 2); //print integer 2 to LCM, why typecast? see: http://arduino.cc/forum/index.php?topic=74666.0
 
// create & write 8 battery symbols, custom character, one by one, programable way
for ( int i = 0; i < 8; i++) {
lcd.createChar(i, battery_symbols + i*8 ); // create one symbol at a time
lcd.setCursor(i+8, line2); //move to next position at line2
lcd.write((uint8_t) i); //write the symbol to LCM
}
 
}
 
void loop()
{
//demo battery charging status
for ( int i = 0; i < 8; i++) {
lcd.setCursor(7, line1); //always point to position 7, line1
lcd.write((uint8_t) i); //write 8 battery symbols to LCM, one by one
delay(200);
}
 
}

complete project is able to download here, again, the GOOGLE DRIVE,

https://drive.google.com/drive/folders/0B3YrRYrhHTqzWkRPY2FOUEh1YUE

Owner
xiaolaba
xiaolaba
Firmware for DMR transceivers using the NXP MK22 MCU, AT1846S RF chip and HR-C6000 DMR chipset. Including the Radioddiy GD-77, Baofeng DM-1801 and Baofeng RD-5R.

OpenGD77 Firmware for DMR transceivers using the NXP MK22 MCU, AT1846S RF chip and HR-C6000 DMR chipset. This includes the Radioddiy GD-77, Radioddity

Open Ham 86 Jun 26, 2022
Linux Driver for USB WiFi Adapters that are based on the RTL8812AU Chipset - v5.13.6

Click for USB WiFi Adapter Information for Linux A FAQ is available at the end of this document. Problem reports go in Issues. Problem reports should

Nick 136 Jun 26, 2022
Single-Cell Li-Ion Battery Charger with Monitoring

TinyCharger - Single Cell Li-Ion Battery Charger with Monitoring TinyCharger is an ATtiny25/45/85-based, single-cell Li-ion battery charger with selec

Stefan Wagner 20 Jun 13, 2022
foxBMS is a free, open and flexible development environment to design battery management systems.

foxBMS is a free, open and flexible development environment to design battery management systems. It is the first modular open source BMS development platform.

The foxBMS Team 64 Jun 30, 2022
A no bullshit battery monitor for OpenBSD

A no bullshit battery monitor for OpenBSD. In particular, really useful for running alongside cwm in case you don't run something like dzen2 or lemonbar. It is designed to be remisicent of the little boxes you get on FVWM and GNUStep.

Ashton Fagg 8 Nov 16, 2021
The ultimate battery tester with ESR measurement and discharge graph. Based on an Arduino Nano and a 1602 LCD.

Ultimate-Battery-Tester Version 1.0.0 Features Measures the ESR (equivalent series resistance) of the battery. This is an idicator of the health of th

Armin 6 Mar 28, 2022
Save battery power and put your ESP32 to (deep) sleep - but what happens when it wakes up?

#229 ESP32 Deep Sleep Save battery power and put your ESP32 to (deep) sleep - but what happens when it wakes up? Direct link to video: https://youtu.b

Ralph Bacon 6 Mar 25, 2022
MAXREFDES1277 is a reference design that enables the evaluation of MAX17853/52 for battery management in a 48V system.

MAXREFDES1277 The MAXREFDES1277 reference design enables quick evaluation of MAX17853/52 for battery management in a 48V system. It can be used to tes

Maxim Integrated Training & Technical Support (TTS) Team 3 Dec 2, 2021
Get CPU & GPU temperatures and fan and battery statistics from your Mac.

macOS Hardware Stats Get CPU & GPU temperatures and fan and battery statistics from your Mac. This simple script will output a JSON array containing h

tigattack 4 May 5, 2022
HD44780 peripheral library for stm32 microcontrollers.

stm32-HD44780 This is a peripheral driver library for interfacing stm32 microcontrollers with the HD44780 display driver. The implementation uses the

Lorenzo Murarotto 17 Jan 20, 2022
DollarSkip is a short piece of C code designed to ignore the dollar symbol at the start of commands.

DollarSkip is a short piece of C code designed to ignore the dollar symbol at the start of commands.

null 19 Apr 15, 2022
A simple library to expose the linker namespace functionality in Android 9+ together with symbol hooking

Android Linker Namespace Bypass Library Provides access to the hidden linker namespace functionality in Android 9+ and exposes an interface for hookin

Billy Laws 7 Jun 8, 2022
Even newer Custom Firmware for Xiaomi Cameras based on Hi3518ev200 Chipset. It includes free RTSP, ONVIF and other improvements based on the work by roleoroleo

Why this Yi-Hack-V5 firmware? The answer is simple: missing updates, RTSP and not based on the latest stock firmware (which features improvements and

null 301 Jun 30, 2022
Firmware for DMR transceivers using the NXP MK22 MCU, AT1846S RF chip and HR-C6000 DMR chipset. Including the Radioddiy GD-77, Baofeng DM-1801 and Baofeng RD-5R.

OpenGD77 Firmware for DMR transceivers using the NXP MK22 MCU, AT1846S RF chip and HR-C6000 DMR chipset. This includes the Radioddiy GD-77, Radioddity

Open Ham 86 Jun 26, 2022
Linux Driver for USB WiFi Adapters that are based on the RTL8812AU Chipset - v5.13.6

Click for USB WiFi Adapter Information for Linux A FAQ is available at the end of this document. Problem reports go in Issues. Problem reports should

Nick 136 Jun 26, 2022
Single-Cell Li-Ion Battery Charger with Monitoring

TinyCharger - Single Cell Li-Ion Battery Charger with Monitoring TinyCharger is an ATtiny25/45/85-based, single-cell Li-ion battery charger with selec

Stefan Wagner 20 Jun 13, 2022
foxBMS is a free, open and flexible development environment to design battery management systems.

foxBMS is a free, open and flexible development environment to design battery management systems. It is the first modular open source BMS development platform.

The foxBMS Team 64 Jun 30, 2022
A no bullshit battery monitor for OpenBSD

A no bullshit battery monitor for OpenBSD. In particular, really useful for running alongside cwm in case you don't run something like dzen2 or lemonbar. It is designed to be remisicent of the little boxes you get on FVWM and GNUStep.

Ashton Fagg 8 Nov 16, 2021
The ultimate battery tester with ESR measurement and discharge graph. Based on an Arduino Nano and a 1602 LCD.

Ultimate-Battery-Tester Version 1.0.0 Features Measures the ESR (equivalent series resistance) of the battery. This is an idicator of the health of th

Armin 6 Mar 28, 2022
Save battery power and put your ESP32 to (deep) sleep - but what happens when it wakes up?

#229 ESP32 Deep Sleep Save battery power and put your ESP32 to (deep) sleep - but what happens when it wakes up? Direct link to video: https://youtu.b

Ralph Bacon 6 Mar 25, 2022
MAXREFDES1277 is a reference design that enables the evaluation of MAX17853/52 for battery management in a 48V system.

MAXREFDES1277 The MAXREFDES1277 reference design enables quick evaluation of MAX17853/52 for battery management in a 48V system. It can be used to tes

Maxim Integrated Training & Technical Support (TTS) Team 3 Dec 2, 2021
Get CPU & GPU temperatures and fan and battery statistics from your Mac.

macOS Hardware Stats Get CPU & GPU temperatures and fan and battery statistics from your Mac. This simple script will output a JSON array containing h

tigattack 4 May 5, 2022