Assignment 11 Output Devices

"Hi everyone ,Week 11 output devices begin.As i planned to work on my project related thing in output week followed by input week.I hope i will get the things properly.I am thinking about my final project where i have decided to used LCD display on sever side board .So in this week i am hopeing to interfaced my Server board along with LCD display with LM 35.My major goal of this week is to work on my output board having LCD display and LED's and test the code using ardiono IDE .So lets start working on output devices.


  • Design output board
  • Design microcontroller board
  • About output device:

    An output device is used to send data out of the system.Output device is any piece of computer hardware equipment which converts information into human-readable form. It can be text, graphics, tactile, audio, and video.Some of the output devices are Visual Display Units (VDU) i.e. a Monitor, Printer.So in short all we need an output device to display the information in the form of text ,graphics.

    So as part of my output device which i am going to used in my final project is Text display.For that i referred Neil's document of output devices week.Where i found three display.LCD,OLED & TFT.

    About LCD Display:

    What is LCD 16 * 2?

    An liquid-crystal display (LCD) is an electronic display module which uses liquid crystal to produce a visible image. The 16×2 LCD display is a very basic module commonly used in DIYs and circuits. The 16×2 translates o a display 16 characters per line in 2 such lines. In this LCD each character is displayed in a 5×7 pixel matrix.(electronicsforu)

    Top View

    (Note:Please go through the following things in detailed.Dont jump to another topic.I also skip this part which cause unnecessary problem.So to avod this read the following thing carefully.)

    What is the cost of LCD display?

    The LCD I am going to used is of $9.65.For more information visit website

    Pin daigram

    Top View

    Back View

    In our FAB inventory we have LCM-S01602DTR/M 16 X 2 LCD display .The 16 X 2 LCM-S01602DTR/M pin out is shown below.

  • Pin1 VSS :This is a GND pin of display, used to connect the GND terminal of the microcontroller unit or power source.
  • Pin2 VDD: This is the voltage supply pin of the display, used to connect the supply pin of the power source.
  • Pin3 V0: This pin regulates the difference of the display, used to connect a changeable POT that can supply 0 to 5V.
  • Pin4 RS: This pin toggles among command or data register, used to connect a microcontroller unit pin and obtains either 0 or 1(0 = data mode, and 1 = command mode).
  • Pin5 R/W : This pin toggles the display among the read or writes operation, and it is connected to a microcontroller unit pin to get either 0 or 1 (0 = Write Operation, and 1 = Read Operation).
  • Pin6 E :This pin should be held high to execute Read/Write process, and it is connected to the microcontroller unit & constantly held high.
  • Pin7-14 DB0-DB7: These pins are used to send data to the display. These pins are connected in two-wire modes like 4-wire mode and 8-wire mode. In 4-wire mode, only four pins are connected to the microcontroller unit like 0 to 3, whereas in 8-wire mode, 8-pins are connected to microcontroller unit like 0 to 7.
  • Pin15 NC:
  • Pin16 NC:
  • ( Remember: Pin15 & Pin16 are not connected pins.So you dont need to connect anything to it.So just interface the Pin 1-Pin 14 to backpack)


  • Manufacturer Lumex Opto/Components Inc.
  • Number of Characters 32
  • Display Format 16 x 2
  • Character Format 5 x 8 Dots
  • Display Type TN - Twisted Nematic
  • Voltage - Supply 5V
  • Interface Parallel
  • Operating Temperature 0°C ~ 50°C
  • Background Color Green
  • Commands

    The commands of LCD 16X2 include the following.
  • For Hex Code-01, the LCD command will be the clear LCD screen
  • For Hex Code-02, the LCD command will be returning home
  • For Hex Code-04, the LCD command will be decrement cursor
  • For Hex Code-06, the LCD command will be Increment cursor
  • For Hex Code-05, the LCD command will be Shift display right
  • For Hex Code-07, the LCD command will be Shift display left
  • For Hex Code-08, the LCD command will be Display off, cursor off
  • For Hex Code-0A, the LCD command will be cursor on and display off
  • For Hex Code-0C, the LCD command will be cursor off, display on
  • For Hex Code-0E, the LCD command will be cursor blinking, Display on
  • For Hex Code-0F, the LCD command will be cursor blinking, Display on
  • For Hex Code-10, the LCD command will be Shift cursor position to left
  • For Hex Code-14, the LCD command will be Shift cursor position to the right
  • For Hex Code-18, the LCD command will be Shift the entire display to the left
  • For Hex Code-1C, the LCD command will be Shift the entire display to the right
  • For Hex Code-80, the LCD command will be Force cursor to the beginning ( 1st line)
  • For Hex Code-C0, the LCD command will be Force cursor to the beginning ( 2nd line)
  • For Hex Code-38, the LCD command will be 2 lines and 5×7 matrix
  • The above information is taken from elprocus
  • About I2C protocol

    What is I2C?

    what is i2c. I2C (I-square-C i.e I2C) means inter-integrated communication protocol. This is usually used to communicate between one master and multiple slaves. One of the best things about using I2C is we can reduce the connections (wiring). If you use normal LCD display, you need a total number of connections are 12. If you use I2C LCD display, you need only just 4 connection. By seeing the above example you may know the advantage of I2C protocol. I2C protocol is also known as 2 line protocol.

    Pin configurations

    If you properly have seen the picture above, you will see a black adapter. That black adapter uses the PCF8574T IC chip which converts I2C serial data to parallel data for the LCD display. The blue color component you have seen in the above picture is a potentiometer which is used to adjust the brightness of the display.

    Interfaced I2C with 16X2 LCD(LCM-S01602DTR/M)

    Remember:In above interfacing i used LCM-S01602DTR/M 16X2 LCD.

    Schematic & Board design

    I have design Atmega 328p board.The detailed description of schematic and board design is explain in input week work.

    Interfacing Output Board - Atmega 328p microcontroller - Sensor


    Install the LCD display Libraries in Arduino IDE

    After interfacing microcontroller board with I2C 16 x 2 LCD module next step is to download Liquid crystal I2C library.Please follow the below steps:

  • Remember: Before you install new library make sure your arduino IDE is not having liquid crustal I2C library.If you are having the library then delete it.Keep only one liquid crystal I2C libary.
  • Step 1.First download Liquid crystal I2C library
  • Step 2.Go to Arduino IDE
  • Step 3.Go to sketch -> Include Library -> file
  • Step 4.Check the install library
  • Programming

    To start programming part that you wish to upload you need to follow 3 steps procedure which i mentioned below.

    Step1. Write a scanner program

    As i used I2C module along with 16 X 2 LCD display first you need to find out address of I2C with 16 x 2 module.For that i used I2C scanner program to determine the address and also it is connected or not.So please refer the following code that scan the the I2C-bus for devices.If a device is found, it is reported to the Arduino serial monitor.Refer from


    // This sketch tests the standard 7-bit addresses
    // Devices with higher bit address might not be seen properly.
    #include <Wire.h>
    void setup()
      while (!Serial);             // Leonardo: wait for serial monitor
      Serial.println("\nI2C Scanner");
    void loop()
      byte error, address;
      int nDevices;
      nDevices = 0;
      for(address = 1; address < 127; address++ )
        // The i2c_scanner uses the return value of
        // the Write.endTransmisstion to see if
        // a device did acknowledge to the address.
        error = Wire.endTransmission();
        if (error == 0)
          Serial.print("I2C device found at address 0x");
          if (address<16)
          Serial.println("  !");
        else if (error==4)
          Serial.print("Unknown error at address 0x");
          if (address<16)
      if (nDevices == 0)
        Serial.println("No I2C devices found\n");
      delay(5000);           // wait 5 seconds for next scan
  • Upload the above code into the your microcontroller board
  • The found address will be seen on serial monitor
  • I2C Device is found as address 0x27
  • Used this address in your LCD program
  • Step 2.Program to Display LM 35 sensor data to LCD display (This code will be diferent for you)

    #include <Wire.h>
    #include <LCD.h>
    #include <LiquidCrystal_I2C.h>
    LiquidCrystal_I2C  lcd(0x27,2,1,0,4,5,6,7); // 0x27 is the I2C bus address for an unmodified backpack
    const int sensor=PC2; // Assigning analog pin A1 to variable 'sensor'
    float tempc;  //variable to store temperature in degree Celsius
    float tempf;  //variable to store temperature in Fahreinheit 
    float vout;  //temporary variable to hold sensor reading
    void setup()
    pinMode(sensor,INPUT); // Configuring pin A1 as input
    void loop() 
    tempc=vout; // Storing value in Degree Celsius
    tempf=(vout*1.8)+32; // Converting to Fahrenheit 
    lcd.print("in DegreeC= ");
    lcd.print("in Fahrenheit=");
    delay(1000); //Delay of 1 second for ease of viewing in serial monitor

    Test the board

    Hero Shot

    The power consumed by the 16 x 2 LCD display was about 25mW.

    Learning outcomes

  • First i identified several types of output devices from Neil documents
  • Understand the function of them such as 16 X 2 display doesnt have on board SDA and SCL pins for I2C communication but on the other hand OLED dispaly having on board SDA & SCL pins
  • Understand that graphics cant be display on 16 x 2 LCD display
  • Understand the interfacing (specially pin to pins connection) between LCD display and I2C module
  • Group assignment

    As a part of group assignment week we need to calculate the power of output device.So i decided to explain about how to measure voltage and currnet.So i explain my co fab mate about the concept of voltage and currnet.

    Safety tips for multimeter:

  • Choose the right meter
  • Check the meter before used
  • Examine the test probe
  • Know the CAT rating
  • After understanding how to measure the voltage and current i decided to measure the voltage and current on my board and then try to calculate power of LCD display

  • Measuring the voltage across LCD Display
  • Measuring the current flowing through LCD display
  • To know how to calculate power please click on Group Assignment