# How to Dance with Your Robot

https://cdn.shopify.com/s/files/1/0070/5901/3716/files/How_to_ba48ab32-b213-4793-9030-fa53430ba50a.png?v=1724637605

With the rapid changes in digital technology, the ways in which people and machines interact are becoming more and more diverse and intelligent. Robots are no longer just cold machines, they are gradually learning to understand and mimic human movements, and even participate in our daily entertainment activities.

With Machine Learning 2.0 functionality it is possible to capture human movements through a computer camera and program these movements to be transmitted to robots so that they can react and move accordingly.

This #How to will show how to achieve dancing with robots through simple programming and machine learning. Not only does this provide an interesting entry point for learning programming and AI, it also shows us new possibilities for future human-robot interaction. 

What does Machine Learning 2.0 do?

• Action Recognition:
Through machine learning algorithms, the system can learn and recognize different human actions. When you make specific actions in front of the camera, the system is able to compare these actions with previously trained data and recognize the actions you have made.

• Pattern Matching and Classification:
The machine learning model learns to classify the input action data into different action categories during the training process. This allows the robot to accurately categorize a particular action into a predefined action type when it is recognized.

• Mapping of actions to responses:
The machine learning model recognizes actions and associates these actions with the corresponding robot's physical responses and music playback. Whenever an action is recognised, the robot will react accordingly, e.g. move, turn, play a specific music clip, etc., based on predefined rules or patterns.

• Adaptive Learning:
If the model is able to learn continuously through a feedback mechanism, the recognition accuracy and reaction speed of the system will gradually improve as you continue to interact with the robot. This means that the robot will mimic your movements more and more accurately and react more naturally.

https://cdn.shopify.com/s/files/1/0070/5901/3716/files/11_c9264452-cbee-4f17-9bf7-2e4ee005f798.png?v=1724638957

How to make robots dance together

Step1:Preparation

  • An assembled mBot 2 cart
  • Type C cable*1
  • A computer with internet access

After assembling the mBot2, use the data cable to connect the mBot2 to your computer, open the Wise Programming Tool (desktop, web, mobile), connect to the mBot2, and switch to upload mode.

https://cdn.shopify.com/s/files/1/0070/5901/3716/files/img_v3_02du_f01c2836-368f-4256-a8e8-608d5d383b8g.jpg?v=1724655894


Open mBlock

  • Visit the mBlock website: https://mblock.cc/
  • Click【Code with Block】to open the editor

Step 2: Machine learning

Substep 2.1: Add Extension

https://cdn.shopify.com/s/files/1/0070/5901/3716/files/1_9d158996-6f13-405c-9662-7ca13ce8c726.png?v=1724655100
  • Click on【extension】in 【Sprites
  • Download and add Machine Learning 2.0
  • Create/Manage model in 【Machine learning

Substep 2.2: Training model

https://cdn.shopify.com/s/files/1/0070/5901/3716/files/12_76cce962-5a91-4577-ae5f-c90881b0532a.png?v=1724639669
  • Create a new 【Pose project】 project
  • And then the first thing we need to do is add an audio sample of the background noise
https://cdn.shopify.com/s/files/1/0070/5901/3716/files/2_f50550c9-e52d-43cd-9d24-de078667d385.png?v=1724639818
  • Click 【Webcam】 to start capturing
  • Click 【Long press to collect】 to add image samples

Add more image samples from different angles or magnitudes to be more accurate in recognition.


Capture and record the recognizable actions of the corresponding notes in the way described above.

https://cdn.shopify.com/s/files/1/0070/5901/3716/files/3_881a4d69-fa8b-4d03-b5b1-f1087e6988d5.png?v=1724639982


After all the recordings are finished, click 【Train model】 to start training the model

  • After training, use the model

Step 3: Built-in program

https://cdn.shopify.com/s/files/1/0070/5901/3716/files/4_0035fd7c-89d6-49a4-b347-0d6f5dfd931d.png?v=1724640098
  • Start building the program block in 【Sprites
https://cdn.shopify.com/s/files/1/0070/5901/3716/files/5_2f0d904b-c929-4762-a4b0-15a96e2c41ef.png?v=1724640142

Start by creating a hat block

  • Then drag in the trained recognition block
  • Repeat execution: send an upload pattern message with the recognition results


Once built, the webcam captures human body movements and sends signals back to the robot via the mBlock to make it act accordingly.

https://cdn.shopify.com/s/files/1/0070/5901/3716/files/13_7984c910-c646-4ba2-9760-4b83ddfc15bd.png?v=1724640475
  • Select 【Devices】 to start programming
  • Add 【Upload Mode Broadcast
  • Select 【Upload
  • Creating hat blocks for program building

https://cdn.shopify.com/s/files/1/0070/5901/3716/files/6_23df1890-587d-4efc-ad4a-83139b648446.png?v=1724659619
  • After creating the hat block, set the size of volume and audio speed first
  • Then set the decision condition: upload mode information = duo
  • Adding music blocks and action blocks to conditional blocks

https://cdn.shopify.com/s/files/1/0070/5901/3716/files/7_5560d212-61be-43b2-9b80-05568e90023d.png?v=1724640713
  • Make the modules corresponding to the different notes in the same way

After this step, click 【Upload Code】, wait for the upload to be successful, and you'll be able to dance with a robot!

https://cdn.shopify.com/s/files/1/0070/5901/3716/files/8_8208eaba-a470-4708-b628-b1ea04308941.png?v=1724640809

Full Program & Download

Click to download

https://cdn.shopify.com/s/files/1/0070/5901/3716/files/9_fe481677-08b1-408e-a3f1-aa2a1034a556.png?v=1724640834https://cdn.shopify.com/s/files/1/0070/5901/3716/files/10_6f236350-bdc1-42d6-9c89-47f0882803d5.png?v=1724640883
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
learn block based coding and python
Easy to Teach Robotics Building
STEM Education
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
coding robot for multiple ways to connect
powerful robot kit
robotics and coding tutorial for kids
robotics and coding tutorial for kids
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
learn block based coding and python
Easy to Teach Robotics Building
STEM Education
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
coding robot for multiple ways to connect
powerful robot kit
robotics and coding tutorial for kids
robotics and coding tutorial for kids
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning
Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning

Makeblock mBot2: STEM Education Coding Robot Kit for AI Learning

$144.00
View Details

Related Articles

# How to DIY bookmarks?
Mar 27, 2024
by
HowY

# How to DIY bookmarks?