In this tutorial we are going to learn how to control the speed and direction of a Continuous Rotation Servo using a potentiometer, button & Arduino.
Watch the video!
Also check outthis great Video on How Continuous Rotation Servo Works
Step 1: What You Will Need
- 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: Brought by PCBWay
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 assembly, 3D printing, CNC 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
The Visuino: https://www.visuino.com also needs to be installed. Download Free version or register for a Free Trial.
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
- 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
- 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 with Visuino. Also attached is the Visuino project, that I created for this tutorial, you can download it and open it in
Visuino: https://www.visuino.com
Download servo-360.zip