Rotate Sand CLOCK Every Minute Using Servo Motor - Arduino
License: GNU Lesser General Public License Microcontrollers Motors PWM Servo Arduino ESP32
In this tutorial, we will learn how to rotate a small (1-minute) sand clock every 60 seconds using a servo motor and Visuino.
Watch the demonstration video.
Learn more about Visuino: What is Visuino
What You Will Need
Arduino UNO (or any other Arduino)
Sand clock
Some small wire or glue to attach the clock to the motor
Visuino program: Download Visuino





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]

Start Visuino, and Select the Arduino UNO Board Type
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 will not work! If you have not done so, follow the steps to set up 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 in Picture 2


In Visuino, Add Components
Add "Clock Generator" component
Add "Toggle(T) Flip-Flop" component
Add "Analog Value" component
Add "Servo" component

In Visuino Set Components
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 side
Select 'Set Value2' and in the properties window set "Value" to 1


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]

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.

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; you can download it here and open it in Visuino: https://www.visuino.eu

