Bitbloq II: Sensors

Have you seen how easy it is to program with Bitbloq? Do you want to program Zowi even more? Keep reading to find out how to make smart programs!

Bitbloq 2: Programando Sensores

Until now, we have only programmed direct orders to Zowi, but how can we tell him to dance the moonwalk whenever you put your hand in front of his eyes? Find out in this project!

Sensors and actuators

You’re bound to have heard the word sensors, but do you know what it means? Robots have 4 types of components:

  1. The circuit board: stores the program and controls the other components.
  2. The battery or power source to supply energy to the other components.
  3. Actuators: components which perform actions, such as moving, making faces, or making sounds.
  4. Sensors: components which gather information. They are like the robot’s senses.

    Zowi has two sensors:

    – Its eyes, which are a digital ultrasound sensor, capable of detecting distances between Zowi and an obstacle.
    – Its ears, which take the form of a microphone.
Robot: Placa, sensores y actuadores

 

Experiment: Smart eyes

In the Bitbloq I project we only programmed actuators, but we will now use sensors, Zowi’s eyes, to be exact. Go to Bitbloq, connect Zowi and turn it on, and…

  1. Choose Robot Zowi in the hardware tab
  2. Go to the software tab
  3. Look for the block “If…run” which is in the “Control” tab
  4. Drag it to the (Loop)
  5. Now look for the “Zowi, measure distance” block and put it in the “If…run” block
  6. Next, fill the gap with a “number” block which you will find in the “Mathematics” tab
  7. Change the number of the block by clicking it and entering “10”
  8. Click the = symbol and change it to <
  9. Now look for the emotion block you want and put it in the “If…run” block
  10. End by connecting your Zowi (turned on) to the computer using the cable, and hitting the load button.

 

SUMMARY: We have just created a program to produce an emotion every time Zowi measures a distance of less than 10 cm.

 

The “If…run” block is a special block which performs an action whenever a certain condition is present.

The “<” symbol means “less than”, and the “>” symbol means “greater than”.

The “Zowi, measure distance” block is one of Zowi’s sensor blocks. These blocks give the circuit board a number depending on what has been measured. This specific block tells the board the number of centimetres between Zowi and an obstacle.

zowi_US_distance

The “Zowi, measure distance < 10” block is one of Zowi’s sensor blocks. These blocks give the circuit board a number depending on what has been measured. This block in particular works as follows:

 

Did you know?

There are countless types of sensors: to detect colours, temperature, light, and so on. They all return numbers to the circuit board. Basically, they are very similar to Zowi’s sensors.