Tag Archives: 3D printing

Modular hydroponics system


Hydroponics is a method of growing plants in nutrient solution without soil. Hydroponics is an efficient way of growing plants as nutrients are delivered directly to the roots in soluble form. It enables plants to allocate more resources to leaves, flowers and fruits.

We decided to create a small-scale hydroponics system with constant water flow. There are many such hydroponics systems commercially available, but we wanted to design our own. Our idea was to build a modular system consisting of a nutrient solution tank, a water pump and separate plant containers that could be connected to form a hydroponics system of 1 – 5 plants. Sensors attached to the system would measure temperature, humidity and lightness of the surroundings. Our initial plan also included measuring nitrate concentration of the nutrient solution and adjusting the amount of nutrients according to the measurements. However it turned out that nitrate sensors are expensive and difficult to get, so we gave up that part of the plan. Instead, we used a simple water sensor in the tank to detect when more water was needed.

Component overview

All our sensors were Grove system compatible which means that the sensors could be connected to a Grove Base Shield on top of an Arduino Uno microcontroller without tinkering. We used Grove Luminance Sensor to measure amount of light, Grove Temperature & Humidity Sensor Pro to measure temperature and relative humidity and Grove Water Sensor to detect when the tank was empty. For wireless networking, we used a separate Adafruit CC3000 Wifi Breakout plugged into the base shield. In addition to electronics we had a small Jebao AP-300 aquarium pump.

ghe_bbWiring schema

Sensors and data collection

Grove Water Sensor detects presence of water by measuring conductivity between interlaced sensor traces connected to SIG/VCC pins and ground traces connected to GND pin. When the sensor is exposed to water, conductivity between sensor traces and ground traces increases and voltage value in SIG pin becomes low. Otherwise it is high. We connected the sensor to the base shield’s digital pin and used it as a simple water detector. The sensor could also be used to measure changes in electric conductivity of nutrient solution by connecting it to an analog pin.

Grove Luminance Sensor contains an APDS-9002 lumen sensor . It is a simple analog-output sensor that peaks approximately in wavelength range 400-650 nm. This is very close to the spectrum of human vision. With standard 3.3 V input current, the sensor outputs a value between 0 and 1023 which is converted to voltage by simple arithmetics: output voltage = 3.3 V * output value / 1023 . Voltage values above 2.3 V are inaccurate and mean that the sensor is saturated by light. The output voltage can be linearly transformed to a lux value.

Grove Temperature and Humidity Sensor Pro is a DHT22 sensor with a capacitive humidity sensor and a thermistor. It outputs a 40 bit digital signal consisting of a relative humidity component (8 bit integer + 8 bit decimal), a temperature component in Celsius degrees (8 bit integer + 8 bit decimal) and a checksum (8 bits). Getting data from the sensor requires carefully timed signal exchange between the sensor and the microcontroller. Data request starts by sending the sensor a low voltage signal followed by a high voltage signal and then waiting for a response from the sensor. This is called “handshaking”. The sensor then sends data in a sequence of low and high voltage signals. One bit consists of 50 ms low voltage signal followed by a high voltage signal. The value of of the bit (0 or 1) is determined by the length of the high voltage signal.

We did not need to implement the procedure described above as somebody else had already done it. We used DHTlib to control the sensor. Reading other sensors was straightforward and no external libraries were required.

Sensor data was collected every minute during the testing period and sent to the backend server in a HTTP POST request. We used Adafruit CC3000 library and code samples that came with it to set up the network connection. CC3000 module tended to get stuck when initializing the connection. To avoid it we set up a watchdog: a timer that resets the system if the timer is not reset in eight seconds.

ANjOkhGwtKeHJBfaWDeM-Zs2oNZgGsFZpmXiVtJo-_Zu9fHUlwzchFxmw78ETEJt4-3xK9cLGbK-=s2048Testing the water sensor.

oRx_suys2V2JUYJhLQthLLqJq70bgz4CHFJbJFX7Y91ITrO0sIAfTT5BQuICCTimOx9RmnlIXvmY=s2048Testing the luminance sensor and Arduino with solar panels.

Backend server

Backend server was implemented using NodeJS, MongoDB and Express and was hosted on Heroku. Backend loosely follows REST architecture and returns all the data as JSON objects. Most of the data is served straight from the database except for a few aggregations for the latest and average values.

The implementation uses Express for basic routing with generic code modules to allow easy extendability. Authentication is not yet supported, but basic skeleton for authentication middleware is present in the code. Currently the application is insecure when used in an open environment such as Heroku.

Data visualization

We visualized the data with Angular.js using Bootstrap and angular-chart.js libraries. The dashboard is responsive and reactive, so it fits on every device and time series information is constantly updated.

Basic information displayed is temperature, humidity, amount of light and if water needs to be added to the tank.

iot-frontTime series charts displaying real data (Greenhouse project 2) and dummy data (for testing purpose).

Additionally, historic information on temperature, humidity and light levels is shown in time series charts.

Reactivity is accomplished by retrieving the data from the backend service in 10-second intervals and updating the time series charts accordingly allowing the user to see changes in real-time.

This front-end lives in its own Heroku instance and is supported by a static NodeJS file server. Information is retrieved from the backend service with basic HTTP GET requests using Angular.js $http provider.

3D printing the parts

We designed a hydroponics system which consists of a water tank including a pump and plant modules connected to the tank. Plant modules are simple cubic boxes that can be lined up to make the system extendable. Inside each module, a removable holder supports the plant leaving only its roots in contact with water.

We used TinkerCAD to create the STL models of the parts. Printing was done by Makerbot Replicator 2, which used polylactic acid (PLA) as feedstock material. PLA is a biodegradable derivative of corn starch.

First we printed a plant module using standard quality and 15% fill density (amount of infill in,  for example, walls). It took 4.5 hours to finish, so for the next module we used low quality and 10% fill density. This reduced the printing time to 2.5 hours. The printer had to be watched during the printing because sometimes PLA filament fed to the machine got tangled and snapped, terminating the process.

20150518_163517Printing the first plant module. First version of the plant holder on the right side.

We made multiple versions of the holders and some other small parts. This was where 3D printer became handy: it was easy to see which designs worked and which did not after having the actual physical object in hand.

Testing the system

After having all the parts printed we hooked two plant modules and a tank together, put the pump and a hose in place, added some water and started the pump to see if the system actually worked. Water flowed easily through all plant modules back to the tank but after a few minutes we noticed that some part of the system was leaking. We tried to seal the joints between plant modules by adding some silicone and glueing the modules together. It didn’t resolve the leaking issue as it seemed that water was leaking through the bottoms of the plant modules. Next we covered the interiors of the plant modules with water resistant paint but it didn’t help either.

We are not sure if the plant modules could have been made waterproof by printing them with higher fill density. However, leaking was not really a major issue since the containers kept the water long enough to demonstrate how the system works. Below is a video of the final version in operation. Arduino was placed in a wooden box to make sure it did not get wet. Luminance and temperature & humidity sensors are on top of the wooden box. The plant module with a plant in it is filled with LECA.


Source code for the project is available on a Github repository: https://github.com/hzhulkko/iot

The team
Heidi – Arduino programming, hardware testing, 3D design and printing operations
Jarkko – Backend server, 3D design
Lari – Data visualization, 3D design and printing operations

Visualizing metrics from greenhouse on an online dashboard

In this brief blog post we explain how we built a small system that monitors the temperature, air humidity and soil moisture of a small greenhouse or a plant pot. The prototype was implemented as a 2-man team with Mika Aho and Jyri Lehvä. The focus of the project was more on the software than on the hardware and the goal was to get to know the very basics of Arduino environment and learn something new about web programming in general.

The idea of the system was as simple as providing information about the environment of a small greenhouse to the gardener. We felt that monitoring the temperature, air humidity and soil moisture were the most important metrics we should be able to provide. To achieve that, we selected two sensors. One for the soil moisture and the second one to monitor the temperature and air humidity. The metrics from the sensors were saved to an online database and presented by a web application as graphs and charts so that the gardener can browse them with any modern web browser.

Prototype in action

Prototype in action


Arduino Yun and the sensors

The hardware used consisted of Arduino Yun and two sensors; AM2302 for temperature and air humidity and a Seeedstudio Grove sensor for soil moisture. We chose Arduino Yun because it felt like an easy device to use; it runs a Linux and contains a Wi-Fi chip. All we had to do was to setup it, plug it to a laptop with Arduino IDE and connect the sensors. After that we could just start writing code. Very Easy!

For the Arduino Yun we wrote a simple program that reads the input from the sensors attached to it every 10 minutes. The input from the sensors is then formatted to JSON and pushed to Firebase which is a web service for storing and querying data. The delay between reads from the sensors can be configured to any value that fits the best.

The Web application

The web application was built using Nodejs, ExpressJS and Firebase as the backend. The frontend was built using AngularJS, Angularfire and using D3js to draw the charts. The code can be found from Github (https://github.com/jlehvae/exgreen2k15). The application was deployed to Heroku (https://guarded-mesa-9835.herokuapp.com/).

The most significant challenge of the web application was to correctly visualize the data. For visualization we used Angular directive called Angular-nvD3. The Angular-nvD3 didn’t have very specific instructions on how to format your data so that it is correctly visualized and that’s why we had to take a trial and error approach. Configuring the charts correctly and formatting the data properly can take a while if you don’t have any previous experience with D3js. After we figured out the correct way to input the data, we were getting charts that didn’t look quite right. Soon we found out that we were actually missing a specific CSS file. After adding the missing file everything pretty much started working.

Online Dashboard at Heroku

Online Dashboard at Heroku

3D printing

The final step was 3D printing a case for our Arduino. We had no experience working with a 3D printer before. It was surprising how easy it was to print the case. It turned out the Internet is full of readymade 3D models for different things. It took only a couple of minutes to search for a model that is designed for Arduino Yun. Only problem with the model was that we had two wires that needed holes on top of it so we could have the sensors attached while the Yun is in the case. We made the holes using Tinkercad (https://www.tinkercad.com/). It’s a website that let’s you import and edit 3D models using a web UI and export them back once they are modified.

We used Makerbot Replicator 2 as the 3D printer. It was easy to use; just add the file of the model you want to print using the MakerWare and press start (we pretty much used the default values for everything). Printing the case took around 2 hours in total. The top and the bottom part of the case had to be printed separately so the case wouldn’t break apart during printing as there would have been nothing to support the roof of the case. The top part of the case was printed upside down so the roof was supported facing against the floor of the printer.

Sensors and the validity of the data

There were some problems with the moisture sensor as the readings before and after watering a plant were not that different. The plant in question was supposed to be quite dry yet the sensor gave readings of 400 ish (according to Seeedstudio this means that the soil is moist) and after excessive watering the readings only went up by around 40. The fact that our sensor had been used before and appeared quite worn probably had something to do with this.

The setup was tested on multiple occasions by simply turning the device on and manipulating the sensors by

  • touching the moisture sensor
  • putting the moisture sensor in soil and pouring water into it
  • blowing into the humidity/temperature sensor
  • leaving the temp/hum sensor under direct sunshine

What we found out was exactly what you’d expect: the sensors (and thus our charts) correctly reacted to changes in the environment. This didn’t really mean that the data was valid, though. If we had one or two more copies of the sensors we could have tested if they are all giving out same metrics in the same conditions. Now there was no way of knowing if the sensors were accurate or if the data was valid or not.

Continue reading