Fab Academy 2020
11. Output Devices

Assignment :

Jump to Group Assignment section below

Week 11 learning journey :

For this week 'Output Devices' assignment, I am working toward my final project. Initially was planning to use a 7-segment LED display modules but eventually decided to use a LCD display module with a I2C adaptor which only require 4 pins.


Reading datasheet of LCD Display Module (1602A)

The LCD Display Module (1602A) is one of the popular LCD display in the market which is able to display 16 x 2 (16 columns 2 lines) which is up to 32 characters.
  

LCD Display module front and back :
References :
- LCD Display Module 1206A (1602A) Datasheet 1
- LCD Display Module 1206A (1602A) Datasheet 2



I2C interface for LCD Display Module (1602A)

The LCD Display Module (1206A) by itself will require a total of 16 pins. With a I2C interface module (or sometimes refer to as a 'I2C backpack' or 'I2C adaptor'), it's helps to reduce the number of pins required down to 4.

I2C definition :
I2C allows one or more 'master' devices to talk to one or more 'slave' devices (like sensors, another MCU, LCD display, etc) over two wires. I2C support up to 127 devices. The two wire are refer to as 'data line' and 'clock line', connected to SDA (also refer to as serial data) and SCL (serial clock) pins. The data transmitted sort-of piggy-bag on each other.

The I2C interface shown below is compatitible with my LCD display module (1206A), that attachs to the LCD display module. It only has 4-pins (2 for data connections, 1 for VCC and 1 for GND)

I2C interface front and back :
  

References :
- I2C interface for LCD Datasheet 1
- I2C 1602 Serial LCD Module Datasheet 2



Soldering the I2C interface daughter board to the LCD Display Module

As the 16 pins on the I2C adaptor were too long, I used a short jumper cable and removed its headers at both ends and cut out into short pieces of equal length. This pieces will act as cushion for my I2C adaptor and the LCD display, to provide a distance (or gap) between both electronic boards.

Then I soldered the I2C adaptor and the LCD display module together and used . My completed LCD display module (with the I2C interface)



Finding the I2C address for my I2C LCD Display

1) I followed this simple online guide to connect the I2C LCD Display module to my Arduino Uno.

2) Then I followed this guide and run the 'I2C Scanner' sketch to find the I2C address of my I2C interface. My LCD I2C address is '0x3F'.
https://playground.arduino.cc/Main/I2cScanner/





The board that I designed as part of my Final Project

The LCD display is a part of my final project.

For my final project, I had made my very first Arduino-compatible ATmega328p board.
More details are provided at 'My Final Project Electronics Design and Fabrication' page.

Schematics :


Board design :


My completed board :


My simple LCD code :

/*
  Title: lcd_i2c_lucas
  Author: Lucas Lim
  Date Created: 8/4/2020
  Last Modified: 9/4/2020
  Purpose: To display text to LCD display module with I2C adaptor.
  Dispalying first text message and wait for 3 seconds before
  displaying second message at pre-defeined position
*/

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

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

void setup()
{
  Wire.begin();

  // Initialize the LCD, must be called in order to initialize I2C communication
  lcd.begin();

  // Turn on the backlight
  lcd.backlight();
}

void loop()
{
  // Wait for 3 seconds
  delay(3000);

  //will set cursor to first column of first row
  lcd.setCursor(0, 0);

  // Print a message to the LCD
  // Message must be 16 characters length
  lcd.print("Testing");

  // Set cursor to first column of first row
  lcd.setCursor(0,1);

  // Print a message to the LCD
  lcd.print("1234567890123456");

  // Wait for 3 seconds
  delay(3000);

  // Clear the LCD
  lcd.clear();

  // Set cursor to fourth column of first row
  lcd.setCursor(3, 0);
  lcd.print("Lucas Lim");
  lcd.setCursor(0,1);
  lcd.print("Hello, world!");

  // Wait for 3 seconds
  delay(3000);

  // Clear the LCD
  lcd.clear();
}

Programming my board :

Result :



Group Assignment : Measuring the power consumption of an output device

First bit of information can be found on the I2C 1602 LCD datasheet. The datasheet shown that the LCD device is powered by a single 5V DC connection.

It is important to turn on the device and running the intented program first before measurement, so as to measure the actual power consumption under 'loading'.

I used a small portable LED usb multimeter known as the 'Charger Doctor' which is able to measure both voltage and current. The range that the device can measure is between 3.5V - 7.0V, and between 0A - 3A.

The supply voltage (or supply VCC) is 5.14V.


The supply current draw is 0.5A or 500mA, which is the common power output of a USB 2.0 standard.


Power consumption for board and LCD (output device) :
Electric power (watts) = voltage (V) x current (A)
Power is 5.14 x 0.5A = 2.57 watts
or
in another way of saying :
Supply voltage 5.14 V and supply current is 0.5A


Measuring the power consumption for the LCD / output device :

1. Set multimeter to measure Voltage DC ("V-" symbol). Ensure the red-color probe is plugged into the correct port with the V DC symbol. The black-color proble is plugged into the COM port which is the Ground.

2. As I am measuring voltage and current, so I used a breadboard with a (+) and (-) bus.

Using a double-ended alligator clip cables to connect both the red-color proble to the VCC and the black-color proble to the Ground. This way, it allows me to use my hand to take the photo and minimise any unnecessary movement/disturbance.

I used short jumper cables instead of the longer ones. I connected the jumper cables to the breadboard accordingly: VCC to the (+) bus, Ground to the (-) bus. I then use an additional jumper cable and insert into the (+) and (-) buses, as to allow the alligator clips to be able to clip onto as I measure the VCC and Ground.



3. The voltage measured is 4.91 V.

4. Set multimeter to measure electrical current, or milliamps (mA). Ensure the red-color probe is plugged into the correct port with the (mA) symbol this time. To measure current, the multimeter needs to be inside the circuit as like a 'componment' of the circuit, whereby the current will be able to flow through. The red-color proble is connected to the jumper cable to the VCC pin on the target board and black-color proble is connected to another jumper cable which is inserted to the (+) bus on the breadboard to supply the VCC via the (+) bus to the LCD.

Ensure the alligator clip is cliped tightly to the jumper cable.





5. The current measured is 23.42 mA.

6. The power consumption for the LCD output device is as follow :
Power = 4.91 V x 0.02342 A = 0.114 watts

or equvalent to say
23.42mA @ 4.91V
(which is easier to be understood in the electronic field for small output devices)



Reflection :

This week major challenge was that I was trying to use back the board that I made for the input device and integrate with the I2C LCD display, but faced some issues.

I downloaded the TinyWireM as well as the LiquidCrystal_I2C libraries, but kept encountering some errors with some variables/lines. Later than I found out that I had to edit the LiquidCystal.h and LiquidCystal.cpp files to manually add in "(__ATtiny44__)" text, only then I can program my board. I connected the SDA And SCL pins. But it still not working... Beside I2C is very new to me and my board SDA and SCL pins are used for the ISP, I should have pulled out these pins to the side...
     



Files :

- My schematic design (atmega328p_Lucas.sch)
- My board design (atmega328p_Lucas.brd)
- My code for the LCD display (output device) : lcd_i2c_lucas.ino


References :

- I2C for LCD 16×2 Module Usage Guide
- I2C Scanner for Arduino
- Basics of I2C with AVR
- ATTiny USI I2C Introduction
- Youtube : How I2C Communication Works and How To Use It with Arduino