Activity No. 4: Controlling a servomotor (Starter kit Vittascience)

Setting the servomotor in motion with the NUCLEO-L476 board.

Functioning of the servomotor

The servomotor is a module that converts an electrical signal into mechanical action. It consists of a small motor and cogwheels. 
This Grove module is a so-called angular servomotor, that is to say that it is capable of rotating the rudder according to an angle defined in degrees. The potentiometer provides feedback on the value sent by the program: from 0 to 180° angle. 


zoom-servomoteur-FR

Assembly of components

To operate this servomotor using the NUCLEO-L476RG board, the following connection must be made: 
- Connect the Shield Grove to the connectors on the board. 
- Connect, using the Grove cable, the servomotor to one of the available ports. We will choose port D6.
- Fix the plastic cross (called spreader bar) on the top of the servomotor.

servomoteur-EN

Be careful to respect the direction of connection of the Grove cable (4 wires in 1 with polarizing slot).

Programming

Let's get to the programming now! 

We are going to use the block: "[Servomotor] control the angle at ...° on pin D6", available in the Actuators of the block locker.

servo-en

Use the following interface to program the module: 

Once the program has been created, it must be copied onto the card. To do this, you must use the "Upload" button (see Activity 0: Getting started with the board)

Exercise: opening a hatch

In this part, we suggest that you rotate the servomotor to open a hatch . 
Many everyday objects use servomotors: vending machine for drinks or croquettes, opening of agricultural greenhouses, etc.

Here is the program to create so that it runs continuously: 
- Control the angle of the servomotor at 90°
- Wait 10 seconds
- Check the angle of the servomotor at 90°
- Wait 5 seconds

The blocks are already available on the work area. Now it's up to you: 

Launch the simulator to check that your program is running correctly or download it to the card. 

You succeeded ? Perfect, you now know how to program a servo motor using your NUCLEO-L476RG board! 
Discover the other activities of the Starter kit by clicking on the icons below.
sol-servo-en

Licenza d'uso

Licence Creative Commons

Questa risorsa è resa disponibile secondo i termini della Creative Commons Attribution License - Condivisione alle stesse condizioni 2.0 France

Nessuno ha ancora commentato.