電子發(fā)燒友App

硬聲App

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評(píng)論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學(xué)習(xí)在線課程
  • 觀看技術(shù)視頻
  • 寫文章/發(fā)帖/加入社區(qū)
會(huì)員中心
創(chuàng)作中心

完善資料讓更多小伙伴認(rèn)識(shí)你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示
創(chuàng)作
電子發(fā)燒友網(wǎng)>電子資料下載>電子資料>創(chuàng)建小型模型監(jiān)測(cè)和抽水系統(tǒng)

創(chuàng)建小型模型監(jiān)測(cè)和抽水系統(tǒng)

2023-02-10 | zip | 0.10 MB | 次下載 | 免費(fèi)

資料介紹

描述

介紹

農(nóng)業(yè)和糧食生產(chǎn)是社會(huì)的一個(gè)主要方面,日常生活直接受到它的影響。我們正在尋求創(chuàng)建一個(gè)小型模型監(jiān)測(cè)和抽水系統(tǒng),以幫助維持家庭種植的植物的水位。未來的補(bǔ)充可以是大氣水和溫度監(jiān)測(cè)。該項(xiàng)目旨在通過仔細(xì)平衡植物內(nèi)的水位以確保不會(huì)因澆水過多或澆水不足而造成作物損失,至少是在小范圍內(nèi)解決作物損失問題。

流程/步驟

第 1 步:創(chuàng)建電路

按照鏈接的 Fritzing 圖或面包板圖像將電路放在一起。

?

?
?
?
pYYBAGOlJUmAW7MJAABZq1b8f9U017.png
?
1 / 2 ?設(shè)備面包板接線示意圖
?

第 2 步:云交互

IoT Cloud 上創(chuàng)建東西以設(shè)置用于云連接的儀表板

?
?
?
poYBAGOlJUuAZ9CwAAAzoTk4ckw371.png
?
1 / 2 ?變量列表
?

首先在 Arduino IoT Cloud 上創(chuàng)建“事物”。然后創(chuàng)建你的三個(gè)變量;給出了信息。查看儀表板圖像以查看變量是“只讀”還是“讀/寫”。最后創(chuàng)建儀表板并將變量鏈接到適當(dāng)?shù)男〔考?/font>

第 3 步:代碼 [.ino]

將以下代碼復(fù)制到 Arduino IDE 中...

/* 
 Sketch generated by the Arduino IoT Cloud Thing "AutoGarden"
 https://create.arduino.cc/cloud/things/36881e31-0b15-4ae9-ad3d-c0bee1f0ea06 
 Arduino IoT Cloud Variables description
 The following variables are automatically generated and updated when changes are made to the Thing
 int moisture;
 bool RunPump;
 Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
 which are called when their values are changed from the Dashboard.
 These functions are generated with the Thing and added at the end of this sketch.
*/
#include "thingProperties.h"
#define PumpRunner 0 // set the pin for the pump
int val = 0; // returned value from soil moisture sensor
int soilPin = A0; // pin for reading from the soil moisture sensor
int soilPower = 7; // pin for powering the the soil moisture sensor.
int setMLevel;
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();
 pinMode(PumpRunner, OUTPUT);
 pinMode(soilPower, OUTPUT);
 digitalWrite(soilPower, LOW);
}
void loop() {
 ArduinoCloud.update();
 // Your code here 
 moisture = readSoil();
 moisture = map(moisture, 0, 700, 0, 100);
 Serial.println(moisture);
 digitalWrite(PumpRunner, LOW);
 delay(1000);
 if(moisture <= setMLevel && moisture >= 10){
   RunPump = true;
 }
 if(RunPump){
   digitalWrite(PumpRunner, HIGH);
   delay(1000); // pump takes a second or two to start up
   digitalWrite(PumpRunner, LOW);
   delay(1000); // one second delay so water can settle
   RunPump = false;
 }
 delay(1000);// remaining delay, go to value minus 3010
}
int readSoil(){
 digitalWrite(soilPower, HIGH);
 delay(10);
 val = analogRead(soilPin);
 digitalWrite(soilPower, LOW);
 return val;
}

第 4 步:屬性代碼

// Code generated by Arduino IoT Cloud, DO NOT EDIT.
#include <ArduinoIoTCloud.h>
#include <Arduino_ConnectionHandler.h>
const char THING_ID[] = "36881e31-0b15-4ae9-ad3d-c0bee1f0ea06";
const char SSID[]     = SECRET_SSID;    // Network SSID (name)
const char PASS[]     = SECRET_PASS;    // Network password (use for WPA, or use as key for WEP)
void onSetMLevelChange();
void onRunPumpChange();
int moisture;
int setMLevel;
bool RunPump;
void initProperties(){
 ArduinoCloud.setThingId(THING_ID);
 ArduinoCloud.addProperty(moisture, READ, ON_CHANGE, NULL);
 ArduinoCloud.addProperty(setMLevel, READWRITE, ON_CHANGE, onSetMLevelChange);
 ArduinoCloud.addProperty(RunPump, READWRITE, ON_CHANGE, onRunPumpChange);
}
WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS);

第 5 步:設(shè)置 Internet 連接

在 Arduino 編輯器的“秘密”選項(xiàng)卡中,設(shè)置您的無線網(wǎng)絡(luò) ID 和密碼。測(cè)試并確保您的設(shè)備正確連接到云。

風(fēng)險(xiǎn)

運(yùn)行這個(gè)項(xiàng)目有幾個(gè)風(fēng)險(xiǎn)。

  • 短路的可能性:該項(xiàng)目中用水會(huì)造成危險(xiǎn),因此可能會(huì)以“試運(yùn)行”的形式進(jìn)行測(cè)試。
  • 項(xiàng)目結(jié)果可能無法準(zhǔn)確工作,因?yàn)?a href='http://srfitnesspt.com/v/tag/117/' target='_blank' class='arckwlink_none'>傳感器讀數(shù)可能不一致或結(jié)果解釋不準(zhǔn)確。

下載該資料的人也在下載 下載該資料的人還在閱讀
更多 >

評(píng)論

查看更多

下載排行

本周

  1. 1山景DSP芯片AP8248A2數(shù)據(jù)手冊(cè)
  2. 1.06 MB  |  532次下載  |  免費(fèi)
  3. 2RK3399完整板原理圖(支持平板,盒子VR)
  4. 3.28 MB  |  339次下載  |  免費(fèi)
  5. 3TC358743XBG評(píng)估板參考手冊(cè)
  6. 1.36 MB  |  330次下載  |  免費(fèi)
  7. 4DFM軟件使用教程
  8. 0.84 MB  |  295次下載  |  免費(fèi)
  9. 5元宇宙深度解析—未來的未來-風(fēng)口還是泡沫
  10. 6.40 MB  |  227次下載  |  免費(fèi)
  11. 6迪文DGUS開發(fā)指南
  12. 31.67 MB  |  194次下載  |  免費(fèi)
  13. 7元宇宙底層硬件系列報(bào)告
  14. 13.42 MB  |  182次下載  |  免費(fèi)
  15. 8FP5207XR-G1中文應(yīng)用手冊(cè)
  16. 1.09 MB  |  178次下載  |  免費(fèi)

本月

  1. 1OrCAD10.5下載OrCAD10.5中文版軟件
  2. 0.00 MB  |  234315次下載  |  免費(fèi)
  3. 2555集成電路應(yīng)用800例(新編版)
  4. 0.00 MB  |  33566次下載  |  免費(fèi)
  5. 3接口電路圖大全
  6. 未知  |  30323次下載  |  免費(fèi)
  7. 4開關(guān)電源設(shè)計(jì)實(shí)例指南
  8. 未知  |  21549次下載  |  免費(fèi)
  9. 5電氣工程師手冊(cè)免費(fèi)下載(新編第二版pdf電子書)
  10. 0.00 MB  |  15349次下載  |  免費(fèi)
  11. 6數(shù)字電路基礎(chǔ)pdf(下載)
  12. 未知  |  13750次下載  |  免費(fèi)
  13. 7電子制作實(shí)例集錦 下載
  14. 未知  |  8113次下載  |  免費(fèi)
  15. 8《LED驅(qū)動(dòng)電路設(shè)計(jì)》 溫德爾著
  16. 0.00 MB  |  6656次下載  |  免費(fèi)

總榜

  1. 1matlab軟件下載入口
  2. 未知  |  935054次下載  |  免費(fèi)
  3. 2protel99se軟件下載(可英文版轉(zhuǎn)中文版)
  4. 78.1 MB  |  537798次下載  |  免費(fèi)
  5. 3MATLAB 7.1 下載 (含軟件介紹)
  6. 未知  |  420027次下載  |  免費(fèi)
  7. 4OrCAD10.5下載OrCAD10.5中文版軟件
  8. 0.00 MB  |  234315次下載  |  免費(fèi)
  9. 5Altium DXP2002下載入口
  10. 未知  |  233046次下載  |  免費(fèi)
  11. 6電路仿真軟件multisim 10.0免費(fèi)下載
  12. 340992  |  191187次下載  |  免費(fèi)
  13. 7十天學(xué)會(huì)AVR單片機(jī)與C語言視頻教程 下載
  14. 158M  |  183279次下載  |  免費(fèi)
  15. 8proe5.0野火版下載(中文版免費(fèi)下載)
  16. 未知  |  138040次下載  |  免費(fèi)