How To Control A 360 Continuous Servo Motor Using Arduino

About the project

In this tutorial we are going to learn how to control the speed and direction of a Continuous Rotation Servo using a potentiometer & button

Project info

Difficulty: Easy

Platforms: ArduinoDFRobotVisuino

Estimated time: 1 hour

License: GNU General Public License, version 3 or later (GPL3+)

Items used in this project

Hardware components

Arduino UNO Arduino UNO x 1
Resistor 1k ohm Resistor 1k ohm x 1
DFRobot Gravity:Digital Push Button (Yellow) DFRobot Gravity:Digital Push Button (Yellow) x 1
Potentiometer, Slide Potentiometer, Slide x 1
SG90 Micro-servo motor SG90 Micro-servo motor x 1

Software apps and online services

Visuino Visuino
Arduino IDE Arduino IDE

Story

Also check out this great Video on How Continuous Rotation Servo Works

Step 1: What You Will Need

1 / 7

  • Arduino UNO (Or any other Arduino)
  • 360 Continuous Rotation SERVO Motor
  • Potentiometer module
  • 1k ohm Resistor
  • Jumper wires
  • Breadboard
  • Visuino program: Download Visuino

Step 2: 


Thank you PCBWay for supporting this tutorial and helping users learn more about electronics.


What I like about the PCBWay is that you can get 10 boards for approximately $5 which is really cost effective for professional made boards, not to mention how much time you save!


Go check them out here. They also offer a lot of other stuff in case you might need it like assembly3D printingCNC machining and a lot more.


Step 3: The Circuit

  • Connect Arduino pin [5V] to Driver Board pin [VCC]
  • Connect Arduino pin [GND] to Driver Board pin [GND]
  • Connect Arduino pin [5V] to breadboard positive pin [Red line]
  • Connect Arduino pin [GND] to breadboard negative pin [Black line]
  • Connect Arduino Digital pin [2] to the Resistor and button
  • Connect other side of the resistor to the breadboard pin [GND]
  • Connect Other pin of the button to the breadboard positive pin [5V]
  • Connect potentiometer pin [DTA] to arduino analog pin [A0]
  • Connect potentiometer pin [VCC] to the breadboard positive pin [5V]
  • Connect potentiometer pin [GND] to the breadboard pin [GND]
  • Connect Servo motor "Orange" (signal) pin to Arduino Digital pin[3]
  • Connect Servo motor "Red" pin to Arduino positive pin[5V]
  • Connect Servo motor "Brown" pin to Arduino negative pin[GND]

Step 4: Start Visuino, and Select the Arduino UNO Board Type

1 / 2

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

Step 5: In Visuino Add Components

1 / 4

  • Add "Debounce Button" component
  • Add "Toggle(T) Flip-Flop" component
  • Add "Speed and Direction To Speed" component
  • Add "Servo" component

Step 6: In Visuino Connect Components

1 / 2

  • Connect Arduino digital pin [2] to "Button1" pin[In]
  • Connect "Button1" pin[Out] to "TFlipFlop1" pin [Clock]
  • Connect "TFlipFlop1" pin [Out] to "SpeedAndDirectionToSpeed1" pin [Reverse]
  • Connect Arduino analog pin [0] to "SpeedAndDirectionToSpeed1" pin [Speed]

Step 7: Generate, Compile, and Upload the Arduino Code

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.

Step 8: Play

If you power the Arduino Uno module, the Servo motor is ready to spin.

By sliding potentiometer you can regulate the motor speed and change the direction by pushing the button. Congratulations! You have completed your Project. Also attached is the Visuino project, that I created for this Instructable. You can download it here and open it in Visuino: https://www.visuino.eu

Schematics, diagrams and documents

Visuino File

Code

Visuino File

Credits

Photo of Ron

Ron

Arduino Developer

   

Leave your feedback...