In this lesson, we use OSOYOO mini bricks to make a tower crane. (Note: The following construction models are for reference only and are subject to actual construction)
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.
PDF tutorial :https://osoyoo.com/picture/Block_kit/lesson5/lesson5.pdf
Connect the IR receiver module to D2 port, plug arm motor to L1 port, plug crane cable servo to D9 as following:
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) If you haven’t installed mBlock software in your PC, please read Lesson 1, download and install the software.
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 the 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 turn the above idea into reality.
Step 1: Click Events, add when Arduino Uno starts up block to programming area.
Step 2:Click Action, drag set servo pin 9 Angle as 90 block twice and change angle to 0 and 180 as following:
Step 3: Click Control, drag wait 1 seconds block twice block as following:
Step 4:Click Control, then drag and drop Forever block under wait 1 seconds block as following:
Step 5:Click Control, drag if-then block to forever loop as following:
Step 6: Click Operation, drag X =50 block on the placeholder of the if-then block, and change 50 to 85 as following:
Step 7: Click Sensor, drag Read IR data from Pin 2 block on the first placeholder of the X =85 block as following:
Step 8: Click Action, drag set servo pin 9 Angle as 90 under the if-then block, and change 90 to 180 as following:
Step 9 :Click Control, then drag wait 1 seconds block, and change 1 to 0.01 as the following:
Step 10: Repeat Step 5 ~ Step 8, you will get it as following:
then change the data as following:
Step 11:Click Control, drag if-then block; Click Operation, drag X =50 block;Click Sensor, drag Read IR date from Pin 2 block as following:
then change the data as following:
Step12 :Click Action, then drag Backward Left Speed 100 Right Speed 100 block, and change 100 to 0 and 25 as following:
Step13:Click Control, drag wait 1 seconds block and change 1 to 0.1; Click Action, drag Stop Moving as following:
Step14: Repeat Step 11 ~ Step 13 , you will get it as following:
then change the data as following:
Now we have completed the block programming. The final blocks look like the following:
Upload the program to OSOYOO basic board.
1)you need to 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 port from device drop-down menu
4) click Connect button to connect your PC to OSOYOO basic board.
5)After your PC is connected to OSOYOO basic board, please click Upload button in the bottom of your software, then the code will be uploaded to OSOYOO basic board:
About IR controller button:
OK button 79
Up button 85
Left button 76
Right button 82
* button 42
# button 35
0 button 0
1 button 1
2 button 2
3 button 3
4 button 4
5 button 5
6 button 6
7 button 7
8 button 8
Note:
1) Please try to align the transmitter port of the IR remote control with the IR receiver head as the picture in the attachment.
2) Please press remote control gently and at regular intervals.
1)When you press ◄ key in IR controller, the crane arm will rotate to left(clockwise), when you press ► key, the crane arm will rotate to right(counter-clockwise).
2) When you press ▲ key, the cable servo will drive the cable up, if you press ▼ key, the cable servo will drop the cable down.
(Note: The following construction models are for reference only and are subject to actual construction)
No. | Picture | Device | Qty. | Link |
1 | OSOYOO Basic R3 Board para Arduino | 1 | Click here to buy | |
2 | OSOYOO Magic I/O Shield V2.0 para Arduino | 1 | Click here to buy | |
3 | Módulo detector ultrasónico OSOYOO | 1 | Click here to buy | |
4 | Módulo receptor de infrarrojos OSOYOO | 1 | Click here to buy | |
5 | Módulo de botón rojo OSOYOO | 1 | Click here to buy | |
6 | control remoto por infrarrojos | 1 | Click here to buy | |
7 | Soporte de batería de 9V | 1 | Click here to buy | |
8 | Batería de 9V | 1 | Click here to buy | |
9 | Servo | 1 | Click here to buy | |
10 | Motor | 1 | Click here to buy | |
11 | Placa acrílica para Arduino UNO | 1 | Click here to buy | |
12 | Acrylic plate for 9V battery case | 1 | Click here to buy | |
13 | Soporte de sensor ultrasónico OSOYOO | 1 | Click here to buy | |
14 | 3 pin 10cm PnP cable | 1 | Click here to buy | |
15 | 3 pin 20cm PnP cable | 1 | Click here to buy | |
16 | 4 pin 20cm PnP cable | 1 | Click here to buy | |
17 | B117 | 4 | Click here to buy | |
18 | B115 | 15 | Click here to buy | |
19 | B113 | 10 | Click here to buy | |
20 | B111 | 10 | Click here to buy | |
21 | B109 | 10 | Click here to buy | |
22 | B107 | 4 | Click here to buy | |
23 | B105 | 12 | Click here to buy | |
24 | B103 | 12 | Click here to buy | |
25 | T040 | 6 | Click here to buy | |
26 | T024 | 4 | Click here to buy | |
27 | T016 | 4 | Click here to buy | |
28 | L024 | 14 | Click here to buy | |
29 | LT33 | 8 | Click here to buy | |
30 | L035 | 12 | Click here to buy | |
31 | X044 | 20 | Click here to buy | |
32 | F057 | 26 | Click here to buy | |
33 | T033 | 8 | Click here to buy | |
34 | PS11 | 40 | Click here to buy | |
35 | P021 | 60 | Click here to buy | |
36 | P011 | 160 | Click here to buy | |
37 | Z005 | 30 | Click here to buy | |
38 | Z010 | 16 | Click here to buy | |
39 | Z101 | 12 | Click here to buy | |
40 | Z1S1 | 8 | Click here to buy | |
41 | A024 | 8 | Click here to buy | |
42 | A013 | 2 | Click here to buy | |
43 | A050 | 12 | Click here to buy | |
44 | A05S | 6 | Click here to buy | |
45 | A080 | 4 | Click here to buy |
DownLoad Url osoyoo.com