資料介紹
描述
在 Arduino IoT Cloud 的幫助下創建植物通訊器!
正如英國詩人威廉華茲華斯曾經說過的:
“你的思想是花園,你的思想是種子,收獲可以是花朵或雜草。”
讓我們的植物保持活力可能是一項相當大的挑戰,因為我們與植物之間缺乏清晰的溝通。讓他們開心的一種方法是把我們的植物帶在身邊,但也許我們不想帶著從冬季夾克口袋里伸出來的大仙人掌或蕨類植物四處走動。此外,大多數植物不喜歡寒冷。在花了幾個月時間嘗試與我們的吊蘭進行通信之后,我們放棄了,而是將 IoT Bundle 組件與 Arduino IoT Cloud 一起使用來創建一個設備,該設備可以遠程調查任何植物的健康狀況。
簡而言之
在這個實驗中,我們將學習如何保護我們的植物并確保它們存活下來,以及如何使用 Arduino 魔法。通過監測濕度、溫度和光照,我們可以確保我們的植物生長良好。
到該項目結束時,您的工廠將以可視化方式與您交流其需求,并通過 Arduino IoT CLoud 向您展示其目前的工作情況。
組件
注意:要實現此項目中演示的所有功能,您需要訂閱 Arduino IoT Cloud。通過刪除其中一個變量(光、溫度或濕度),可以在沒有 Arduino IoT Cloud 訂閱的情況下執行該項目。
學習目標
想知道更多?
本教程是讓您熟悉 Arduino RP2040 和物聯網的一系列實驗的一部分。所有實驗都可以使用 IoT Bundle 中包含的組件來構建。
- I Love You 枕頭與 Arduino 物聯網捆綁包
- 帶 Arduino IoT 捆綁包的拼圖盒
- 擁有 Arduino IoT Bundle 的書呆子
- 巴甫洛夫的貓與 Arduino IoT 捆綁包
設置 Arduino 物聯網云
如果您是 Arduino IoT Cloud 的新手,請查看我們的入門指南。
我們將從按照以下步驟設置 Arduino IoT Cloud 開始:
- 登錄到您的 Arduino 創建帳戶
- 創建一個東西
- 連接設備
- 添加變量
- 添加網絡憑據
變量
我們將從添加四個變量開始:
![pYYBAGPXKvuAM-TlAAFTqquRI2Q290.png](https://file.elecfans.com/web2/M00/8B/FC/pYYBAGPXKvuAM-TlAAFTqquRI2Q290.png)
設置硬件和草圖
DIY土壤水分
放置在土盆中的兩根導線構成一個可變電阻器,其阻值隨土壤濕度而變化。這個可變電阻器以分壓器配置連接,Arduino 收集與兩條線之間的電阻成比例的電壓。這意味著土壤越潮濕,Arduino 測量到的電壓就越低,因為土壤中的電阻會隨著水分的增加而降低。土壤越干燥,電阻越高。使用 1 兆歐電阻器和兩根電線,我們可以創建我們的 DIY 土壤濕度傳感器。
![pYYBAGPXKyGAXNhTAAe96khjXK8064.png](https://file.elecfans.com/web2/M00/8B/FC/pYYBAGPXKyGAXNhTAAe96khjXK8064.png)
該值將用于設置閾值,以便 Arduino 知道您的植物何時需要水。將下面顯示的代碼添加到您的草圖中并測試植物的水分含量。這些值顯示在串行監視器中。
#include "thingProperties.h"
int moisturePin = A2;
/* Set this threeshold accordingly to the resistance you used */
/* The easiest way to calibrate this value is to test the sensor in both dry and wet earth */
int threshold = 800;
void setup() {
/* Initialize serial and wait for port to open: */
Serial.begin(9600);
/* This delay gives the chance to wait for a Serial Monitor without blocking if none is found */
delay(1500);
/* Defined in thingProperties.h */
initProperties();
/* Connect to Arduino IoT Cloud */
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
/*
The following function allows you to obtain more information
related to the state of network and IoT Cloud connection and errors
the higher number the more granular information you’ll get.
The default is 0 (only errors).
Maximum is 4
*/
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
}
void loop() {
ArduinoCloud.update();
moisture = get_average_moisture();
Serial.print("moisture ");
Serial.println(moisture);
/* assign the message variable based on water levels */
if (moisture > threshold) {
message = "Warning your plant needs water!"; /* Insert here your emergency message */
} else {
message = "Your plant has enough water!";
}
Serial.println(message);
}
int get_average_moisture() {
int tempValue = 0; /* variable to temporarily store moisture value */
/* make an average of 10 values to be more accurate */
for (int a = 0; a < 10; a++) {
tempValue += analogRead(moisturePin);
delay(100);
}
return tempValue / 10;
}
/*
Since Message is READ_WRITE variable, onMessageChange() is
executed every time a new value is received from IoT Cloud.
*/
void onMessageChange() {
/* Add your code here to act upon Message change */
}
光和溫度傳感器
請參見下面的示意圖以連接兩個傳感器。我們將使用這兩個函數從傳感器讀取值:
![poYBAGPXKzWACc7QAAjA3JPqvPM938.png](https://file.elecfans.com/web2/M00/8B/77/poYBAGPXKzWACc7QAAjA3JPqvPM938.png)
#include "thingProperties.h"
int lightPin = A0; /*the analog pin the light sensor is connected to */
int tempPin = A1; /*the analog pin the TMP36's Vout (sense) pin is connected to */
int moisturePin = A2;
/* Set this threshold accordingly to the resistance you used */
/* The easiest way to calibrate this value is to test the sensor in both dry and wet earth */
int threshold = 800;
void setup() {
/* Initialize serial and wait for port to open: */
Serial.begin(9600);
/* This delay gives the chance to wait for a Serial Monitor without blocking if none is found */
delay(1500);
/* Defined in thingProperties.h */
initProperties();
/* Connect to Arduino IoT Cloud */
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
/*
The following function allows you to obtain more information
related to the state of network and IoT Cloud connection and errors
the higher number the more granular information you’ll get.
The default is 0 (only errors).
Maximum is 4
*/
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
}
void loop() {
ArduinoCloud.update();
light = analogRead(lightPin); /* assign light variable to light sensor values */
Serial.print("light ");
Serial.println(light);
temperature = get_temperature(); /* assign temperature variable to temperature in Celsius */
Serial.print("temperature ");
Serial.println(temperature);
moisture = get_average_moisture();
/* assign the message variable based on water levels */
if (moisture > threshold) {
message = "Warning your plant needs water!"; /* Insert here your emergency message */
} else {
message = "Your plant has enough water!";
}
}
int get_average_moisture() {
int tempValue = 0; /* variable to temporarly store moisture value */
/* make an average of 10 values to be more accurate */
for (int a = 0; a < 10; a++) {
tempValue += analogRead(moisturePin);
delay(100);
}
return tempValue / 10;
}
float get_temperature() {
int reading = analogRead(tempPin);
float voltage = reading * 3.3;
voltage /= 1024.0;
/* temperature in Celsius */
float temperatureC = (voltage - 0.5) * 100 ; /*converting from 10 mv per degree wit 500 mV offset */
/* Convert to Fahrenheit */
float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
return temperatureC;
}
void onMessageChange() {
/* Add your code here to act upon Message change */
}
請注意,您可以通過在“get_temperature()”函數末尾返回 temperatureF 而不是 temperatureC 來使用華氏度單位。
儀表板
部署項目的最后一步是使用 Arduino IoT 儀表板添加控制面板。我們可以導航到Dashboards -> Build Dashboard -> ADD,然后我們可以添加四個小部件并將它們鏈接到變量,如下所示:
- 圖形小部件 -> 溫度變量
- 圖形小部件 -> 濕度變量
- 儀表小部件 -> 光變量
- Messenger 小部件 -> 消息變量
現在,我們可以看到傳感器數據的可視化表示。
祝賀您現在已經構建了自己的 DIY 植物通訊器,展示了您的植物如何使用 IoT Bundle 和 IoT Cloud 進行操作。
想知道更多?
本教程是讓您熟悉 Arduino IoT Bundle 的一系列實驗的一部分。所有實驗都可以使用 IoT Bundle 中包含的組件來構建。
- Arduino自動化園藝植物
- 如何使用Arduino構建植物監視器
- Arduino IoT Cloud ESP32 Alexa Control智能家居
- IoT ONE Nixie Clock Arduino Cloud背光控制
- 使用Arduino創建煙霧探測器
- 基于Arduino Uno的植物澆水自動化設計 1次下載
- 帶arduino的植物澆水報警系統
- 如何使用此分線器創建Arduino項目
- 使用Arduino創建智能灌溉控制器
- 使用Alexa和Arduino IoT Cloud完全控制您的電視
- 帶有MKR WiFi 1010的植物通訊器
- Arduino智能植物孵化器
- Arduino通訊篇
- 基于Cloud Connected Zigbee IoT ThermostatSensing的參考設計
- Arduino板是什么如何使用IDE軟件創建和上傳Arduino程序到Arduino板
- 使用paramiko在eNSP的交換機中批量創建VLAN 1704次閱讀
- Arduino IoT Cloud開始與ChatGPT聯機運作 1642次閱讀
- 如何創建基于DCO的音頻合成器 1002次閱讀
- 如何解決Spring Cloud下測試環境路由問題 1049次閱讀
- 如何設置Arduino IoT將消息發送到云板顯示器 2303次閱讀
- 如何從網頁控制arduino? 4186次閱讀
- 如何利用Arduino創建一個電機滑動門 1786次閱讀
- 如何使用Arduino創建停車門禁控制系統? 5302次閱讀
- 歐司朗推出的新型LED技術幫助植物生長促進綠色生態 857次閱讀
- 米爾科技 Beetle IoT 評估板概述 1361次閱讀
- 遠程控制通訊--基于Arduino + ESP8266控制LED燈 4w次閱讀
- Arduino如何安裝驅動_Arduino安裝驅動步驟 5.9w次閱讀
- arduino是什么以及arduino能干什么 4.5w次閱讀
- 工程師DIY智能灌溉器解決植物澆水難題 2405次閱讀
- 用于植物的土壤加熱器 3964次閱讀
下載排行
本周
- 1山景DSP芯片AP8248A2數據手冊
- 1.06 MB | 532次下載 | 免費
- 2RK3399完整板原理圖(支持平板,盒子VR)
- 3.28 MB | 339次下載 | 免費
- 3TC358743XBG評估板參考手冊
- 1.36 MB | 330次下載 | 免費
- 4DFM軟件使用教程
- 0.84 MB | 295次下載 | 免費
- 5元宇宙深度解析—未來的未來-風口還是泡沫
- 6.40 MB | 227次下載 | 免費
- 6迪文DGUS開發指南
- 31.67 MB | 194次下載 | 免費
- 7元宇宙底層硬件系列報告
- 13.42 MB | 182次下載 | 免費
- 8FP5207XR-G1中文應用手冊
- 1.09 MB | 178次下載 | 免費
本月
- 1OrCAD10.5下載OrCAD10.5中文版軟件
- 0.00 MB | 234315次下載 | 免費
- 2555集成電路應用800例(新編版)
- 0.00 MB | 33566次下載 | 免費
- 3接口電路圖大全
- 未知 | 30323次下載 | 免費
- 4開關電源設計實例指南
- 未知 | 21549次下載 | 免費
- 5電氣工程師手冊免費下載(新編第二版pdf電子書)
- 0.00 MB | 15349次下載 | 免費
- 6數字電路基礎pdf(下載)
- 未知 | 13750次下載 | 免費
- 7電子制作實例集錦 下載
- 未知 | 8113次下載 | 免費
- 8《LED驅動電路設計》 溫德爾著
- 0.00 MB | 6656次下載 | 免費
總榜
- 1matlab軟件下載入口
- 未知 | 935054次下載 | 免費
- 2protel99se軟件下載(可英文版轉中文版)
- 78.1 MB | 537798次下載 | 免費
- 3MATLAB 7.1 下載 (含軟件介紹)
- 未知 | 420027次下載 | 免費
- 4OrCAD10.5下載OrCAD10.5中文版軟件
- 0.00 MB | 234315次下載 | 免費
- 5Altium DXP2002下載入口
- 未知 | 233046次下載 | 免費
- 6電路仿真軟件multisim 10.0免費下載
- 340992 | 191187次下載 | 免費
- 7十天學會AVR單片機與C語言視頻教程 下載
- 158M | 183279次下載 | 免費
- 8proe5.0野火版下載(中文版免費下載)
- 未知 | 138040次下載 | 免費
評論