Table of Contents

Build a Smartphone-Controlled Humanoid Robot with PictoBlox

Smartphone-Controlled-Bipedal-robot
Project Description

Introduction

We’ve made a humanoid bipedal robot and controlled it using the keys of a computer keyboard. Now, it’s time to take it a step further and transform it into something better – a Smartphone controlled humanoid bipedal robot! Everything about this humanoid robot’s the same except for the fact that instead of keyboard keys, we’re going to control its movements and make it dance to a Christmas carol (Christmas is coming!) using the buttons of the Gamepad module of Dabble, an intelligent project interaction and Bluetooth controller Smartphone app. You can download it for Android from HERE and for ioS from HERE. And write it’s code in PictoBlox. Which you can download from HERE.

Ready? Set. Go!

All about Humanoid Robot

In one of the project, we have already assembled the entire humanoid bipedal robot with detailed instructions, connected it to the brain, calibrated it using PictoBlox- our graphical programming software based on Scratch blocks.

Normal Eyes

Connection of Smartphone Controlled Humanoid Robot

As we need to control it using a Smartphone, insert the HC-05 Bluetooth Module or the Bluetooth Module of your choice into the headers provided into the evive.Smartphone Controlled Humanoid Robot

The rest of the connections of the humanoid are the same, which can be found here.

Writing the Code

We are going to write the script in PictoBlox.

  1. First, connect the robot to your computer using a USB Cable.
  2. Next, select evive as your board and choose the appropriate serial port.
  3. Then, Switch to upload mode.
  4. Now, to create the script, we must add the humanoid robot extension. Click on the Add Extension and select the Humanoid Robot from the list.

Let’s begin writing the script.

We need to make a few custom blocks for our humanoid robot. They are initialization, default to make it move, and two special blocks to make the robot dance namely dance 1, and dance 2.

Initialization Block

Under this custom block, we’ll add the blocks for defining the PWM pins of all the servo motors of the arms and legs to which they are connected.

And initialize both the left and the right LED matrix by defining their Din, CS, CLK pins.Initializaation block

evive Notes Icon
While using the Humanoid Robot for the first time, calibrate all 8 servos: two for shoulders, two for the hands, two for the legs, and two for the feet. Remove the errors, if any. You can find the method of how to calibrate from here.

Default Block

This block sets the default action for our robot. We’ll call the default block when none of the “if” conditions in the main script are satisfied.

Set the position for the leg(Home for the leg) and the arm(as Hands down) and will make the eyes blink.Default block

evive Notes Icon
You can set the home position according to your choice.

Custom Dance Blocks

Here, we will define custom dance steps for hands and legs steps we need our robot to follow.

Under the dance 1 block, we’ll write the script to make the eyes blink, make the robot do a tiptoe swing and set Dance 1 as the pre-defined hand action.

Under the dance 2 block, along with making the eyes blink, we will make our robot shake a leg to the beats and do the dance 3 actions.

Main Script

Here we’ll write the actions that the robot will follow upon pressing the specified button of Gamepad.

evive Notes Icon
You can find the functionality of each and every block of the humanoid robot extension from here.
  1. First, set the Bluetooth baud rate and call the initialization block.
  2. Next, add a forever block to keep the code running continuously.
  3. Now, let’s check for the inputs from the gamepad module in Dabble. 
  4. If up is pressed, display circular eyes on the LED matrices and move the humanoid forward with normal speed and moving size of 25.
  5. Next, if down is pressed, the humanoid will have starry eyes and move backwards with normal speed and moving size of 25.
  6. If left is pressed, it will look left and moonwalk toward its left with normal speed.
  7. If the right is pressed, it will look right and turn it right with normal speed and moving size of 25.
  8. On pressing the triangle, it will turn into an angry bot and flap its hands using fly hand action.
  9. On pressing the circle, its eyes will turn into hearts and will do the right hand-shake.
  10. If the cross is pressed, the humanoid will have dead eyes and put its hands up as if caught red-handed!
  11. On pressing the square, the humanoid will have eyes with glasses and we’ll give a hi-fi with its right-hand. Ain’t he the coolest of bots!
  12. Next, on pressing the start button, the humanoid will do dance sequence 1.
  13. And finally, on pressing the select button, the humanoid will do a dance sequence 2.
  14. If none of the conditions is true, then we will execute the default block and wait for the inputs.
  15. With this, our script is complete.Smartphone Controlled Humanoid Robot Code

Upload it to evive by pressing upload code.

You can add as many features, make the humanoid move and express feelings in as many ways as you want it to.

Converting it to a Christmas Carol Singing Santa.

You can also turn your humanoid into Santa and play any tune you want using the Dabble’s Music Module. Here, we’ll make our ‘Santanoid’ play the famous Christmas Carol. We need to do complete the two steps:

  1. Write the script in PictoBlox.
    1. The entire script for the Santanoid is the same as the humanoid bipedal robot which we wrote in the above step. The only change we need to do is Dance 1 and Dance 2 custom blocks.Santa Singing Carol Code
  2. Add music into the Music Module of Dabble. Find out how to add the music here.

Conclusion

With this, your Smartphone controlled humanoid robot is now ready!

Project Downloads - Code and Files

Circuit Diagram

Circuit Diagram DescriptionCircuit Diagram Fritzing Diagram

As we need to control it using a Smartphone, insert the HC-05 Bluetooth Module or the Bluetooth Module of your choice into the headers provided into the evive.

The rest of the connections of the humanoid are the same, which can be found here.

Explore Related Projects by STEMpedia

This project will show you how to make an expressive and energetic humanoid bipedal robot.

Explore Community Projects