{{backlinks>.}} ====== Branchium Aquae ===== ==== Sebastian Andres & Raphael Wäspi ==== ==== Idee und Fernziel: ==== Bau eines Feuchtigkeitsmessinstruments, welches bei einer gewissen Feuchtigkeit automatisch die Pflanze bewässert ==== Minimalprojekt: ==== Bau eines Feuchtigkeitsmessinstruments, welches bei einer gewissen Feuchtigkeit automatisch die Pflanze bewässert ===== Bericht: ===== ==== Material: ==== Arduino MicroServo SG90 4-digit 7-segment display Soil Moisture Sensor YL-69 ==== Aufbau: ==== https://www.intorobotics.com/tutorial-how-to-control-the-tower-pro-sg90-servo-with-arduino-uno/ https://github.com/avishorp/TM1637/releases/tag/v1.1.0 https://randomnerdtutorials.com/guide-for-soil-moisture-sensor-yl-69-or-hl-69-with-the-arduino/ ==== Code: ==== #include #include int servoPin = 9; const int CLK = 12; //Set the CLK pin connection to the display const int DIO = 11; //Set the DIO pin connection to the display Servo servo; int rainPin = A0; int greenLED = 6; int redLED = 7; int yellowLED = 4; // you can adjust the threshold value int thresholdValue = 700; int servoAngle = 0; // servo position in degrees int NumStep = 0; //Variable to interate TM1637Display display(CLK, DIO); //set up the 4-Digit Display. void setup(){ pinMode(rainPin, INPUT); pinMode(greenLED, OUTPUT); pinMode(redLED, OUTPUT); pinMode(yellowLED, OUTPUT); digitalWrite(greenLED, LOW); digitalWrite(redLED, LOW); digitalWrite(yellowLED, LOW); Serial.begin(9600); servo.attach(servoPin); display.setBrightness(0x0a); //set the diplay to maximum brightness } void loop() { // read the input on analog pin 0: int sensorValue = analogRead(rainPin); Serial.print(sensorValue); if(sensorValue > thresholdValue-100 && sensorValue < thresholdValue){ Serial.println(" - Bald Wasser geh"); digitalWrite(redLED, LOW); digitalWrite(greenLED, LOW); digitalWrite(yellowLED, HIGH); display.showNumberDec(sensorValue); //Display the Variable value; delay(500); } else if(sensorValue < thresholdValue){ Serial.println(" - Gnueg nass"); digitalWrite(redLED, LOW); digitalWrite(greenLED, HIGH); digitalWrite(yellowLED, LOW); display.showNumberDec(sensorValue); //Display the Variable value; delay(500); servo.detach(); } else if (sensorValue > thresholdValue){ servo.attach(servoPin); Serial.println(" - Gib Wasser!"); digitalWrite(redLED, HIGH); digitalWrite(greenLED, LOW); digitalWrite(yellowLED, LOW); display.showNumberDec(sensorValue); //Display the Variable value; delay(500); servo.write(1); delay(2000); for (int i=1; i<136; i++) { servo.write(i); delay(10); } servo.write(135); } delay(60000); } ==== Servobox: ==== {{ :efinf:blc2016:bu1:projekt1:servobox-blc.svg |}} Rest (Achtung: Sevobox ersetzen): {{ :efinf:blc2016:bu1:projekt1:grundplatte-blc.svg |}} ==== Fazit: ==== Dieses Projekt haben wir in 4 Tagen beendet. ==== Fotos und Film: ====