What is a mini servo?
|Don´t be fooled by its size! You will love these little tykes!
A mini servo is a small motor which can rotate between 0 and 180 degrees, or the equivalent of half of a circumference. In many of the inventions and activities we offer, mini servos are used to carry out a multitude of actions, from controlling the clamps of the beetle printbot to controlling the fantastic dancing hedgehogs.
|The interesting thing with mini servos is that we can decide the position or angle that they move. We will now give a couple of examples so that you learn to use it.
Let´s get to work!You will need:
Got everything? Let´s get started:
How to move a mini servo to angles of 0, 45, 90, 135 and 180 degrees
It sounds pretty complicated, but it really isn´t! Moving the mini servo to your desired angle is remarkably simple, as we will see! The first thing is to connect the mini servo to digital pin 10.
Once the programming is done, we will need to go to the bitbloq servos tab and select the first of its blocks, which gives us the option of writing an angle between 0 and 180 degrees.
As we said before, first we want the servo to move to the 0º angle to 180º, then to 45º, 90º and 135º. The program will look like this:
The program repeats the same block in order to move the mini servo to each angle. Remember that you must select an angle value between 0 and 180 degrees, otherwise the servo will always rotate either to 0º or 180º. We have left a pause of 1000 ms (1 second) between each command so that the servo has time to reach the desired angle.
It´s advisable to put one of the plastic heads on the mini servo, otherwise it will be difficult to see how it moves to each position.
How to create a light meter with the light sensor and the mini servo
In this exercise, we are going to vary the angle of the mini servo depending on the value given by the light sensor, meaning that we will indicate the intensity of the light by moving the angle of the mini servo. To do this, you can place a head on the mini servo which serves as a needle. Now let´s measure the light!
You will need to connect the components like this:
Wait a second! Before you go to the bottom of the screen to see how it´s done… have a go yourself! You already know to handle the light sensor, to map its values and to control a mini servo, so don´t look until you have the solution! Remember that the light sensor gives you values between 0 and 500.
Managed it? For sure, you will have done something that looks like this:
As the light sensor gives values between 0 and 500, and mini servo can only move between 0 and 180 degrees, it´s important to convert those values and map them. Once you have mapped them, we can directly use the variable that contains them, variable, to control the mini servo and indicate the amount of light received by the sensor in analogue form.
On seeing these examples in movement, you realise that… you have the power! You can make the mini servo move to the exact position that you want at each moment, and if you add this to other mechanisms… The possibilities are infinite!