Buy from US Buy from UK Buy from DE Buy from IT Buy from FR Buy from ES Buy from JP

The OSOYOO Magic I/O Shield for Arduino is a powerful board for the beginners. With this Magic board, we can  easily connect various sensors and actuators much easier than before.

When making Arduino projects, we often need to send text strings to an external LCD display. In this lesson we will show how program I2C communication protocol and how to send display text to LCD from OSOYOO Basic Board for Arduino by I2C protocol.

The integration of an LCD display greatly facilitates the interactivity of the project you are developing, allowing the user to directly read some output parameters. These values can be either a simple text or numerical values read by the sensors, such as temperature or pressure, or even the number of cycles that the Arduino is performing.

However, these displays have a small problem. When they are connected to a micro-controller (such as Arduino for example), these displays require virtually many connection PINs occupying practically almost all available IO and leaving the multiprocessor few outputs for any other devices and sensors. This problem has been solved thanks to the communication on the I2C bus.

The LCD1602 display has an integrated microchip that manages this type of communication, and then all of the input and output information are limited to only two PINs (excluding power supply). I2C is a type of serial bus developed by Philips, which uses two bidirectional lines, called SDA (Serial Data Line) and SCL (Serial Clock Line). Both must be connected via pulled-up resistors. The usage voltages are standard as 5V and 3.3V.

The blue potentiometer on the I2C LCD1602 is used to adjust the backlight  for better display.And there is a jumper on the board, if you take away this jumper , the backlight will always be off.

For the usgage of other functions, please refer to the “LiquidCrystal_I2C.h” in the sourcecode of I2C LCD library.

First, please plug Osoyoo Magic I/O shield into UNO board:

Then connect the I2C LCD 1602 Display module to the I2C port of the Magic I/O shield (please move the switch on the board to 5V) with a 4-pin PNP cable as below:

Notice: Shut off your battery or Unplug your power adapter when upload sketch code to OSOYOO Basic Board for Arduino.

After above operations are completed, connect the OSOYOO Basic Board for Arduino to your computer using the USB cable. The green power LED (labelled PWR) should go on.

Open the Graphical Programming software Mixly, iMixly is not English, you should change the language first:

You can download the code directly, then click “Open” in Mixly to choose the code you download:

Download the Code

Or you can do as following operations:

  1. Click “Control” block;
  2. Drag “Setup” to the blank space;
  3. Click “Monitor” block;
  4. Drag the “setup LCD” under “Setup” block, fit the two blocks;

  1. Click “Monitor” block;
  2. Drag the “LCD mylcd print line” block to the blank space, and edit “print line1” to “Hello”, “print line2” to “World”;
  3. Click “Control” block;
  4. Drag the “Delay” under “LCD mylcd print line” block, fit the two blocks;
  5. Click “Monitor” block;
  6. Drag the “LCD mylcd clear” under “LCD mylcd print line” block, fit the two blocks.

Then right click to duplicate the blocks, and fit them:

The whole program blocks are as following:

After above operations are completed, do as follows:

  1. Click Save after programming is done.
  2. Select the board type and serial port before uploading. For instause an UNO board, just select Arduino/Genuino Uno: if you use a Mega2560, select Arduino/Genuino Mega or Mega2560.
  3. Select the serial device of the OSOYOO Basic Board for Arduino from the COM menu. This is likely to be COM3 or higher (COM1 and COM2 are usually reserved for hardware serial ports). To find out, you can disconnect your OSOYOO Basic Board for Arduino and re-open the menu; the entry that disappears should be the OSOYOO Basic Board for Arduino. Reconnect the board and select that serial port.
  4. Next,upload the code. If the uploading fails, check and correct the code according to the prompts.
  5. Finally, the status will change to ‘Upload success!’.

A few seconds after the upload finishes, you should now see your I2C LCD1602 display the static characters: “Hello, World!”,next, the LCD will be cleared, and then the “Hello, World!” will be displayed again.