Today we want to describe a project based on the new board Mediatek Linkit ONE. With this board we want to realize a simple Hydroponic system which is able to:

1) Making hydroponics nutrient solution:

This will be made by using solenoid valves activated by relais controlled via Mediatek Linkit ONE.

Tanks levels will be monitored by ultrasonic modules.

2) Automatically adjust nutrient solution :

A conductivity meter controls the solenoid valves

3) Monitoring all chemical-physics parameters:

electric-conductivity meter, ambient temperature&humidity sensor

4) Automated luminous intensity control:

Lamps will be programmed in order to change their colour and duration of daylight according to the artificial season

5) Fast queries via bluetooth

6) Alarm system, controlling and monitoring via SMS

For example, alarms via SMS about low level tanks.

Posibility to request parameters values by sending an sms

7) Data monitoring via WIFI:

Collected data will be sent to the Mediatek Cloud

The Linkit ONE board is very powerful, a fast processor, wifi, bluetooth and sms connectivity, a gps, some communication ports (UART, I2C, SPI....). Below we show some features from the official site:

The smallest commercial System-on-Chip (5.4mm*6.2mm) currently on the market

- CPU core: ARM7 EJ-S 260MHz

- Memory: 4MB RAM, 4MB Flash

- PAN: Dual Bluetooth 2.1 (SPP) and 4.0 (GATT)

- WAN: GSM and GPRS modem

- Power: PMU and charger functions, low power mode with sensor hub function

- Multimedia: Audio (list formats), video (list formats), camera (list formats/resolutions)

- Interfaces: External ports for LCD, camera, I2C, SPI, UART, GPIO, and more

Hydroponics is a subset of hydroculture and is a method of growing plants using mineral nutrient solutions, in water, without soil. Terrestrial plants may be grown with their roots in the mineral nutrient solution only, or in an inert medium, such as perlite or gravel (from Wikipedia)

Step 1: Measuring Some Physical and System Parameters

This prototype can measure some physical and system parameters using some sensors:

- a DHT11 for temperature and humidity

- an electro-conductivimeter for the measurement of the electro-conducibility of the nutrient solution

- a sensor that measure how much is the battery level and if the battery is charging

- three ultrasonic sensors that measure the levels of the water tank, the nutrient solution tank and the plant tank

In the first sketch (attached) you can measure all the above parameters and communicate them via wifi, SMS and Bluetooth. So you are always able to monitor those parameters by wifi (visualizing them on the Mediatek Cloud) or sending proper SMS to your system or using Bluetooth. Of course, your board needs a proper SIM card to connect to the mobile service (and a mobile number, of course!).

Here are some scenarios of using SMS messaging:

1) the user wants to know the parameters values. So he/she sends a short SMS containing the string "info" (whithout quotes) to the system's mobile number. The board will reply with another SMS containing all the values;

2) the water tank (or the nutrient solution tank, it's the same) reaches the minimum level: the system will send an SMS containing an alarm message to the user.

Regarding the Bluetooth, you can install an application on your mobile phone to give proper commands to the hydroponic system. We installed the Bluetooth Controller application on an Android mobile phone.

After pairing the hydroponic system to your phone, connect the Bluetooth Controller app to the system and send the string "info" (without quotes). You should receive the values of the parameters.

As said before, you can always monitor all the parameters using the Mediatek Cloud. Of course, you need to create an account on this cloud. Once logged, create a prototype (menu Development > Prototype) and add your data channels.

For our purposes, we added these channels:

- temperature_display

- humidity_display

- battery_display

- ischarging_display

- electroconductivity_display

- level1_display (for the nutrient solution tank)

- level2_display (for the water tank).

- level3_display (for the plant tank).

After that, you can create your test device (using the button "Create test device" on the right corner of the page) using a proper name for it. Then, open the "Test devices" section (menu Development > Test device) which shows your devices (also the newly created). Click on it (button "Detail") to open its page. On the right side you'll see two important parameters: "DeviceId" and "DeviceKey" which you will put on your sketch.

#define DEVICEID "XXXXXXXX" // device id 
#define DEVICEKEY "YYYYYYYYYYYYYYYY" // device key

See the attached video that shows how to create a test device on Mediatek Cloud Sandbox.

Put the SIM in its connector (NOTE: SIM unlock using a PIN is not supported. To use a PIN locked SIM, remove the PIN lock before inserting it onto the LinkIt ONE board). Put the SIM mobile number in the sketch, inside the SMS_tx function:

boolean SMS_tx(String msg){
    LSMS.beginSMS("0123456789");  // put the SIM number here
      return true;
      return false;

Set the WIFI parameters in the sketch. As you can see, our sketch has no WEP/WPA password (open wlan) and no static IP (first is for semplicity, second is because LinkIt ONE still doesn't support static IPs).

Connect all the component as shown in the attached Fritzing scheme.

You need the DHT11 library (attached). Download it and put it in the folder library (inside the sketcs folder) and upload the sketch. If it's all ok you should be able to see your data shown by your device on Mediatek Cloud.

You can see the attached screenshot that shows our test device on Mediatek Cloud.

Step 2: Lighting Systems

To illuminate the plants we use two groups of LEDs 1W: in a group there are three white LEDs, in the other group there are three red LEDs. So we can regulate the light intensity and its white and red components (according to the artificial season and the time of day).

The max value of current through each LED should be 350mA. This current value is too high for the digital outputs of the Linkit ONE so we need to use a more complex driver circuit with two transistors (remember that Linkit ONE digital output voltage is 3.3V with 3mA max). There are two independent driver circuits: one for the white LEDs and the othe one for the red LEDs.

Each circuit is driven by a PWM signal from a Linkit ONE's digital output (so we use two independent digital outputs).

The PWM signals regulate the intensity of the red and white light by their duty cicle.

The max current absorption of the circuit input is about 6.3uA (at 3.3V).

How to calculate R1 value


  • Vcc = 12V
  • Vcesatq1 = 0.5V (saturation voltage between collector and emitter of the Q1 transistor)
  • Vfled = 3.2V (voltage drop for each white LED, while it is 2.4V for each red LED)
  • Ifled = 0.35A

we have

R1 = [Vcc - (3 * Vfled + Vcesatq1)] / Ifled = [12V - (3 * 3.2V + 0.5V)] / 0.35A = 5.43 Ω.

The closest standard resistor value is 5.6 Ω.

If you want to increase the number of LEDs, you can add other parallel branches (each branch has a resistor and three LEDs connected in series). Of course, these branches increase the current absorption (each branch absorbs 350mA) from the power supply. For example, if you have three branches (nine LEDs), the current absorption is 3 * 0.35A = 1.05A.

NOTE: mount the LEDs on a heat sink in order to dissipate the high heat generated.

Step 3: Controlling the Flow of Water Using Solenoid Valves

To control the flow of water we will use some solenoid valves controlled by some twin optoisolated relay modules.

Mainly there are two types of solenoid valves, one monostable and one bistable.

The monostable solenoid valve is fed with an alternating voltage while the bistable with a DC voltage.

In this project we will use bistable solenoid valves. The bistable solenoid valves have two stable states, one for the closed valve and one for the open valve. Feeding the solenoid, the valve opens and remains open even cutting off the power.

To close it we have to feed the solenoid reversing the polarity, also in this case by removing power the valve remains closed. The main advantage is a minimum electrical consumption, given that to open and close the valve it is necessary to feed it only for a few seconds, this allows to feed it using a battery.

Each solenoid valve needs one twin optoisolated relay module. The two relay are properly driven by two Linkit ONE's digital outputs to apply a direct or inverse voltage to the solenoid valve, depending on whether you want to open or close the solenoid valve.

Each relay is driven by a transistor because the Linkit ONE's digital outputs can supply a little current (max 3mA).

Step 4: The Complete Project

In the last step we show the complete project.You can find the Fritzing wiring scheme attached in a previous step. On the left side there is the lighting system with the LEDs and the transistors. On the center there are the voltage regulators and the sensors (for humidity and temperature, for the tank levels and for conductivity). On the right side there is the driving system of the solenoid valves (with the transistor and the relays). The solenoid valves control system is represented in the attached flow diagram. With this workflow we can control the solenoid valves in order to adjust the exact proportion between the water and the nutrient solution. It contains some check that inhibit the system when the water tank and the nutrient solution tank are almost empty. So when the solution is diluted little (conductivity > Sh) is opened the solenoid valve of the water tank while when the solution is too diluted (conductivity < Sl) is opened the solenoid valve of the nutrient solution tank. When these two tanks are almost empty, the system closes the solenoid valves and send an alarm using an SMS. When the level of the plant tank is too high, the system opens the corresponding solenoid valve. From the flow chart was derived the corresponding finite-state machine scheme (see attached picture) used in the sketch.

<p>Can you explain how the conductivity works? It's not clear from this tutorial how you are measuring this.</p>
<p>Hi, the conductivity meter is made by two wires (yellow and green) on the solution. These two wires, with the 33k resistor, are part of a voltage divider (https://en.wikipedia.org/wiki/Voltage_divider). The analog input A0 measures the voltage across the 33k resistor. The measured voltage across the resistor is proportional to the conductivity of the solution.</p>

About This Instructable




More by techrm:A Simple Hydroponic System With MediaTek LinkIt™ ONE Getting started with BTE13-010 - Arduino Mini clone Simple calculator based on Arduino MEGA 
Add instructable to: