I'm new to PLD. For a simple, cheap home DIY project, I want to build a motor/switch/controller to flip a small 10" disk 180 degrees and then repeat every 1 hour.
My notion is a small hobby motor that slowly rotates the disk and hits a mechanical switch to stop the rotation and then a timer that restarts the motor to flip the disk 180 degrees 1 hour later. A schematic is attached.
Would you have any tips on how to get started? Is the Arduino software easy to program in with Windows since I dont know how to do any software programming?
Thanks for any tips
Arduino is programmed in C/C++, and if you are unfamiliar with the language, expect a long learning curve before becoming proficient. The Arduino IDE has a number of example programs, and countless tutorials are posted on line.
However, reading a switch, timing intervals and activating an appropriate motor driver are not complicated tasks. With internet search efforts plus trial and error, you might be able to piece something together within a couple of days.
There are many sensing technologies out there. Are you locked in to a mechanical switch? In fact, with a stepper no switch would be needed, just count steps taken.
Make a list of devices to be used:
a. wood
b. wires
c. power supply (DC, not AC)
d. switch (SPSTNO)
e. DC motor
f. RTC (real time clock) module
g. Arduino
Any cheap sensor would be fine. It's just a mechanical switch came immediately to my mind. I'm afraid that over time, counting steps would eventually cause the disk to move away from 180 degrees.
Why introduce another library when the built in Servo library will do exactly what has been described ?
/* Sweep
by BARRAGAN <http://barraganstudio.com>
This example code is in the public domain.
modified 8 Nov 2013
by Scott Fitzgerald
https://www.arduino.cc/en/Tutorial/LibraryExamples/Sweep
*/
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards
int pos = 0; // variable to store the servo position
void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop()
{
for (pos = 0; pos <= 180; pos += 1)
{ // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15 ms for the servo to reach the position
}
delay(3600000) for (pos = 180; pos >= 0; pos -= 1)
{ // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15 ms for the servo to reach the position
}
delay(3600000)
}
Good stuff. Thank you. Ill keep a library of the is together while I gather some hardware.
The 180-degree position slip needs to be consistent over a long time as in a year. Is servo still a good option vs a sensor/switch solution? Would you have any suggestions for a cheap servo with some power to flip the disc? Thanks again!
OK. I like the idea of a step motor now. Which of the Arduino boards (there are so many and this is new to me) can you suggest for single step motor control? I'm assuming there is a board that has built-in all the capability to do that control? Thank you!
When you say the disk flips, do you mean it turns 180° in one direction, then reverses 180° next time, or does it always turn the same direction? Or does it matter?