Super Easy Way to Control Servo Motor With Arduino

by RonFrtek in Circuits > Arduino

1546 Views, 4 Favorites, 0 Comments

Super Easy Way to Control Servo Motor With Arduino

maxresdefault.jpg
Visuino Control servo Motor Angle

In this tutorial we will use Servo Motor and Arduino UNO, and Visuino to control servo motor degree position using only few components thus making this project Super Simple.

Watch a demonstration video.

What You Will Need

FGRURU0K1UXJL1T.LARGE.jpg
FAQBHIUK1UXJL1R.LARGE.jpg
F8KZFL7K1UXJL1S.LARGE.jpg
FI6TDNEK1UXJL1U.LARGE.jpg

  1. Arduino UNO (or any other Arduino)
  2. Jumper wires
  3. Servo motor
  4. Visuino program: Download Visuino

The Circuit

FSVJJTIK1UXJLBE.LARGE.jpg
FUQ4GONK1UXJLBF.LARGE.jpg

  1. Connect Servo motor "Orange" pin to Arduino Digital pin[8]
  2. Connect Servo motor "Red" pin to Arduino positive pin[5V]
  3. Connect Servo motor "Brown" pin to Arduino negative pin[GND]

Start Visuino, and Select the Arduino UNO Board Type

FFR2XFGK1UXJLG8.LARGE.jpg
F8LR4HQK1UXJLG7.LARGE.jpg

To start programming the Arduino, you will need to have the Arduino IDE installed from here: https://www.arduino.cc/.

Please be aware that there are some critical bugs in Arduino IDE 1.6.6. Make sure that you install 1.6.7 or higher, otherwise this Instructable will not work! If you have not done follow the steps in this Instructable to setup the Arduino IDE to program Arduino UNO! The Visuino: https://www.visuino.eu also needs to be installed. Start Visuino as shown in the first picture Click on the "Tools" button on the Arduino component (Picture 1) in Visuino When the dialog appears, select "Arduino UNO" as shown on Picture 2

In Visuino Add Components

2019-10-27_12-44-05.jpg

  1. Add "Sequence" component
  2. Add "Analog Value" component
  3. Add "Divide Analog By Value" component
  4. Add "Servo" component

In Visuino Set Components

FMFOE3PK1UXJLTI.LARGE.jpg
2019-10-27_12-48-01.jpg

Select "Sequence1" component, double click on it. In the "Elements" Dialog:

Drag 5X "Period" element to the left.

  1. Select "Period1" element and under properties window set "Delay" to "1000"
  2. Select "Period2" element and under properties window set "Delay" to "2000"
  3. Select "Period3" element and under properties window set "Delay" to "3000"
  4. Select "Period4" element and under properties window set "Delay" to "4000"
  5. Select "Period5" element and under properties window set "Delay" to "5000" >>this one will be used just for a pause at the end.

Now lets set Degrees for the servo motor:Select "AnalogValue1" component, double click on it. In the "Elements" Dialog:

Drag 4X "Set Value" element to the left.

  1. Select "Set Value1" component and under properties window set "Value" to "0"
  2. Select "Set Value2" component and under properties window set "Value" to "60"
  3. Select "Set Value3" component and under properties window set "Value" to "120"
  4. Select "Set Value4" component and under properties window set "Value" to "180"

Select "DivideByValue1" component and under properties window set "value" to "180"

In Visuino Connect Components

servo-degrees2.png
  • Connect "Sequence1">Period1 pin [Out] to "AnalogValue1" pin [Set Value 1]
  • Connect "Sequence2">Period1 pin [Out] to"AnalogValue1" pin [Set Value 2]
  • Connect "Sequence3">Period1 pin [Out] to "AnalogValue1" pin [Set Value 3]
  • Connect "Sequence4">Period1 pin [Out] to "AnalogValue1" pin [Set Value 4]
  • Connect "AnalogValue1" pin [Out] to "DivideByValue1" pin [In]
  • Connect "DivideByValue1" pin [Out] to "Servo1" pin [In]
  • Connect "Servo1" pin [Out] to Arduino digital pin [8]

Generate, Compile, and Upload the Arduino Code

2020-10-30_13-20-50.jpg

In Visuino, at the bottom click on the "Build" Tab, make sure the correct port is selected, then click on the "Compile/Build and Upload" button.

Play

If you power the Arduino UNO module, the Servo motor will start to move according to the degrees you set.

Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this Instructable. You can download and open it in Visuino: https://www.visuino.eu