Page 1 of 1

Ardiuno Clinostat Beginner error

Posted: Sat Feb 01, 2025 9:55 am
by Nikhilesh_k
Hey, I am new to ardiuno and coding and once I had posted the code (link: https://www.sciencebuddies.org/science- ... -clinostat), the servo motor was getting controlled by the potentiomotor, and it was moving while i turned the potentiomoter. Although in the actual clinostat shown in the video, the servo motor is continously moving and the speed is getting controlled by the potentiomotor which is not happening with the code I pasted from the website. I checked and im pretty sure that the servo motor I am using is a 360 motor which means it can move continously, my code just isn't working. Please can someone guide me through the problem.

Thanks,

Re: Ardiuno Clinostat Beginner error

Posted: Mon Feb 03, 2025 12:57 am
by Snehaarun
Hi,

This is a pretty cool project!


First, could you attach a picture of your circuit, including the Arduino/breadboard with the wires connected to it/servo motor?

Also, just to make sure I'm understanding the question correctly -- is your problem that the servo motor is only working when the potentiometer is moving (but actually the servo motor should be moving continuously)? You should be able to see that when you have the potentiometer in the middle, the servo motor stops; likewise, when you move the potentiometer all the way to the left or right, the motor should spin full speed clockwise or counterclockwise.

If that isn't working, one option is to first try running the servo motor without the potentiometer for a few minutes, just to make sure that the 360 motor does actually work.

Here's some sample code for that (a more detailed look at the code can be found here: https://www.makerguides.com/how-to-cont ... h-arduino/)

// Include the library
#include "Servo.h"

// Create the servo object
Servo myservo;

// Setup section to run once
void setup() {
myservo.attach(8); // attach the servo to our servo object
myservo.write(90); // stop the motor
}

// Loop to keep the motor turning!
void loop() {
myservo.write(45); // rotate the motor counter-clockwise
delay(5000); // keep rotating for 5 seconds (5000 milliseconds)

myservo.write(90); // stop the motor
delay(5000); // stay stopped

myservo.write(135); // rotate the motor clockwise
delay(5000); // keep rotating
}

It would be great if you could attach a picture of your circuit and then let me know whether the servo was able to run successfully without the potentiometer. Then I can help you look into the problem further. :D