Introduction: Elevator: Building Block + Program With Arduino

About: Osoyoo brand products are mainly focused on STEM education.User experience and customer feeling are always our first priority. Our goal is to create the best designed product to help students and hobbyist to e…

The OSOYOO building bricks is mechanically compatible with leading building bricks. In this lesson, we will use OSOYOO Bricks to build an elevator and use OSOYOO electronic sensor module blocks to control it. When you press the push button, the elevator will be up; and when release, the elevator will be down. (Note: The following construction models are for reference only and are subject to actual construction)

Tutorial Link: https://osoyoo.com/2023/01/11/osoyoo-building-block-diy-programming-kit-for-arduino-2-elevator-magic-i-o-v2-0/

Supplies

Please prepare the following parts to complete this project


You can buy this OSOYOO Building Block DIY Programming Kit for Arduino from: https://osoyoo.store/products/building-block-graphic-robot-learning-kit-for-arduino

Facebook: https://www.facebook.com/pg/OsoyooProducts

Youtube: https://www.youtube.com/playlist?list=PLvCUFipQZCUss60yiuRT03cfeIoHedYGk

Step 1: How to Building

Before you build an elevator with blocks, please according to the Preparation before class 2: https://osoyoo.com/2021/12/01/preparation-before-class-2

Note:

1. the color of the building block is subject to the actual product, which does not affect the use.

2. The color of OSOYOO Magic I/O board does not affect the installation.

Please follow the PDF instruction to buidling blocks: http://osoyoo.com/picture/Block_kit/lesson2/lesson2.pdf

Step 2: How to Connect

Connect push button to D2 port with 3pin PnP cable, Servo to D9 port as per following picture:

Step 3: How to Code

Note: In this kit, we use mblock as programming tool, if you want to learn more about mblock, please visit preparation before class 1: https://osoyoo.com/2021/12/01/preparation-before-class-1

Step 1) Download mBlock PC from https://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 upblock to the top:

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

Step 4: Click Sensor, Add Button Pressed block to if condition area, change Pin number to 2:


Step 5) Click Action , then drag set Servo Pin block to if else block as following:

Now all the programming blocks have been completed! From above picture, the logic is pretty straight forward:

When Arduino is started, computer will enter a dead loop which will check the button status, when button is not pressed, the servo will stop at original position (in my servo 0 degree ) and elevator is in the ground , when button is pressed, the servo arm will rotate from 0 degree position to 180 degree position and the elevator is lifted to the air.

Step 6) Upload the program to OSOYOO basic board

i) Please connect your OSOYOO basic board to your PC with USB cable firstly. Then click the Connect button in the bottom of the mBlock software, you will see a USB window pop up,

ii) select Show all connectable device check box , then a device drop-down menu will show up,

iii) select your port from device drop-down menu

iv) click Connect button to connect your PC to OSOYOO basic board.

v)After you PC is connected toOSOYOO basic board, please click Upload button in the bottom of your software, then the code will be uploaded to OSOYOO basic board:


Step 4: How to Play

Now power OSOYOO basic board via USB cable, the OSOYOO basic board will start to work and elevator is in the ground. Press the button on D2, your elevator will be lifted, when you release the the button, the elevator will go back to the ground. (Note: The following construction models are for reference only and are subject to actual construction)

Attachments