DHT Sensor Orchid Care Setup
by Thatiana Rodriguez in Circuits > Arduino
458 Views, 0 Favorites, 0 Comments
DHT Sensor Orchid Care Setup
Introduction and Narrative
Helloo! This is a project I have been working on for my class. My idea and inspiration comes from my orchid. Orchids are very sensitive plants which thrive in very specific conditions whether it comes to sunlight, watering, and feeding. The goal for this project is to create a device which makes the care of these plants a bit easier and have a higher success rate.
We will be creating a prototype using the DHT11 Temperature and Humidity sensor with the Elegoo (Arduino) Uno and programming it to light up an LED when it drops below ideal humidity. This will hopefully improve the care of an orchid by letting you know when it is the best time to water.
Supplies
All of the materials I am using can be bought for $36.99 on Amazon in the Elegoo Uno Super Starter Kit. This kit comes with many different sensors, wires, and components, it even includes a set of tutorials to get you familar with some of the items in the kit. Plus it's Prime eligible! Here is the link Elegoo Super Starter Kit
1 - Breadboard
1 - Arduino Uno
1 - USB 2.0 to USB Cord
1 - LED
1 - 220 Ohm Resistor
7 - Jumper wires (male to male)
3 - Jumper wires (female to male)
1 - DHT11 Temperature and Humidity Sensor Module (3 pin)
Lastly, you will need the Arduino IDE software to code the processor. It is free to download here.
Gather Materials
Here I have marked images of all the materials we will need for this prototype.
** Please note, I have included a USB to USB-C adapter that I will be using because I have a newer Macbook that requires it. This is not a necessary material for every person. Please make note of the ports on your computer to see if it is necessary before looking to purchase this adapter. **
Wire the Breadboard
Above is the Fritzing diagram (the Fritzing file is also available to download below) I created to show the wiring setup that I am using, along with some images of my actual wiring setup.
** It is important to note that the pins on a DHT sensor can sometimes be different. Always check the characteristics of your sensor using the code or numbers shown on it before testing any wiring. **
I started by connecting the DHT11 sensor. For the code I am using, the Signal pin needs to be connected to the #7 pin on the Adruino, the middle pin to the 5V pin on Arduino, and the negative goes to GND. I am using the Female to Male jumper wires to distance my sensor from the breadboard for easier use of the prototype. It is also possible to plug the DHT11 sensor directly into the breadboard if you do not need the extra length.
** Please note I am not using a resistor for the DHT11 Sensor because I have the module type with a built-in resistor. Again please check the specs of each of your components before wiring them a certain way. **
Next, we need to wire up the LED setup. To do this we need to connect the LED to the breadboard. The resistor connects to the breadboard on the short side of the LED (the flat side of the LED). Then we connect it to the positive line on the breadboard and the other side of the resistor connects to the negative line on the breadboard. The positive line of the LED also needs to connect to pin 11 on the Arduino. Once you follow through the Fritzing diagram, then we are ready to get coding!
Downloads
Coding
For this project, I am using a mashup code of DHT sensor sketch and a blink sketch. If you would like the individual sketches to do the mashup yourself you can find them here.
DHT Code, Library, and Tutorial
(Remember to download the attached library in order to have the DHT11 Sensor work properly with the code).
Here is the Arduino.io file to the code I created for this project, along with a screenshot of my code.
First we start with the DHT11 code, then all we need to do is declare the ledPin as 11 in that code and create an if...else statement. To get the values that the sensor is reading simply click the magnifying glass at the top right of the Arduino IDE and it will pull up the Serial Monitor where it will list all the readings. We have set the value for humidity so that if it is less than or equal to 85% then the blink code will run. It looks like this.
if (DHT.humidity <= 85) {
digitalWrite(ledPin, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(ledPin, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second }
else { digitalWrite(ledPin, LOW);
}
Once that is all set up, run it through the verifier on the Adruino IDE (click the little check mark on the top left) then port the code.**Remember to make sure you have your correct board and port chosen in the tools tab before porting the code.** I used a cup of hot water to test this out as you will see later.
Downloads
Testing the Prototype
Now that we have our board wired, the code, and values set, we can test this out to see if it works. I am using a cup of very warm water and hovering my sensor inside of it since I have the extra cord length. You can obviously play around with the values a bit to make it more sensitive so it would be easier to get the Blink to play, but for mine I stuck with a drastic change because of the purpose of this creation.
You will see in my Serial Monitor screenshots that my sensor had a weird lapse but it did pick back up and get the normal readings in the first image. I also attached a screenshot of the high humidity readings.
I did find that this worked well as a test and that my readings worked for my own environment. My humidity readings might not work for you so just check the readings you get in your own home to choose your own value.
Does It Work?
Here is a video of the completed prototype, the readings it receives and the way it reacts to them. I am very glad that this works the way I intended. Good luck on your own endeavors using this tutorial.