Introduction: GreenHouse Sensor

Tutorial GreenHouse Sensor

Realised by Alain Wei assisted by Pascal Chen
captors | sigfox | ubidots
  1. Objectives
  2. Things used in this project
  3. Implementation step
  4. Working principle
  5. Device connection
  6. The mbed code
  7. Data processing and analysis
  8. Optimise the consumption of system
  9. Photos

Step 1: Objectives

For this project, I would like to realize an autonomous energy system, and I have to measure : the ambient temperature of the air, the humidity of the air, the temperature of the soil, the humidity of the soil, Lux and RGB brightness.

Step 2: Things Used in This Project

Bill of materials :

1) solar component : a thin layer of resin allows outdoor use

2) Chip LiPo Rider Pro: charge all your projects in 5 V

3) Chip microcontroller Nucleo STM 32L432KC : provides an affordable and flexible way for users to try out new ideas and build prototypes with any STM32 microcontroller line

4) Module Sigfox Wisol : for design your IOT prototype with Sigfox networks

5) Screen LCD : It connects to a microcontroller via the I2C or SPI bus

6) Li-Ion battery 3,7V 1050mAh : protection against overloads and discharges.

7) Gravity Humidity Sensor SEN0193 : know the concentration of water in the ground. The sensor delivers an analog voltage depending on the water content.

8) Temperature and humidity sensor DHT22: know the temperature and humidity of air, and communicates with a microcontroller arduino type or compatible via a digital output.

9) Grove temperature sensor: know the temperature of soil, and this module is connected to a digital input of Grove Base Shield or Mega Shield via a 4-conductor cable included

10) Color sensor ADA1334 : detect the color of a light source or object. It communicates via an I2C port

11) Light sensor TSL2561: measure a brightness from 0.1 to 40000 Lux. It communicates with an Arduino microcontroller via the I2C bus.

Software:

1) SolidWorks (design solid model)

2) Paint 3d (design the icon of application)

3) Altium (draw the pcb)

4) Mbed (write code for card)

Step 3: Implementation Step

After knowing the material and the software that we will use, there are a number of steps that we should realize

1) we should simulate the circuit by means of Altium

2) we should do some jobs of design, for example: design solid model by means of SolidWorks, design the icon of application by means of Paint 3d

3) if the circuit is correct, we can realize the circuit on PCB with the materials that we prepared yet

4) after connecting circuit, we should weld component and test the quality of circuit

5) at the end, we should package the circuit with the solid model that we already finished

Step 4: Working Principle

Capacitive Soil Moisture Sensor SKU : insert it into the soil around your plants and impress your friends with real-time soil moisture data

Temperature and humidity sensor DHT11 ST052 : connect the sensor to the pins on the board Color sensor ADA1334 : has RGB and Clear light sensing elements. An IR blocking filter, integrated on-chip and localized to the color sensing photodiodes, minimizes the IR spectral component of the incoming light and allows color measurements to be made accurately.

Grove temperature sensor: insert it into the soil around your plants, The DS18B20 digital thermometer provides 9-bit to 12-bit Celsius temperature measurements and has an alarm function with nonvolatile user-programmable upper and lower trigger points.

Light sensorTSL2561 : The sensor has a digital (i2c) interface. You can select one of three addresses so you can have up to three sensors on one board, each with a different i2c address. The built in ADC means you can use this with any microcontroller, even if it doesn't have analog inputs.

1) Using the sensors for collecting data

2) The data will be transmitted to the microcontroller

3) The microcontroller will execute the program that we already written and will transmit the data to Module Sigfox Wisol

4) Module Sigfox Wisol will transmit the data to website Sigfox Backend through the antenna

Step 5: Device Connection

SPIPreInit gSpi(D11, NC, D13); // MOSI MISO CLK

Adafruit_SSD1306_Spi gOled(gSpi, D10, D4, D3); // DC RST CS

Serial wisol(USBTX, USBRX); // tx(A2), rx(A7)

DHT dht22(A5,DHT::DHT22); // analog

TSL2561_I2C Lum(D0, D1); // sda, scl

TCS3472_I2C rgbc(D12, A6); // sda, scl

AnalogIn humidite(A1); // analog

DS1820 probe(A0); // analog

DigitalIn flag(D6); // switcher screen control

Step 6: The Mbed Code

You can find the mbed code there : https://github.com/TimeEngineer/GreenHouse-Sensor

Step 7: Data Processing and Analysis

After sending data to website Sigfox, because Sigfox limits each message to a maximum of 12 bytes (96 bits), so we assigned different measurements to different byte sizes, and we set the data to hexadecimal. To enable users to receive data more clearly and conveniently, we send the data from Sigfox to the cloud platform, on the cloud platform, we present the data and analyze it. The implementation process is as follows:

1) Register our devices to the cloud platform

2) Enter the website of Sigfox device callback edition

3) Set parameter configuration

4) Put an account link for the device on the cloud platform in the url pattern (call back the server address)

5) Fill the callbackBody (the body of information for the callback request)

6) Save settings

Image shows the result on the platform Ubidots, we can see that the data is converted to decimal, so we receive data more clearly and conveniently, and we can look at the diagram of each data in detail, for example : we can find the highest temperature in the air

Step 8: Optimize the Consumption of System

There is regulator between mini usb and Vin in MCU, this regulator will increase the loss, in order to minimize the loss of our system, we will feed the microcontroller from digital output, and when we do not use the system, make the microcontroller and sensors sleep. We prove that these two methods can effectively reduce the loss:

1) Add a resistor between the microcontroller and generator

2) Find the current through the resistance on the oscilloscope

3) Make the sensors sleep, and recover the current through the resistance on the oscilloscope

4) Make the microcontroller sleep, and recover the current through the resistance on the oscilloscope Our experimental results are as follows

We discover that when we make the microcontroller sleep, the loss of system is minimized. And when the microcontroller is awakened, the sensors can collect data and send it to Sigfox.
But there is a problem, when we make the microcontroller sleep, there is still the current between MCU and sensors, how to eliminate this current? Using Mosfet, We connect gate with digital output of MCU, we connect drain with sensors, and we connect source with pin of 3,3V of MCU. When the gate voltage is smaller than Vgs (gate threshold voltage), there is the block between source and drain, there’s no voltage at the end of the sensors. So when we make the microcontroller sleep, we must ensure the gate voltage is smaller than Vgs, and when MCU works, the gate voltage should be bigger than Vgs, these are the rules that for finding applicable Mosfet.