Breadboard friendly, 2.54mm pitch, I2C controlled 8x2 characters LCD board for 5V microcontroller. It has a pull-up resistors for I2C bus.
It is 2.54mm (.1") pitch, so you can plug in the breadboard and Arduino. The pin assignment is same as Arduino Uno "Analog" pins which are used for I2C connection. It has a pull-up resistors for I2C bus, so all you have to do is solder the pin headers for your own you use. However, please be aware that you may want to remove the resistors if you connect other I2C devices on the same bus.
You can set the LCD contrast with the software. The LCD power is supplied through a simple resistor divider circuit from 5V. Supply voltage may vary slightly due to power consumption of the LCD. This instability has proven no cause to the behavior of the module itself.
Also, because the communication method is I2C, please be advised that Arduino standard LCD will not work on this module.
Following is a sample sketch for Arduino.
#include <Wire.h>
#define vddPin 16 // ArduinoA2
#define gndPin 17 // ArduinoA3
#define sdaPin 18 // ArduinoA4
#define sclPin 19 // ArduinoA5
#define I2Cadr 0x3e // Fixed
byte contrast = 35; // Contrast (0~63)
boolean contrastFlag = false;
void setup() {
pinMode(gndPin, OUTPUT);
digitalWrite(gndPin, LOW);
pinMode(vddPin, OUTPUT);
digitalWrite(vddPin, HIGH);
delay(500);
Wire.begin();
lcd_cmd(0b00111000); // function set
lcd_cmd(0b00111001); // function set
lcd_cmd(0b00000100); // EntryModeSet
lcd_cmd(0b00010100); // interval osc
lcd_cmd(0b01110000 | (contrast & 0xF)); // contrast Low
lcd_cmd(0b01011100 | ((contrast >> 4) & 0x3)); // contast High/icon/power
lcd_cmd(0b01101100); // follower control
delay(200);
lcd_cmd(0b00111000); // function set
lcd_cmd(0b00001100); // Display On
lcd_cmd(0b00000001); // Clear Display
delay(2);
}
void loop() {
lcd_setCursor(0, 0);
lcd_printStr("SWITCH");
lcd_setCursor(1, 1);
lcd_printStr("SCIENCE");
if (contrastFlag == false) {
if (++contrast >= 63) {
contrastFlag = true;
}
} else {
if (--contrast <= 0) {
contrastFlag = false;
}
}
lcd_setContrast(contrast);
delay(100);
}
void lcd_cmd(byte x) {
Wire.beginTransmission(I2Cadr);
Wire.write(0b00000000); // CO = 0,RS = 0
Wire.write(x);
Wire.endTransmission();
}
void lcd_contdata(byte x) {
Wire.write(0b11000000); // CO = 1, RS = 1
Wire.write(x);
}
void lcd_lastdata(byte x) {
Wire.write(0b01000000); // CO = 0, RS = 1
Wire.write(x);
}
// Show the string.
void lcd_printStr(const char *s) {
Wire.beginTransmission(I2Cadr);
while (*s) {
if (*(s + 1)) {
lcd_contdata(*s);
} else {
lcd_lastdata(*s);
}
s++;
}
Wire.endTransmission();
}
// Set the character location.
void lcd_setCursor(byte x, byte y) {
lcd_cmd(0x80 | (y * 0x40 + x));
}
void lcd_setContrast(byte c) {
lcd_cmd(0x39);
lcd_cmd(0b01110000 | (c & 0x0f)); // contrast Low
lcd_cmd(0b01011100 | ((c >> 4) & 0x03)); // contast High/icon/power
lcd_cmd(0x38);
}
Documents
How to use (1) (Blog in Japanese)
Category
|
|
Name | I2C small LCD board (5V) |
---|---|
Code | SSCI-014076 |
SKU# | 1407 |
Related Product
-
I2C small LCD board (3.3V) SSCI-014052 (1405)
Breadboard friendly, 2.54mm pitch, I2C controlled 8x2 characters LCD board for 3.3V microcontroller. It has the pull-up resistors for I2C bus in it.
-
LCD Shield Kit - White on Blue SSCI-KIT-LCDSHIELDBL (538)
LCD Shield Kit adds a 16x2 Character LCD to your Arduino. The kit comes with a white on blue LCD.
-
LCD Shield Kit - Black on Green SSCI-KIT-LCDSHIELDGR (724)
LCD Shield Kit adds a 16x2 Character LCD to your Arduino. The kit comes with a black on green LCD.