Rotate Sand Clock Every Minute Using Servo Motor - Arduino

About the project

In this tutorial we will learn how to rotate a small (1 minute) sand clock every 60s using servo motor and Visuino,

Project info

Difficulty: Moderate

Platforms: ArduinoVisuino

Estimated time: 1 hour

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

Items used in this project

Hardware components

Jumper wires (generic) Jumper wires (generic) x 1
Sand clock -1minute Sand clock -1minute x 1
Arduino UNO Arduino UNO x 1
SG90 Micro-servo motor SG90 Micro-servo motor x 1

Software apps and online services

Visuino Visuino
Arduino IDE Arduino IDE

Story

In this tutorial we will learn how to rotate a small (1 minute) sand clock every 60s using servo motor and Visuino,

Watch a demonstration video.

Step 1: What You Will Need

1 / 4

  • Arduino UNO (or any other Arduino)
  • Sand clock
  • Servo motor
  • some small wire or glue to attach the clock to the motor
  • jumper wires
  • Visuino program: Download Visuino

Step 2: The Circuit

  • Connect Servo motor "Orange" pin to Arduino Digital pin[2]
  • Connect Servo motor "Red" pin to Arduino positive pin[5V]
  • Connect Servo motor "Brown" pin to Arduino negative pin[GND]

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

1 / 2

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 tutorial will not work! If you have not done follow the steps in this tutorial 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

Step 4: In Visuino Add Components

  • Add "Clock Generator" component
  • Add "Toggle(T) Flip-Flop" component
  • Add "Analog Value" component
  • Add "Servo" component

Step 5: In Visuino Set Components

1 / 2

  • Select "ClockGenerator1" and in the properties window set "Frequency" to: 0.0166667 <<this is 60s, you can change the number if you want
  • Select "AnalogValue1" and in the properties window set "Value" to 1
  • Double click on "AnalogValue1" and in the elements window drag 2X 'Set Value' to the left sideSelect 'Set Value2' and in the properties window set "Value" to 1

Step 6: In Visuino Connect Components

  • Connect "ClockGenerator1" pin [Out] to "TFlipFlop1" pin[clock]
  • Connect "TFlipFlop1" pin [Out] to "AnalogValue1">"Set Value0" pin[In]
  • Connect "TFlipFlop1" pin [Inverted] to "AnalogValue1">"Set Value1" pin[In]
  • Connect "AnalogValue1" pin[Out" to "Servo1" pin[In]
  • Connect "Servo1" pin[Out] to Arduino board digital pin[2]

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 will rotate a sand clock every minute.

Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this tutorial, 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...