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

In this lesson, we will use OSOYOO Bricks to build a Small Home which has a ceiling fan, a gate and an LED light. We will use IR remote to control these actuators.
When we press “1” Key in remote, the fan will rotate, press “2” Key to stop the fan.
When we press “3” Key in remote, the servo will rotate and open the gate, press “4” servo will rotate back and close gate.
When we press “5” Key in remote, the LED will turn on, press “6” Key to turn off LED.

  1. A laptop or Desktop PC which runs Windows or Mac  computer
  2. OSOYOO Magic I/O Shield for Arduino x1
  3. OSOYOO DC Motor Fan Module
  4. OSOYOO Brick IR Receiver Sensor
  5. OSOYOO Brick Servo
  6. OSOYOO Bricks
  7. Two pcs 18650 battery+Holder

Building Blocks:

Wire Connections:

Firstly, please plug Osoyoo Magic I/O shield into UNO board as following:

Secondly, Connect wires as per following picture:
Motor Fan to L1
IR receiver to D2 port
Servo to D9 port
LED to D3 port
IN1 to D12
IN2 to D11
ENA to D5

Finally, use the USB cable to connect your PC to the OSOYOO UNO board

Step 1) Download mBlock PChttps://mblock.makeblock.com/en-us/download/, select the download file as per your computer OS type:

Step 2)Download OSOYOO_UNO.mext device file from https://osoyoo.com/driver/mblock/osoyoo_uno.mext

Step 3) Run the mBlock PC software by double click the lovely Panda icon. you will see mBlock UI as following picture. Please delete the default device   CyberPi by click the cross in the red circle.

Step 4: Drag and Drop osoyoo_uno_mext file(downloaded in Step 2) to mBlock software as following:

Now you will see a new device firmware in mBlock, see following picture:

Now mBlock software and OSOYOO_UNO device firmware have been successfully installed in our PC!

Now we will show you how to use blocks to make our  Oscillating Pedestal Fan into reality.
Step 1: Click Control, then Drag and drop Forever block to programming area as following:

Step 2: Click Events,   add when Arduino Uno starts up block to the top:

Step 3: Click Control ,  drag 6 pcs of   if else block to forever loop,

Step 4: Click Operator, Add 6 pcs   equal  blocks  to if condition area, change =50 to =1,2,3,4,5,6 as following:


Step 5)
Click Sensor , then drag 6 pcs  Read IR data from Pin 2 to equal  blocks as following:

Step 6: Click Action , then add  4 action blocks as following, change servo angle to 45 and 100:

Step 7: Click Light , then add 2 light blocks as following, change pin number to 3 and 2nd block value to LOW:

Now all the programming   blocks have been completed! The final logic block structure is following:

Upload the program to Arduino

1)you need connect your Arduino board to your PC with a USB cable first. Then click the Connect button in the bottom of the mBlock software, you will see a USB window pop up,
2) select Show  all connectable device check box , then a device drop-down menu will show up,
3) select your Arduino port from device drop-down menu
4) click Connect button to  connect your PC to Arduino

5)After you PC is connected to Arduino UNO board,  please click Upload button in the bottom of your software, then the code will be uploaded to Arduino UNO board:

Now turn on the power switch in the Magic board, the Arduino will start to work.  You can use the IR remote controller to make a test:
Press 1 , the fan will rotate, press 2, the fan will stop
Press 3 , the gate will open, press 4, the gate will close
press 5, the LED will turn on, press 6 the LED will turn off