This is an old revision of the document!

Lab 05.Connect and use an LCD

In this project you are going to connect an LCD to your board and write a short message on it.

What you need

  • One Edison connected to \Wyliodrin;
  • One 16×2 LCD;
  • One breadboard;
  • Sixteen male-male jumper wires;
  • One potentiometer.

The Setup

The LCD has a parallel interface, meaning that the board has to manage several interface pins at once to control the display.

The first pin is the RS(Register Select) that controls where exactly in the LCD's memory you are writing data to.

There is an Enable pin that enables writing to the registers.

The third one is the R/W(Read/Write) pin that selects from reading or writing mode.

The LCD also has 8 data pins (D0 -D7). The states of these pins (high or low) are the bits that you're reading to a register when you read, or the values you are writing when you write.

There are also power supply pins (5V and GND) for powering the LCD, LED Backlight (Bklt- and Bklt+) pins that you can use to turn off and on the LED backlight and a display contrast pin (Vo) to control the display contrast.

What does 16×2 LCD mean? It means that the LCD has 16 columns and 2 rows. You place the LCD on the breadboard and connect it to the board as follows.

The first two pins on the right are the used to power up the LCD. The next four pins, the ones with green cables, are the data pins. They allow the LCD to communicate with the board. The next two pins connected by yellow cables are the control pins. There are also three pins used for contrast. Two of them are used to power on the backlight and there is one more pin directly connected to the potentiometer. This way you can control the contrast just by rotating it.

The Code

You go to the Wyliodrin Applications page and create a new application. You name it and select Streams as programming language. Once created, you click on the new application's name to open it. Start as usual with the run node. To read the value from the temperature sensor through the analog pin. Next, you need the conversion from 0-1024 values to degrees. It is the same function from the project where you first used the temperature sensor.

Now you have the temperature, what do you do with it? Let's write it on the LCD. How? Use the simple way of Visual Programming Blocks.

Add a visual node and inside it do as follows.

First of all, you need to initialise the LCD. For this you select the Peripherals/LCD/Init LCD block.

To write something, you will use the Perpherals/LCD/Print on LCD [] block. you place it below the Initblock and write the message received from the conversion function in it.

Once the project runs, you should see the temperature from your room on the LCD, however, the contrast might be to high and the text can be difficult to read. In order to modify the contrast, you just roll the rotary angle.

You run the project.


  1. Connect a distance sensor and show the values on an LCD.
    The distance sensor in the picture is connected to an Intel Gaileo Gen2 board. The wiring is the same for the Intel Edison.
  2. Connect a gas sensor to an analog pin of the board and show the values on an LCD when they go over a set value (use a slider to set it). If the values stay under this value, show a message on the LCD, There is no gas danger .
  3. Add a 7 segment to the setup. On this display you can choose to display one digit of the value received from a sensor.

    Hint In the example you can see a common anode 7 segment, which means that there is one common VCC for all of the 7 LEDs the display consists of. The segments will be alight when the value on the corresponding pins is 0, as this way the circuit is closed. If it has a common cathode, it will be connected to the ground, and the value which turns on the segments is 1.
  4. Connect 4 LEDs using a 74HC595 shift register and make them blink one by one, in order.\\
    Hint In the example, there is a 595 shift register used with 8 LEDs. You need only 4, so, when you search for the piece's datasheet, look which are the first 4 GPIO pins and use only these, starting with 0.
  5. Make a setup which works by this rules. You connect a distance sensor, a button, use a ruler and a sheet of paper.
    At one end of the ruler you put the sensor and, at a certain distance, place the paper. When you press the button, your board should receive the value from the sensor with the distance where it detects the obstacle. Send these values to a chart in the dashboard via a signal. \\When you add the chart, go in its settings and uncheck the time stamp field. After doing this, you can master not only the Y axes, but the X as well. In streams you will be able to set each one with the change node. On X you put the value of the distance on the ruler. On Y, the values sent by the sensor.
iot/labs/05.1437135248.txt.gz ยท Last modified: 2015/07/17 15:14 by madalina.tanea
CC Attribution-Share Alike 3.0 Unported Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0