Skip to content

12. Output devices

Reguirements

individual assignment:

​ add an output device to a microcontroller board you’ve designed, ​ and program it to do something

group assignment:

​ measure the power consumption of an output device

Individual project

I introduce two solution to use LCD display on my own board. I have introduce that Embedded programming week

Research

I used in my final project standard Hitachi HD44780 LCD controller (two row of sexteen characters 16×2). I have to connect 10 pins to my board. It worked very well, but it was very hard to solve how to connect that pins and how to write code.

I was told later that easier way is use Hitachi HD44780 LCD display with I2C LCD Adapter. It’s mean that you connect only 4 pins and code writing is much more easier.

Standard Hitachi HD44780 LCD display

Standard Hitachi HD44780 LCD display consist of 16 pins

HD44780-01.jpg

Hitachi HD44780 LCD display with I2C LCD Adapter

I tested Hitachi HD44780 LCD display in witch was integrated I2C LCD adapter.

At the heart of the adapter is an 8-Bit I/O Expander chip – PCF8574. This chip converts the I2C data from an Arduino into the parallel data required by the LCD display.

HD44780+I2CAdapter-01.jpg

The first I connected Arduino and Adapter GND pins to board GND and Arduino and Adapter VCC pins to board VCC. Then I connected data pins: Arduino SDA pin to Adapter pin SDA and Arduino SCL pin to Adapter pin SCL. That was much easier than connect Standard connetion. HD44780+I2CAdapter-Connect To Controller-01.jpg

Test

I tested my connetions to copy example code and edit it. Programming is documented in 9. Embedded programmin week.

Test code

//YWROBOT
//Compatible with the Arduino IDE 1.0
//Library version:1.1
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

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

void setup()
{
  lcd.init();                      // initialize the lcd 
  lcd.init();
  // Print a message to the LCD.
  lcd.backlight();
  lcd.setCursor(3,0);
  lcd.print("Hello, world!");
  lcd.setCursor(2,1);
  lcd.print("Power By Ec-yuan!");
   lcd.setCursor(0,2);
  lcd.print("Hannu Liedes");
   lcd.setCursor(2,3);
  lcd.print(" ");
}


void loop()
{
}

HD44780-Test-01.jpg

Great it works fine!

Hero Video

This video is hero video for weeks: Embedded programming, Output device and Input device