Creating a smart indoor greenhouse

Mon 18 January 2016 // posts


A greenhouse project that I've started where light, watering, air extraction, resistors, fan are controlled automatically based on time of day, temperature & humidity sensors or simply gravity (for soil watering). All of it is connected to an Arduino and a Raspberry Pi. The Pi runs controller logic for all electronics, a web UI for manual control and another for visualizing sensor data retained for weeks in a time series database.

Grown so far:
✓ Cayenne
✓ Bhut Jolokia
✓ Antillais Caribbean
✓ Jamaican Yellow
✓ Trinidad Moruga Scorpion
✓ Mini Chocolate bell pepper


MySensors (here)

This is part of the code that runs on Arduino. Implements a messaging protocol between sensor nodes, gateway and repeater nodes but also has transport implemented for some radio modules, like the NRF24L01+.

Domoticz (here)

This is the controller. Heart of the system. It gets data from every sensor and triggers the actuators based on my logic. Running on a Raspberry Pi.

I started using Blocky logic control, which is very nice, but quickly gets hard to manage with more complex logic, so I switched to a much more interesting and easier to version solution - Lua scripts.

TentSensors (here)

Arduino code with MySensors code and a Lua script for automatic control of all electronics. The logic can be found here.


This is the time series database I'm using to store sensor readings for weeks.


The software used to visualize influxdb data.


  • Tent and its logistics
  • Arduino (sensor node) connected to an 8 channel relay module installed on a ~~customised PVC box~~ custom made MDF box.
  • Arduino ~~nrf24l01+~~ serial gateway
  • Raspberry Pi
  • multiple DHT22 humidity and temperature sensors, installed in different spots
  • multiple relays

Worklog / Growlog


  • Plants look very healthy. Quite a few ghost peppers harvested already. Scorpion is full of big pods but none has ripen yet.
  • Mini Chocolate Bell is still flowering.
  • Caynenne woke up from the winter and is filled with big pods.
  • Jamaican Yellow, since moved to soil isn't going well.


  • 1st pruned/tipped plant looks healthy - new leaves/branches are growing and light reaches the whole plant. Did the same with the 2nd plant.

How it looks during the day:


  • New ventilation system. Temperatures are lower and more stable since I keep the cooltube extractor on during the day.
  • Pruned the 1st Bhut Jolokia by cutting the secondary main stem in hope that energy is focused on one main stem (buds aren't growing because new ones keep getting "dried" while being really tiny)


  • Moved to a bigger tent with a cooled reflector.


The two Bhut Jolokias plants I'm growing are huge: very bushy, initial flowers appeared and a few have dropped. Pruned both, mostly by cutting a leaves that were obstructing light.
One of the plants is not as tall as the other, and, a few main branches of it looked weak. I removed one completely and the other I adjusted it's position to point up. After a few hours it looks stronger!

Also created a simple python script that fetches the state of each relay from Domoticz and sends that data to influxdb (Domoticz doesn't support these devices with HTTP Link yet).

This is Grafana's current state:


  • Installed a self-watering system based on AutoPot's AquaValve. The (hopefully authentic) Bhut Jolokias were transplanted to bigger containers as well.


  • Planted 5 Bhut Jolokia seeds from another source. (4 of them germinated with success)


  • Spotted first fruits on ~~Bhut Jolokia~~ Cayenne plant! This comes in great timing as I was a bit worried about the flower drop rate for this plant. At least 3 peppers are now growing and tomato plants have fruits already as well :)


  • Nothing new except plant care :) Plants look healthy, big (so big that they barely fit inside the tent). I hope to try some bhut jolokia peppers soon!


  • Electronic circuit moved from the breadboard into a pcb perf board.
  • A new relay for the HPS lamp was added.
  • Completed a custom made MDF box to fit all the components. The whole installation is much cleaner now! :)


  • Moved the plants to containers with more, fresh soil, mixed with a tiny amount of fertilizer.


  • Installed and configured influxdb, grafana and collectd. Navigating sensor data is much better now, plus, I now have raspberry pi system stats as well.


  • All the seedlings are now on bigger containers.


  • As of 2016/01/19, the fan and extractor are activated based on temperature readings. The resistor can also be activated based on the same conditions. All of the logic can be disabled with a virtual switch, enabling manual control of these three elements.


  • Moved most of Bhut and Cherry seedlings to bigger containers since they have some leafs already (plastic cups).
  • Created PVC box to fit in all electronics


  • As of 2016/01/17, using the development branch with GW and Sensor node running on the same Arduino (no radio) due to unreliable radio communications. Working flawlessly without the NRF24!
  • Only one lua script is running, controlling heating, air intake and outtake, based on temperature readings. I've been able to achieve pretty good results for my needs.


  • As of 2016/01/16, using separate node and gateway sensors, that talk with each other using NRF24L01+ radio modules. Radio communication is not that stable, even after soldering a capacitor between radio's 3v3 and Gnd and providing a dedicated power supply to the radio. After some hours, the node loses communication with the gateway, making all sensors and actuators unreachable until the node is reset (see this issue), which is really bad. I've implemented a self reset every couple of hours, but I don't like this solution either.


GithubGithub (no radio version)

Additional Resources


pH vs Nutrients