NOTE: End of Life. This RGB 1602 full color module is based on i2c protocol, with 5 input buttons.
The background light can be changed by coordinate PWM, and it also support Raspberry Pi 3B.
You have three colors to chose, RBG(red,green, blue), you can change it as you will freely.
You can just plug it into your Raspberry Pi and drive it through i2c protocol control the mcp23016 expand IO port.
It reduced occupation of the GPIO Pins and you can use wiringPi's lcd library to control it.
Compatibility List
Compatibility
Platform
Screen and driver board
Notes
Raspberry Pi 3 Model B Plus
WIP
Raspberry Pi 3 Model B
√
Raspberry Pi 2 Model B
√
Features
Designed for Raspberry Pi, support Raspberry Pi 3 mode B
Three optional RGB(red,green,blue) backlight.
Three independly coordinate pins can be use.
High quilaty 16x2 display
size 2.95X4.35(WXH)mm
Builtin HD44780 controller can be attached to MCU directly
Main Controller driver chip is SplC780, can be compatible with other main controller such as 0066(SAMSUNG),SPLC780(SUNPLUS) and so on
Character generator ROM can provide 192 different characters. (5x7 can be 160 or 5x10 can be 32)
64bit custom RAM, can provide 8 8x8 dot characters or 2/4 5x11 dot characters
If you are done install the wiringPi and enabling I2C interface, type the following code in the console to build a .c file
sudo vim.tiny lcd1602.c
*Copy and paste the following demo code into lcd1602.c
*Under the vim.tiny editor, type ":", then type "wq" and press "enter" to save the lcd1602.c file and exit editor
*Next you need to compile the code using gcc.
Type gcc lcd1602.c -lwiringPi /home/pi/wiringPi/devLib/lcd.o -o lcd1602 in the console to compile.
*You should find an executable file named "lcd1602" if the last step was completed.
Type the following code sudo modprobe i2c-dev to load the I2C interface
*Lastly, type sudo ./lcd1602 , and the module will be displaying the demo text, as the following photo shows.
*This is a gif showing the different backlight color
Demo Code
#include <stdio.h> //include standard input output head file
#include <wiringPi.h> //include wiringpi
#include <mcp23017.h> //include mcp23017 control head file
#include <lcd.h> //include LCD control head file
#include <softPwm.h> //include PWM control head file
int main()
{
long value=0;
int rand_num;
int value_blue; //the blue backlight brightness
int value_red; //the red backlight brightness
int value_green; //the green backlight brightness
int display,i,count;
wiringPiSetup(); //init wiringPi
mcp23017Setup (100, 0x20); //init mcp23017 chip I2C address: 0x20,the first pin number: 100
printf ("Raspberry Pi - MCP23017 Test\n"); //print information
for(i=0;i<16;i++)
pinMode(100+i,OUTPUT); //set pin 100 - 115 as output
digitalWrite(101,0); //set pin 101 low voltage
display=lcdInit(2,16,4,100,102,103,104,105,106,0,0,0,0); //lcd init 2*16,4 bit control,use 100,101,102,103,104 pin as control pin
lcdHome(display); //reset cursor
lcdClear(display); //clear screen
lcdPosition(display,0,0); //set display location (0,0)
lcdPuts(display,"Hello World"); //print string "Hello World"
lcdPosition(display,0,1); //set display location(0,1)
lcdPuts(display,"www.52pi.net"); //print string "www.52pi.net"
pinMode(0, OUTPUT); //set Raspberry pi pin 0 as output
pinMode(2, OUTPUT); //set Raspberry Pi pin 2 as output
pinMode(3, OUTPUT); //set Raspberry Pi pin 3 as output
softPwmCreate (3, 50, 100); //set soft PWM pin 3 PWM scale (0-100) original 50
softPwmCreate (2, 50, 100); //set soft PWM pin 2 PWM scale (0-100) original 50
softPwmCreate (0, 50, 100); //set soft PWM pin 0 PWM scale (0-100) original 50
while(1) //always display
{
delay(200); //delay 200ms
value_red=(value<100)?value:0; //0-100 red change
value_green=(value>100&&value<200)?(value-100):0; //100-200 green change
value_blue=(value>200)?(value-200):0; //200-300 blue change
if(value>300) //>300 random colour
{
value_red=rand()%100;
value_green=rand()%100;
value_blue=rand()%100;
}
//rand_num=rand();
softPwmWrite (3,value_red); //soft PWM control red backlight
softPwmWrite (2,value_green); //soft PWM control green backlight
softPwmWrite (0,value_blue); //soft PWM control blue backlight
value++;
if(value>900) //if value >900 return
{
value=0;
}
lcdPosition(display,13,1);
lcdPrintf(display,"%d",value); //print number value
//value_blue=0;
}
}