Control a radio-controlled vehicle using a smart phone’s acceleration sensor [block program].

Make things

The AI Robot Kit can be operated by using the acceleration sensor built into the smartphone.

Materials

※This article is an example of a fabrication using the AI Robot Kit.

  • AI Robot Kit
  • power supply
  • Smartphones with accelerometers
    (The accelerometer is a sensor that can measure gravity and sense the orientation of the smartphone, and is built into many smartphones from the beginning.)

How to make

Follow the guide to assemble the robot.

Program

In the block of execution all the way from line 4 onwards, it is constantly measuring the angle of the smartphone itself with the smartphone’s accelerometer. If you don’t use a block of execution all the time, the program will end after only one measurement of the smartphone’s movement.

All the way inside the execution, it moves the robot forward if the smartphone’s screen side is facing the sky, backward if it’s facing the ground, and gives instructions to stop otherwise.

If you don’t give a stop instruction, be careful because once it starts to move, it will continue to move even if you quit the program.

With just this one program, you can now control the radio-controlled car on your smartphone.