Gravity: I2C LCD1602 Arduino LCD Display Module (Green) (DFR0556)

This is a placeholder topic for “Gravity: I2C LCD1602 Arduino LCD Display Module (Green)” comments.

Referring to the LCD16020, I believe that everyone is not unfamiliar with the square shape, green color, a row of 2.54 pin header… LCD1602 module is a product … read more

Read more

Hi All,

I’ve just bought myself one of these beasties and for the life of me I can’t find the right library to use.

The product’s page takes me to a library for the colour version - the one with the RGB backlight:

With that I have basic control - I can write to the screen fine, but if you dig into the .cpp & .h files it looks as though some of the previous functionality has been removed when it was updated to colour - note the heading here:

/************************unsupported API functions***************************/
void DFRobot_LCD::off(){}
void DFRobot_LCD::on(){}
void DFRobot_LCD::setDelay (int cmdDelay,int charDelay) {}
uint8_t DFRobot_LCD::status(){return 0;}
uint8_t DFRobot_LCD::keypad (){return 0;}
uint8_t DFRobot_LCD::init_bargraph(uint8_t graphtype){return 0;}
void DFRobot_LCD::draw_horizontal_graph(uint8_t row, uint8_t column, uint8_t len,  uint8_t pixel_col_end){}
void DFRobot_LCD::draw_vertical_graph(uint8_t row, uint8_t column, uint8_t len,  uint8_t pixel_row_end){}
void DFRobot_LCD::setContrast(uint8_t new_val){}

My biggest issue is that I can’t turn the backlight off - the moment you write to it, the backlight comes on and I’ve not been able to turn it off.

Here you see setBacklight being an alias for backlight and noBacklight, but I’ve not been able to find the right uint8_t value to turn the backlight off. (Every non-zero value I’ve tried just makes it flash, and at 0 it’s on steady).

   *  @brief compatibility API function aliases
  void blink_on();						// alias for blink()
  void blink_off();       					// alias for noBlink()
  void cursor_on();      	 					// alias for cursor()
  void cursor_off();      					// alias for noCursor()
  void setBacklight(uint8_t new_val);				// alias for backlight() and nobacklight()
  void load_custom_character(uint8_t char_num, uint8_t *rows);	// alias for createChar()
  void printstr(const char[]);

Can anyone point me to a library that includes a method for me to control the backlight, or the secretSauce to get the RGB library to do it?


- Greig.

1 Like

Hi Grieg,

It looks like this library can handle both but the comments lead you astray.

If you try running through the code on the Wiki do you get a breathing effect?

#include <Wire.h>
#include "DFRobot_LCD.h"

DFRobot_LCD lcd(16,2);  //16 characters and 2 lines of show

void breath(unsigned char color){
    for(int i=0; i<255; i++){
        lcd.setPWM(color, i);

    for(int i=254; i>=0; i--){
        lcd.setPWM(color, i);


void setup() {
    // initialize
    // Print a message to the LCD.
    lcd.setCursor(4, 0);
    lcd.setCursor(1, 1);
    lcd.print("lcd1602 module");

void loop() {



1 Like

Thanks heaps Liam!!

I can confirm that it does “breathe” running that sketch, and that lcd.setPWM(REG_ONLY, 0) turns the backlight off.

I’ll leave the product a review when my project’s a little more evolved and will make mention of this little ‘gotcha’ there.

- Greig.

1 Like

No worries Grieg!!

Glad to hear you got it working! I’ve moved this topic over to the LCD display so other Makers can see it in the future :smiley:


1 Like

Hi, Is the backlight of the Gravity: I2C LCD1602 Arduino LCD Display Module (Green),
SKU: DFR0556 controllable via the I2C. Thanks, Jeff

Welcome to the forums Jeff!

The backlight is controllable via I2C.
If you look into the example code Liam posted earlier you can see the code that’s designed to make the backlight breath or fade up and down.