Introduction: A Simple Automated Cloth Hang Line
It is a simple system that uses the intel galileo gen 2 and sensors to automate the cloth line. There are two servo motor which are fixed at the end of the cloth line and a humidity sensor which detects the rain.
If the humidity sensor senses rain, it activates the hang line to move to shade by moving the servo motor. If the humidity sensor sensors there is less humidity in air that is there is sunlight, it activates the hangline to move from shade and got to light. It has a LCD to display state.
Using the Intel ardiuino IDE. Sample code:
PS: In this code I used Touch instead of humidity sensor.
// Sweep
// by BARRAGAN // This example code is in the public domain.
int touch = 7;
int buzzer = 3;
//#include"rgb_lcd.h";
#include rgb_lcd lcd;
#include Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created
int pos = 0;
// variable to store the servo position
void setup() { // set up the LCD's number of columns and rows:
myservo.attach(5); // attaches the servo on pin 5 to the servo object
pinMode(touch, INPUT);
pinMode(buzzer,OUTPUT);
lcd.begin(16, 2); // Print a message to the LCD.
lcd.print("Clear Weather!");
lcd.setRGB(0, 255,0);
delay(1000); }
void loop() {
int state = digitalRead(touch);
if(state==HIGH) {
lcd.clear();
lcd.print("Rain! Rain!");
lcd.setRGB(255,0,0);
for(int i=0; i<3; i++) {
digitalWrite(buzzer, HIGH);
delay(500);
digitalWrite(buzzer, LOW);
delay(500); }
for(pos = 0; pos < 180; pos += 20) // 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 15ms for the servo to reach the position
}
for(pos = 180; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees
{
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
lcd.clear();
lcd.print("Clear Weather!");
lcd.setRGB(0, 255,0);
}
else { digitalWrite(buzzer, LOW); } }