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.
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.
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.
- First, connect the robot to your computer using a USB Cable.
- Next, select evive as your board and choose the appropriate serial port.
- Then, Switch to upload mode.
- 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.
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.
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.
- First, set the Bluetooth baud rate and call the initialization block.
- Next, add a forever block to keep the code running continuously.
- Now, let’s check for the inputs from the gamepad module in Dabble.
- If up is pressed, display circular eyes on the LED matrices and move the humanoid forward with normal speed and moving size of 25.
- Next, if down is pressed, the humanoid will have starry eyes and move backwards with normal speed and moving size of 25.
- If left is pressed, it will look left and moonwalk toward its left with normal speed.
- If the right is pressed, it will look right and turn it right with normal speed and moving size of 25.
- On pressing the triangle, it will turn into an angry bot and flap its hands using fly hand action.
- On pressing the circle, its eyes will turn into hearts and will do the right hand-shake.
- If the cross is pressed, the humanoid will have dead eyes and put its hands up as if caught red-handed!
- 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!
- Next, on pressing the start button, the humanoid will do dance sequence 1.
- And finally, on pressing the select button, the humanoid will do a dance sequence 2.
- If none of the conditions is true, then we will execute the default block and wait for the inputs.
- With this, our script is complete.
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:
- Write the script in PictoBlox.
- 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!