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 :

  1. /*
  2. Title: lcd_i2c_lucas
  3. Author: Lucas Lim
  4. Date Created: 8/4/2020
  5. Last Modified: 9/4/2020
  6. Purpose: To display text to LCD display module with I2C adaptor.
  7. Dispalying first text message and wait for 3 seconds before
  8. displaying second message at pre-defeined position
  9. */
  10.  
  11. #include < Wire.h>
  12. #include < LiquidCrystal_I2C.h>
  13.  
  14. LiquidCrystal_I2C lcd(0x3F, 16, 2); // set the LCD address, for a 16 chars and 2 line display
  15.  
  16. void setup()
  17. {
  18. Wire.begin();
  19.  
  20. // Initialize the LCD, must be called in order to initialize I2C communication
  21. lcd.begin();
  22.  
  23. // Turn on the backlight
  24. lcd.backlight();
  25. }
  26.  
  27. void loop()
  28. {
  29. // Wait for 3 seconds
  30. delay(3000);
  31.  
  32. //will set cursor to first column of first row
  33. lcd.setCursor(0, 0);
  34.  
  35. // Print a message to the LCD
  36. // Message must be 16 characters length
  37. lcd.print("Testing");
  38.  
  39. // Set cursor to first column of first row
  40. lcd.setCursor(0,1);
  41.  
  42. // Print a message to the LCD
  43. lcd.print("1234567890123456");
  44.  
  45. // Wait for 3 seconds
  46. delay(3000);
  47.  
  48. // Clear the LCD
  49. lcd.clear();
  50.  
  51. // Set cursor to fourth column of first row
  52. lcd.setCursor(3, 0);
  53. lcd.print("Lucas Lim");
  54. lcd.setCursor(0,1);
  55. lcd.print("Hello, world!");
  56.  
  57. // Wait for 3 seconds
  58. delay(3000);
  59.  
  60. // Clear the LCD
  61. lcd.clear();
  62. }

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