…how I Learned to Stop Worrying and Love I2C

Some form of display is often vital on your arduino projects.Let me introduce you to the HD44780 character LCD.

It’s quite a common and cheap display solution that is relatively easy to use. It often finds its way into many arduino starter kits for these reasons. Ive used it a few times in my projects but have always been annoyed by one aspect…. the high amount of pins and the requirement of a resistor for the backlight and a potentiometer for the contrast.

The typical wiring setup for the display

As you can see the board uses up 6 data pins on your board which can be a pain on the smaller boards I’ve been using lately. Then I discovered I2C (I squared C).

I2C is a method of using addresses to run many devices on only 2 data lines.

With this we can run these LCD displays with a total of 4 wires. This is handy on boards like the ESP8266 or ESP32 with few pins. I plan on using a I2C compatible display on a project in the near future. I ordered the larger 4 line version in fact.

The code for the I2C display is quite similar to the regular versions.

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

LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x27 for a 16 columns and 2 row display

void setup() {
  lcd.init();       //initialize lcd screen
  lcd.backlight();  // turn on the backlight
}

void loop() {
  delay(1000);                   //wait for a second
  lcd.setCursor(0,0);            // tell the screen to write on the top row
  lcd.print("LCD TEST");         // tell the screen to write “hello, from” on the top row
  lcd.setCursor(0,1);            // tell the screen to write on the bottom row
  lcd.print("Hello World!");     // tell the screen to write "Hello World!" on the bottom row
}

2020 update

Hello all! Hope you have been well over the holidays. I’m writing this post to just give a minor update. Is you’ve seen I’ve been mainly using this blog as a place to post my progress on my Objects in Space Arduino build. However the game has albeit abandoned by the developer in a move that gave its loyal fans virtually zero proper communication. The game claims to be in a 1.0 full release and yet is still plagued by bugs and being sold at full price, with little to no hope that things will be fixed.

It’s because of that I rather reluctantly urge people to NOT buy the game and support this habit that Flat Earth Games has gotten themselves into…. this isn’t the only game they have done this to. This game had SO MUCH potential and it hurts to see it tossed in the trash. Therefor I’m putting my OiS arduino project on hold for now.

As for the fate of this blog I intend to keep it alive and thriving. I am working on other arduino projects and just started attending college to be a Wind Turbine Technician. So needless to say I have a wealth of electronics information coming my way.

Thanks for all the support thus far!