The environmental monitoring equipment of agricultural greenhouse integrates the measurement sensors of some key indicators in the greenhouse (including carbon dioxide, light intensity, temperature, humidity and ultraviolet). ShineBlink universal core board collects these sensor data and uploads them to smart cloud; Then we can remotely access the environmental data in the greenhouse through mobile App or Web page. At the same time, we can also push real-time monitoring information and alarm information to managers through mobile phones, computers and other information terminals, so as to realize the informatization and intelligent remote management of the on-site environment.
Video tutorial and physical display
Video demo tutorial:
[ten minute development of Internet of things] - realization of environmental monitoring equipment in agricultural greenhouse (CO2 + Light + temperature and humidity + ultraviolet)
Physical wiring diagram and App monitoring page:
Hardware terminal wiring diagram
Bill of materials
name | Recommended purchase source | Data download |
---|---|---|
General smartphone cloud App | free | |
ShineBlink universal Internet of things development board | Taobao searches "smart cloud" or "ShineBlink" stores for sale | |
ML302 4G module with smart cloud GAgent firmware | Taobao searches "smart cloud" or "ShineBlink" stores for sale | |
Temperature and humidity, ultraviolet and light intensity sensor module | Taobao searches "ShineBlink" stores for sale, or any other stores (functions are similar) | |
Black base plate | The backplane is only to save the connection of DuPont line and make the appearance look better. It is not a necessity. If developers do not have DuPont line, they can replace it. If you still want to obtain the backplane, you can make your own proofing PCB through the PCB engineering data provided on the right. |
Complete hardware source code
--Definition function: the sensor output voltage(Company: mv)Convert to UV index index function GetUvIndex(v) if v < 50.0 then index = 0 elseif v < 227.0 then index = 1; elseif v < 318.0 then index = 2; elseif v < 408.0 then index = 3; elseif v < 503.0 then index = 4; elseif v < 606.0 then index = 5; elseif v < 696.0 then index = 6; elseif v < 795.0 then index = 7; elseif v < 881.0 then index = 8; elseif v < 976.0 then index = 9; elseif v < 1079.0 then index = 10; else index = 11 end return index end --Enable USB print Output printing LIB_UsbConfig("CDC") --The smart cloud platform assigns unique information to each product category PK and PS,Be sure to change it to your own PK and PS PK = "e38ca091f2394517bbe286ac7d1ce284" PS = "a4524a44b93f498c89f67086c19b3d81" --Initialization 4 G modular LIB_Giz4GConfig(PK,PS,1000,120,"UART0","D5","HIGH","D6","HIGH") --to configure A0-A3 The four voltage acquisition channels start working at the same time. When each channel collects 50 points, the cache is full, and the acquisition time interval of each point is 10 ms LIB_ADConfig(50,10000) --set up Z19C Formaldehyde sensor occupancy TX1 and RX1 Pin and start the sensor,Turn off automatic calibration("AUTO_CALI_DIS") LIB_Z19CConfig("UART1","AUTO_CALI_DIS") --set up sht3x Sensor occupancy SCL0 and SDA0 Pin and start the sensor to work at the frequency of 10 data per second, repeatability="HIGH"Time accuracy is the highest LIB_Sht3xConfig("IIC0","10","HIGH") --set up BH1750 Light intensity sensor occupied SCL1 and SDA1 Pin and start the sensor to output 5 groups of data per second LIB_BH1750Config("IIC1") --Start big cycle while(GC(1) == true) do LIB_DelayMs(50) --Query whether the temperature and humidity data is read sht3x_flag,sht3x_temp,sht3x_humi = LIB_Sht3xGetResult() if sht3x_flag == 1 then --Print the read temperature and humidity value with 2 decimal places print(string.format("temp: %.2f\r\nhumi: %.2f", sht3x_temp, sht3x_humi)) --Send to smart ECS(Temperature and humidity)Short integer value(Rounding off decimal parts) LIB_SendToGizCloud("Rs1", math.floor(sht3x_temp)) LIB_SendToGizCloud("Rs2", math.floor(sht3x_humi)) end --Check whether the light intensity sensor counts flag, illumination = LIB_BH1750GetResult() if flag == 1 then --The value of light intensity, in Lux, excluding the decimal part(Lx) print(string.format("illumination: %.0f (Lx)", illumination)) --Send short integer illumination intensity value to smart ECS(Rounding off decimal parts),Company: Lx LIB_SendToGizCloud("Rs4", math.floor(illumination)) end --Query whether to read CO2 Sensor value flag,co2_val = LIB_Z19CGetCO2() if flag == 1 then --Print read co2 value print(string.format("CO2:%d PPM", co2_val)) --Send to smart ECS(co2)Integer value, short integer LIB_SendToGizCloud("Rs5", co2_val) end --Query whether to read A1 Voltage acquisition value of port (UV) A1_full_flag, A1_tab = LIB_ADCheckBufFull("A1") --whenever A1 After the cache of the channel is full, calculate the average value of 50 elements in the cache and convert it into voltage value --from LIB_ADConfig(50,10000)It can be calculated that this is about 50 X10000us=0.5 Once per second if A1_full_flag == 1 then SUM = 0 for i = 1, #A1_tab do --here#A1_ The value of tab is 50, indicating A1_ Number of elements in tab table SUM = SUM + A1_tab[i] end AVER = SUM / #A1_tab -- calculate average sample value --take A0 Channeled AD The value is converted to the actual voltage and printed vol_mv = AVER*3600/4096.0 --Print out the voltage value output by the sensor, and keep two digits after the decimal point mV print(string.format("ultraviolet voltage=%.2fmV\r\n", vol_mv)) uv_index = GetUvIndex(vol_mv)--Convert voltage to UV level index --Print UV level, 0~11 print(string.format("ultraviolet level=%d\r\n", uv_index)) --Send UV level to smart ECs, short integer LIB_SendToGizCloud("Rs3", uv_index) end end
The detailed description of the library function starting with "LIB_" in the above code can be queried in the API document on shineblink.com website.
Smart cloud access and App development (three options)
► select one: smart cloud + general APP access device (the least difficult)
Through the, we can quickly master the access process of the smart cloud, and use the ready-made general version of the smart cloud App to quickly realize the remote access of the mobile App to our development board.
In this example, we use the five data points "RS1", "RS2", "RS3", "RS4" and "RS5" as the short integer values of the five sensors: temperature, humidity, UV level, light intensity and CO2. Remember to modify the names of the corresponding data points on the smart cloud platform.
► option 2: smart cloud + zero code customized App access device (less difficult)
Before selecting two, you must complete the work of selecting one above, and then refer to the tutorial to realize the customized App access device.
The developed page is as follows:
► option 3: customized development of APP or wechat applet (more difficult)
If you have certain development capabilities, developers can consider making certain customized development on the open source code provided by smart cloud for free to form their own apps.
If developers want to develop an exclusive App, smart cloud will also provide open-source Android and IOS SDK frameworks to help developers quickly complete App development. Developers only need to pay attention to the UI and UE design of the App, while relatively complex protocols and error handling can be ignored. For an introduction to and access to the open source SDK, please go to docs.gizwits.com Learn more.
If developers want to develop an exclusive wechat applet application, they can enter docs.gizwits.com Learn about related development tutorials.