I always wanted a plant in my room, that would fill the space between unfinished projects. So I came up with the idea of an electronic pot – The Arduino Electronic Pot – that would measure the basic needs of the plant (humidity, temperature and the presence of light).
I also wanted to display the results in a neat way on a website, so I could see everywhere I was if the plant is doing OK.
I divided the whole process in three simple steps:
- Connecting the hardware
- Software for the Arduino (the .ino sketch)
- Software for the web-server (some .php files)
If you want to connect the Ethernet Shield with an Arduino Uno or Arduino Leonardo Board, you actually don’t need any wiring. The only thing you would have to connect with the set-up would be the sensors.
- Arduino Nano Rev3 (Tested also on Leonardo and UNO)
- Ethernet Shield
- DHT11 Humidity Module
- 1x 4,7kΩ
- 1x 10kΩ
- 1x Ceramic capacitor 100nF
You can of course use other sensors with other requirements, that’s why I don’t include any specific models or data sheets. Always make sure you use components recommended by the producers of the sensors.
I based the connection between the Nano and Ethernet Shield on this post Arduino Nano with Ethernet Shield by ntewinkel.
D13 on NANO – ~13 on Ethernet Shield [yellow]
D12 on NANO – ~12 on Ethernet Shield [blue]
D11 on NANO – ~11 on Ethernet Shield [red]
D10 on NANO – ~10 on Ethernet Shield [black]
D4 on NANO – ~4 on Ethernet Shield [green]
DATA on DHT11 – D2 on NANO [cyan]
GND on DHT11 – GND on NANO [brown]
VCC on DHT11 – 5V on NANO [purple]
1 on Photo-resistor – A0 on NANO [white]
2 on Photo-resistor – 5V on Ethernet Shield [gray]
As you can see on the graphic above, there are also additional pull-up resistors and a capacitor. Connect the 4,7kΩ resistor between the GND and DATA of the DHT11. The 100nF capacitor between the VCC and GND of the DHT11. The last part – a 10kΩ resistor – should be placed as a pull-up resistor for the photo-resistor from the data pin to GND (on Ethernet Shield in my case)
Software for the Arduino
The next step is to write the code for the Arduino. You can find my example code here: github.com/pedrollo/electronicPot
I tried to comment everything where any problems could occur. If something isn’t clear or the code doesn’t work as it should, please contact me in any way.
At this point you should log into your database and create the needed table. This step depends on the type of your database, in my case (MySQL) I just went to the ‘SQL’ tab in the control panel and created the table with this query:
CREATE TABLE `tempLog` ( `timeStamp` TIMESTAMP PRIMARY KEY DEFAULT CURRENT_TIMESTAMP, `ahum1` INT(11) NOT NULL, `temp1` INT(11) NOT NULL, `light` INT(11) NOT NULL )
Now the main part – the first two files are needed to handle the communication between:
- Arduino Ethernet Shield – Web server (add.php)
- Web server – Database (connect.php)
Example files also available on github.com/pedrollo/electronicPot
After this steps, you should see data in your database in the table ‘tempLog’.
The next steps are related only with web development. We create the main file which always open when we have a visitor on our server (index.php) and a second file that contains the code responsible for the menu at the top – header.php. The third file is optional – I just wanted to show some photos of my project that’s why I included a gallery.php file.
These three files are included above on github also. You need to make couple of changes (substitute the domain names with your domains), but it shouldn’t cause any problems.
However if you get stuck at any point, just let me know and I will be happy to help you.
You can find these instructions also on instructable.
Good luck with your E-Pot 🙂