sábado, 15 de abril de 2017

Using a servomotor in Snap4arduino

USING A SERVOMOTOR IN SNAP4ARDUINO

OBJECTIVES:

To know what a servomotor is and its differences with a normal motor

Understand how it works and learn to use a servomotor

Today we will learn to operate a servomotor using pushbuttons and potentiometers that we have already learned in previous lessons


WHAT IS A SERVO?

A servomotor is an electric motor, but with two special characteristics that make it very useful in many home or industrial applications, On the one hand, it allows us to maintain a position that we indicate (within a range, which can be 180 or 360 degrees), Also allows us to control the speed of rotation, we can make that before it moves to the next position wait a while.
The servos have internal gears that provide high torque and a high degree of precision (depending on the model), but they provide smaller turning speeds than ordinary DC motors.


Normally these small servos operate on 5V and the control is realized by means of a control signal PWM, in which the width the pulse indicates the angle that we wish to adopt the axis, with a working pulse between 1 ms and 2 ms and with a period Of 20 ms (50 Hz). This tells us that we can only change positions every 20 ms. This will depend on the type and brand of our servo.

What does this mean that I have said before? You will see it more clearly with this image.


Communication of the desired position is performed by the transmission of a pulsed signal with a period of 20ms. The width of the pulse determines the position of the servo.

In general, on all models:
  •          A pulse between 500-1000 us corresponds with 0º
  •          A pulse of 1500 ms corresponds with 90º (neutral point)
  •         A pulse between 2000-2500us corresponds to 180º


ASSEMBLING THE PRACTICE

Connecting a servo to Arduino is simple. The servo has three cables, two power (GND and Vcc) and one signal (Sig). The colour scheme normally follows this code:
  • ·     Brown (GND), Red (Vcc) and Orange (Sig)

However, there may be other colour codes to control the servo, here is an image with other possible codes.


The code that we will perform to see the operation of the servomotor is very simple, it is about making the position vary 5 degrees every 0.3 seconds from the position of 0 degrees, until reaching the position of 180 degrees, once reach this position It will turn in the opposite direction until it reaches the 0 degrees again, moment that will reverse the turn again and so on indefinitely.

And the assembly scheme of the practice we will perform is as follows:




And the code you should load into Snap4Arduino is as follows:



Now that you have seen the operation of the servomotor, perform this circuit:


CODING



Once you have completed the circuit, I propose these challenges:
1. As you can see, there are two buttons. These pushbuttons serve to direct the direction of rotation, each time you press the servomotor will change direction until it reaches the end point, where it will be stopped and will only start if the button is pressed in the opposite direction.


2. Change the pushbuttons by a 1KΩ potentiometer. Now the operation will be as follows:
  • <150Ω: servomotor off
  • 150 and <250Ω: servo motor rotates right and stops when it reaches 180 degrees
  • 250 and <500Ω: servomotor turns left and stops when 0 degrees
  • 500 and <750Ω: servo motor rotates right (from position 0), reaches 180 and reverses rotation, stops when it reaches 0
  • 750Ω: servomotor off
 
3. The third challenge is to add 4 LEDs to indicate the mode of operation of the previous challenge.


MORE IDEAS TO IN CLASS WITH SNAP4ARDUINO

     1. Build a mobile radar. On a servomotor mount an ultrasonic sensor HC-SR04. 

     2. To the previous mobile Radar we added a Keyes KY-008 laser module that      mounted on another servomotor will move in the same direction as the radar    and fire a laser when the sensor detects an obstacle.




















2 comentarios:

  1. I want really to tell you thanks for this most helpful information.

    touch screen

    ResponderEliminar
  2. Play Casino - Free Slot Games | Best Online Casinos for US Players
    The most popular games are 인카지노 blackjack, baccarat, roulette, 샌즈카지노 poker, and 1xbet korean craps. The best casinos offer the best casino games.

    ResponderEliminar