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.

In this project, we will show how to  program   Arduino Uno board, DHT11 sensor and 1602 I2C LCD module  and make them work to together to display environment temperature and humidity.

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

Then connect the modules to the ports of the Magic I/O shield (please move the switch on the board to 5V) with a 4-pin PNP cable and a 3-pin PNP cable as below:

I2C LCD 1602 Display – I2C

DHT11 – D3

More information about I2C LCD 1602 Display, please see Lesson14.

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

After above operations are completed, connect the Arduino board 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:

Add the I2C 1602 LCD block and type the corresponding I2C address on it:

  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;
  5. Click “Monitor” block, drag the “LCD mylcd clear” under “setup LCD” block, fit the two blocks;
  6. Click “Monitor” block, drag the “LCD mylcd print line” under “LCD mylcd clear” block, fit the two blocks;
  7. For “LCD mylcd print line” block, edit “print line1” to “Humidity & temp”.

  1. Click “Control” block;
  2. Drag the “Delay” under “LCD mylcd print line” block, fit the two blocks and edit the parameter to “3000”;

Then right click to duplicate the last three blocks:

Display the temperature and humidity data on the i2c LCD.

  1. Click “Monitor” block;
  2. Drag “LCD mylcd clear” to the blank space;
  3. Click “Control” block;
  4. Drag the “Delay” under “LCD mylcd Clear” block, fit the two blocks and edit the parameter to “500”;
  5. Click “Monitor” block;
  6. Drag the “LCD mylcd row” under “Delay” block, fit the two blocks.

Then right click to duplicate the “LCD mylcd row” block five times, and edit the rows to “1 1 1 2 2 2”, columns to “1 10 15 1 10 15”.

Please edit the first text after “print” to “Temp : “, the third text to “C”, the fourth text to “Humidity : “, the sixth text to “%”.

Right click the second and fifth text block after “print” to delete the blocks:

  1. Click “Sensor” block;
  2. Drag the “DHT11 Pin” to fit the deleted block after “print” as the picture shows;

Edit the DHT11 Pin to “3“, and edit the second DHT11 parameter to “getHumidity“.

  1. Click “Control” block;
  2. Drag the “Delay” under “LCD mylcd row” block, fit the two blocks and edit the parameter to “2000”.

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 Arduino board 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 Arduino board and re-open the menu; the entry that disappears should be the Arduino board. 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!’.

how_to_play.png (1150×56)

A few seconds after the upload finishes, you should now see the value of current humidity and temperature displayed on the LCD.