{"id":520,"date":"2025-10-08T10:06:22","date_gmt":"2025-10-08T08:06:22","guid":{"rendered":"https:\/\/avlos.gr\/wpress\/?p=520"},"modified":"2025-10-15T11:54:18","modified_gmt":"2025-10-15T09:54:18","slug":"servomotor-application","status":"publish","type":"post","link":"https:\/\/avlos.gr\/wpress\/en\/servomotor-application\/","title":{"rendered":"Servomotor \u2013 Application"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Practical application<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">It&#8217;s time to see how a servomotor connects and works.<br>You will need some materials:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1. A servomotor e.g.&nbsp;MG995<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"467\" height=\"387\" src=\"https:\/\/avlos.gr\/wpress\/wp-content\/uploads\/2025\/10\/servo_5.jpg\" alt=\"\" class=\"wp-image-522\" style=\"width:290px;height:auto\" srcset=\"https:\/\/avlos.gr\/wpress\/wp-content\/uploads\/2025\/10\/servo_5.jpg 467w, https:\/\/avlos.gr\/wpress\/wp-content\/uploads\/2025\/10\/servo_5-300x249.jpg 300w\" sizes=\"auto, (max-width: 467px) 100vw, 467px\" \/><figcaption class=\"wp-element-caption\">Servo motor MG995<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a02. An Arduino UNO board or compatible<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"355\" height=\"291\" src=\"https:\/\/avlos.gr\/wpress\/wp-content\/uploads\/2025\/10\/servo_6.jpg\" alt=\"\" class=\"wp-image-523\" style=\"width:245px;height:auto\" srcset=\"https:\/\/avlos.gr\/wpress\/wp-content\/uploads\/2025\/10\/servo_6.jpg 355w, https:\/\/avlos.gr\/wpress\/wp-content\/uploads\/2025\/10\/servo_6-300x246.jpg 300w\" sizes=\"auto, (max-width: 355px) 100vw, 355px\" \/><figcaption class=\"wp-element-caption\">Arduino UNO<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a03. An empty Arduino UNO board on which the connections will be made and then fastened to the Arduino board.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"447\" height=\"351\" src=\"https:\/\/avlos.gr\/wpress\/wp-content\/uploads\/2025\/10\/servo_7.jpg\" alt=\"\" class=\"wp-image-524\" style=\"width:264px;height:auto\" srcset=\"https:\/\/avlos.gr\/wpress\/wp-content\/uploads\/2025\/10\/servo_7.jpg 447w, https:\/\/avlos.gr\/wpress\/wp-content\/uploads\/2025\/10\/servo_7-300x236.jpg 300w\" sizes=\"auto, (max-width: 447px) 100vw, 447px\" \/><figcaption class=\"wp-element-caption\">Arduino Sield<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">4. A 5-7V DC power supply to power the servomotor.<br>5. A 10K potentiometer<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You will also need some tools (soldering iron, etc.), a few meters of thin cable and a little construction experience.<br>To program and operate the system you must have the Ardouino IDE installed and have little experience with it.&nbsp;Both hardware and software are OPEN, see<br>https:\/\/en.wikipedia.org\/wiki\/Open_top_material<br>https:\/\/en.wikipedia.org\/wiki\/Open_Software<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Construction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">On the blank Arduino UNO board I make the connection circuit of the materials.&nbsp;An example of wiring can be seen at<a href=\"https:\/\/www.arduino.cc\/en\/Tutorial\/Knob\" target=\"_blank\" rel=\"noreferrer noopener\">&nbsp;https:\/\/www.arduino.cc\/en\/Tutorial\/Knob<\/a>&nbsp;in which I have made the necessary modifications.<br>In the photo below you can see the construction is finished.&nbsp;Here I use two servomotors and two potentiometers, because the construction has future use.&nbsp;The servomotors are positioned so that the movements take place in two planes perpendicular to each other.&nbsp;We will use this detail in our next construction.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">At the end of your article I have a video where you see the construction in operation.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"487\" height=\"728\" src=\"https:\/\/avlos.gr\/wpress\/wp-content\/uploads\/2025\/10\/servo_8.jpg\" alt=\"\" class=\"wp-image-525\" style=\"width:299px;height:auto\" srcset=\"https:\/\/avlos.gr\/wpress\/wp-content\/uploads\/2025\/10\/servo_8.jpg 487w, https:\/\/avlos.gr\/wpress\/wp-content\/uploads\/2025\/10\/servo_8-201x300.jpg 201w\" sizes=\"auto, (max-width: 487px) 100vw, 487px\" \/><figcaption class=\"wp-element-caption\">Construction<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Each potentiometer has three pins. The two ends are connected to the GND ground and to the 5V respectively. Depending on the rotation position of the potentiometer, the medium will have a potential between 0 and 5V. The middle pin of the potentiometer is connected to the analog input A0 of the Arduino. The values \u200b\u200bthat the program will read for input A0 will be between 0 and 1023.<br>The servomotive usually needs more power than this can be given by the power supply of the Arduino from a USB port. For this reason we use the additional power supply. The ground of this power supply will be connected to the Arduino GND. It will be good to connect a 1000\u03bcF capacitor between the ground and the positive of the power supply, which will ensure the high current requirement when starting the motor.<br>Servomotors have three cables: current, ground and signal.\u00a0The power cord is usually red and should be plugged into the 5-7V of the power supply.\u00a0The ground wire is usually black or brown and should be connected to a ground pin on the Arduino board.\u00a0The signal pin is usually yellow, orange or white and should be connected to a digital pin on the Arduino board.\u00a0In our construction it will be connected to the digital pin 4.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Programming<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The program I present to you moves two servomotors using two potentiometers as shown in the video.\u00a0The construction was done with two servomotors because it will be used in the next experiment.<br>Arduino UNO enables PWM signal generation on pins 3,5,6,9,10 and 11. We use the Servo.h library to simplify programming for PWM signal output, also in the way it handles the library producing PWM signal we can use all digital pins to generate PWM signal.<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>\/*\n\u03ad\u03bb\u03b5\u03b3\u03c7\u03bf\u03c2 \u03c4\u03b7\u03c2 \u03b8\u03ad\u03c3\u03b7\u03c2 \u03b4\u03cd\u03bf \u03c3\u03b5\u03c1\u03b2\u03bf\u03ba\u03b9\u03bd\u03b7\u03c4\u03ae\u03c1\u03c9\u03bd \u03bc\u03b5 \u03c4\u03b7 \u03c7\u03c1\u03ae\u03c3\u03b7 \u03b4\u03cd\u03bf \u03bc\u03b5\u03c4\u03b1\u03b2\u03bb\u03b7\u03c4\u03ce\u03bd \u03b1\u03bd\u03c4\u03b9\u03c3\u03c4\u03ac\u03c3\u03b5\u03c9\u03bd \u2013 \u03c0\u03bf\u03c4\u03b5\u03bd\u03c3\u03b9\u03bf\u03bc\u03ad\u03c4\u03c1\u03c9\u03bd\n\u039c\u03b1\u03bd\u03ce\u03bb\u03b7\u03c2 \u0391\u03c1\u03b9\u03c3\u03c4\u03bf\u03b2\u03bf\u03c5\u03bb\u03af\u03b4\u03b7\u03c2 10\/2021\n*\/\n\n#include &lt;Servo.h>\nServo servo1; \/\/ \u03b4\u03b7\u03bc\u03b9\u03bf\u03c5\u03c1\u03b3\u03af\u03b1 \u03b5\u03bd\u03cc\u03c2 servo object \u03b3\u03b9\u03b1 \u03c4\u03bf\u03bd \u03ad\u03bb\u03b5\u03b3\u03c7\u03bf \u03c4\u03bf\u03c5 servo\nServo servo2;\n\nint potpin1 = A0; \/\/ \u03b1\u03bd\u03b1\u03bb\u03bf\u03b3\u03b9\u03ba\u03cc pin \u03b3\u03b9\u03b1 \u03c4\u03b7 \u03c3\u03cd\u03bd\u03b4\u03b5\u03c3\u03b7 \u03c0\u03bf\u03c4\u03b5\u03bd\u03c3\u03b9\u03bf\u03bc\u03ad\u03c4\u03c1\u03bf\u03c5\nint potpin2 = A1; \/\/ \u03b1\u03bd\u03b1\u03bb\u03bf\u03b3\u03b9\u03ba\u03cc pin \u03b3\u03b9\u03b1 \u03c4\u03b7 \u03c3\u03cd\u03bd\u03b4\u03b5\u03c3\u03b7 \u03c0\u03bf\u03c4\u03b5\u03bd\u03c3\u03b9\u03bf\u03bc\u03ad\u03c4\u03c1\u03bf\u03c5\nint val1; \/\/ \u03bc\u03b5\u03c4\u03b1\u03b2\u03bb\u03b7\u03c4\u03ae \u03b3\u03b9\u03b1 \u03c4\u03b7\u03bd \u03b1\u03bd\u03ac\u03b3\u03bd\u03c9\u03c3\u03b7 \u03c4\u03b7\u03c2 \u03c4\u03b9\u03bc\u03ae\u03c2 \u03c4\u03bf\u03c5 \u03b1\u03bd\u03b1\u03bb\u03bf\u03b3\u03b9\u03ba\u03cc pin\nint val2; \/\/ \u03bc\u03b5\u03c4\u03b1\u03b2\u03bb\u03b7\u03c4\u03ae \u03b3\u03b9\u03b1 \u03c4\u03b7\u03bd \u03b1\u03bd\u03ac\u03b3\u03bd\u03c9\u03c3\u03b7 \u03c4\u03b7\u03c2 \u03c4\u03b9\u03bc\u03ae\u03c2 \u03c4\u03bf\u03c5 \u03b1\u03bd\u03b1\u03bb\u03bf\u03b3\u03b9\u03ba\u03cc pin\n\nvoid setup() {\nservo1.attach(4); \/\/ \u03ba\u03ac\u03bd\u03b5\u03b9 \u03c0\u03c1\u03bf\u03c3\u03ac\u03c1\u03c4\u03b7\u03c3\u03b7 \u03c4\u03bf\u03c5 servo \u03c3\u03c4\u03bf pin 4 \u03c4\u03bf\u03c5 servo object\nservo2.attach(5); \/\/\u03ba\u03ac\u03bd\u03b5\u03b9 \u03c0\u03c1\u03bf\u03c3\u03ac\u03c1\u03c4\u03b7\u03c3\u03b7 \u03c4\u03bf\u03c5 servo \u03c3\u03c4\u03bf pin 5 \u03c4\u03bf\u03c5 servo object\nSerial.begin(9600); \/\/\u03b1\u03c1\u03c7\u03b9\u03ba\u03bf\u03c0\u03bf\u03b9\u03b5\u03af \u03c4\u03b7 \u03c3\u03b5\u03b9\u03c1\u03b9\u03b1\u03ba\u03ae \u03b5\u03c0\u03b9\u03ba\u03bf\u03b9\u03bd\u03c9\u03bd\u03af\u03b1\n}\n\nvoid loop() {\nval1 = analogRead(potpin1); \/\/ \u03b4\u03b9\u03b1\u03b2\u03ac\u03b6\u03b5\u03b9 \u03c4\u03b7\u03bd \u03b1\u03bd\u03b1\u03bb\u03bf\u03b3\u03b9\u03ba\u03ae \u03c4\u03b9\u03bc\u03ae (\u03c4\u03b9\u03bc\u03ad\u03c2 \u03bc\u03b5\u03c4\u03b1\u03be\u03cd 0 \u03ba\u03b1\u03b9 1023)\nval2 = analogRead(potpin2); \/\/ \u03b4\u03b9\u03b1\u03b2\u03ac\u03b6\u03b5\u03b9 \u03c4\u03b7\u03bd \u03b1\u03bd\u03b1\u03bb\u03bf\u03b3\u03b9\u03ba\u03ae \u03c4\u03b9\u03bc\u03ae (\u03c4\u03b9\u03bc\u03ad\u03c2 \u03bc\u03b5\u03c4\u03b1\u03be\u03cd 0 \u03ba\u03b1\u03b9 1023)\nval1 = map(val1, 0, 1023, 0, 180); \/\/ \u03bc\u03b5\u03c4\u03b1\u03c1\u03bf\u03c0\u03ae \u03c3\u03b5 \u03ba\u03bb\u03af\u03bc\u03b1\u03ba\u03b1 \u03b3\u03b9\u03b1 \u03c4\u03bf servo (\u03c4\u03b9\u03bc\u03ad\u03c2 \u03bc\u03b5\u03c4\u03b1\u03be\u03cd 0 \u03ba\u03b1\u03b9 180)\nval2 = map(val2, 0, 1023, 0, 180); \/\/ \u03bc\u03b5\u03c4\u03b1\u03c1\u03bf\u03c0\u03ae \u03c3\u03b5 \u03ba\u03bb\u03af\u03bc\u03b1\u03ba\u03b1 \u03b3\u03b9\u03b1 \u03c4\u03bf servo (\u03c4\u03b9\u03bc\u03ad\u03c2 \u03bc\u03b5\u03c4\u03b1\u03be\u03cd 0 \u03ba\u03b1\u03b9 180)\nservo1.write(val1); \/\/ \u03c1\u03c5\u03b8\u03bc\u03af\u03b6\u03b5\u03b9 \u03c4\u03b7 \u03b8\u03ad\u03c3\u03b7 \u03c4\u03bf\u03c5 servo \u03c3\u03c4\u03b7\u03bd \u03c4\u03b9\u03bc\u03ae \u03c4\u03b7\u03c2 \u03ba\u03bb\u03af\u03bc\u03b1\u03ba\u03b1\u03c2\nservo2.write(val2); \/\/ \u03c1\u03c5\u03b8\u03bc\u03af\u03b6\u03b5\u03b9 \u03c4\u03b7 \u03b8\u03ad\u03c3\u03b7 \u03c4\u03bf\u03c5 servo \u03c3\u03c4\u03b7\u03bd \u03c4\u03b9\u03bc\u03ae \u03c4\u03b7\u03c2 \u03ba\u03bb\u03af\u03bc\u03b1\u03ba\u03b1\u03c2\n\nSerial.print(\"val1 : \");\nSerial.print(val1);\nSerial.print(\" - val2 : \");\nSerial.println(val2);\ndelay(20); \/\/ \u03c0\u03b5\u03c1\u03b9\u03bc\u03ad\u03bd\u03b5\u03b9 \u03b3\u03b9\u03b1 \u03c4\u03b7\u03bd \u03bf\u03bb\u03bf\u03ba\u03bb\u03ae\u03c1\u03c9\u03c3\u03b7 \u03c4\u03b7\u03c2 \u03ba\u03af\u03bd\u03b7\u03c3\u03b7\u03c2 \u03c4\u03bf\u03c5 servo\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The code can be downloaded here\u00a0<a href=\"https:\/\/avlos.gr\/wpress\/download\/servo\">https:\/\/avlos.gr\/wpress\/download\/servo<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the video that follows you can see the mechanism in operation&nbsp;<a href=\"https:\/\/youtu.be\/BCxv9VGqhQk\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/youtu.be\/BCxv9VGqhQk<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Practical application It&#8217;s time to see how a servomotor connects and works.You will need some materials: 1. A servomotor e.g.&nbsp;MG995 \u00a02. An Arduino UNO board or compatible \u00a03. An empty Arduino UNO board on which the connections will be made&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29,75],"tags":[73],"class_list":["post-520","post","type-post","status-publish","format-standard","hentry","category-home","category-robotics","tag-robotics"],"_links":{"self":[{"href":"https:\/\/avlos.gr\/wpress\/wp-json\/wp\/v2\/posts\/520","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/avlos.gr\/wpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/avlos.gr\/wpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/avlos.gr\/wpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/avlos.gr\/wpress\/wp-json\/wp\/v2\/comments?post=520"}],"version-history":[{"count":3,"href":"https:\/\/avlos.gr\/wpress\/wp-json\/wp\/v2\/posts\/520\/revisions"}],"predecessor-version":[{"id":527,"href":"https:\/\/avlos.gr\/wpress\/wp-json\/wp\/v2\/posts\/520\/revisions\/527"}],"wp:attachment":[{"href":"https:\/\/avlos.gr\/wpress\/wp-json\/wp\/v2\/media?parent=520"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/avlos.gr\/wpress\/wp-json\/wp\/v2\/categories?post=520"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/avlos.gr\/wpress\/wp-json\/wp\/v2\/tags?post=520"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}