MoreAboutServo

From Interaction Station Wiki
Revision as of 13:07, 11 June 2015 by Beam (talk | contribs) (Created page with "The servomotor can normally only rotate a certain number of degrees ("normally", because you can hack it). The servo motor is used for instance for steering a car, not for dri...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The servomotor can normally only rotate a certain number of degrees ("normally", because you can hack it). The servo motor is used for instance for steering a car, not for driving. You can indicate the position of the servo motor lever.

The servomotor rotates, so the first movement is a circle. With some extra arms and mechanics you can change this into linear (horizontal, vertical) movement. Pushing can be done with 2 servomotors.

Getting one servo motor rotating is easy with an Arduino and this basic script (inside the Arduino Examples):
[1] But several features occur when you start using more or try combining servo motors with other ATmega328 possiblities.

Pictures
Servo motor, small and big:

Ser1.jpg


Ser2.jpg
You can extend the arm, not too much though, depending on the force required.

Servo motor combination as a pusher, flat and rounded for on shoulder (and even more rounded)
Servo push.jpg Servo pusher2.jpg

Design considerations
Servo motors pushers on a shoulder (project Exaltation of Jasna Rokegem):
Sp1.jpg

Scripting considerations1
In the script you have to use a library. This is a piece of code which is hidden from your own script. If you use this isolated it will function fine. But for instnace you cannot combine it with this library SoftwareSerial. These two libraries use the same functions (the timer) and will interfere with each other. What kind of situation this will be a problem? Say you want to have a bluetooth connection, this uses the Serial TX and RX. So opening Serial Window won't work. So you connect using a Softwareserial, which is also Serial, but on other PIN's than 0 and 1. Then you add a servo motor.
How to solve this?
The servomotor is needed, so teh solution is not using SoftwareSerial. If you want debugging information you could switch to an LCD screen or another wireless connection, eg RF12.

(This problem occured in th coding for project "Ex-standing Waves" of Jasna Rokegem.
Scripting considerations1
When you attach more servo's it is best not to have all servo's running at the same time. So after every servo.write(pos) it is smart to insert a small delay, say delay(15). While for the eye all is moving, for the electronics there is just one servo moving at the same time.

Power considerations
You have to realize that servomotors use a lot of energy, electrical power. The Arduino can easily handle one, but two are already at the limit of the power the USB can provide. So you add batteries, and power the servo's directly using the battery. Then you get the problem that the micorcontroller restarts when the servo starts. This is because the servo is usiing a lot of energy starting up and the Voltage of the batteries suddenly drops.
Two solutions (which have to be used both...). Adding a big capacitor, this works as a buffer for sudden drops in Voltage. But in the end you have to add a battery for the microcontroller. Giving both microcontroller and the servo's their own power source, only connecting the GND's will solve the problem.

In this picture you can discover the 4 servo motors, the battery pack for the servo's, and the lipo battery for the micorcontroller. This board has a RF12 transceiver for getting wireless commands, or send signals to other silhouets. And also there is a BlueSMiRf board [2] (red bottom) for connecting to the Mindwave:

Exaltation technology.jpg
Electronics for fashion project "Ex-standing Waves" of Jasna Rokegem. Four servomotors in two pusher combinations.
Of course this is not enough for a student :-), why not 8 servo motors?
How many servomotors can my project have?
The servomotor uses a so called PWM PIN. That is a Pulse Width Modulation PIN. On the Arduino there are 6 PWM PIN's [3]. So you can attach 6 servomotors - if properly powered!. But of course a student wants 8.
The solution was using the Teensy3.1, (or Teensy LC). Yjese boards have a lot of PWM PIN's. Disadvantage is that these boards run on 3V. The Teensy3.1 functioned perfectly until ... by accident or something ... probably there was a 5V somewhere ... the Teensy3 was damaged.
See movie where the Teensy3.1 plays with 8 small blue servo's.[4].