Sunday 4 January 2015

Using a Funduino LCM1602 LCD module with your Arduino

A while back, I bought a cheap i2c LCD module for my arduino off of ebay. It is a "funduino" module.



I was unsure of how to use it and it came without any documentation so I searched the internet for answers. Wiring it up is pretty straight forward, the Arduino i2c ports are fixed:

Here is a mapping from the Arduino to the back of the module.



  • A4 -> SCL
  • A5 -> SDA
  • 5V -> VCC
  • GND -> GND


Additionally, this module has a wrongly labelled backlight enable jumper. On the opposite side of the main connector there are two more pins labelled GND and VCC. Shorting these causes the backlight to turn on, if the backlight() function was called on the LiquidCrystal_I2C object in your sketch.



The standard LiquidCrystal Arduino library does not work with this i2c module. I found a module named LiquidCrystal_I2C which works and provides the same interface. Instead of constructing a LiquidCrystal object, you build a LiquidCrystal_I2C object and pass it the module's i2c address as the first parameter. In addition the module still requires the original parameters. For my module, the following snippet initializes it:


#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>


LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Addr, En, Rw, Rs, d4, d5, d6, d7, backlighpin, polarity

void setup() {
  lcd.begin(16, 2);
  lcd.backlight();
  lcd.print("Hello World");
}

While writing up these notes, I found that the last argument (the polarity argument) must be POSITIVE to enable usage of the backlight.




2 comments:

  1. worked great for me but the code above is missing the main loop function.

    void loop(){ }

    ReplyDelete
  2. Having the technical expertise is so important in life and learning new things is always a great thing. I enjoyed your blog entry. It is very important that I ready up so that I can learn new things that I can work on in life. It is always an important challenge to learning how to do things that are new.

    Brian Hopkins @ Microtips USA

    ReplyDelete