This weeks Group Assignment is pretty close to what I did in my Individual Assignment for this week. I will again use the same sensors as in that Assignment: A Capacative Soil Moisture Sensor that sends analog signals and a DHT-11 Moisture and Temperature Sensor that sends digital values.
Since its far more interesting, I will start with the Soil Sensor. For this Assignment im going to use an Arduino Uno. I went ahead and plugged the Soil Senosr into the corresponding port on the UNO:
With the connection done, I wrote the simplest code to probe the Sensor I could think of:
int value;
void setup() {
Serial.begin(115200);
}
void loop() {
value = analogRead(A0);
Serial.println(value);
delay(50);
}
With this code uploaded to the Arduino Uno I just had to take a look at the Serial Plotter the IDE comes with to showcase the analog output of the Soil Sensor:
For the digital Signal, I chose to once again use a DHT-11 Sensor. I used the same code, I did in my Individual Assignment, just changed the Pin to Pin 2 of the Arduino Uno.
#include
#include
int sensor = 2;
DHT dht(sensor, DHT11);
void setup() {
Serial.begin(115200);
dht.begin();
}
void loop() {
Serial.print("Temperature: ");
Serial.print(dht.readTemperature());
Serial.print("°C (");
Serial.print(dht.readTemperature(true));
Serial.print("°F); Humidity: ");
Serial.print(dht.readHumidity());
Serial.println("%");
delay(500);
}
This code resulted in the following Readings:
To show a change of Values I clamped the Sensor between my Hands, so thats why temperature and Humidity are rising so sharply at the end!