电子发烧友App

硬声App

0
  • 聊天消息
  • 系统消息
  • 评论与回复
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
创作中心

完善资料让更多小伙伴认识你,还能领取20积分哦,立即完善>

3天内不再提示
电子发烧友网>电子资料下载>电子资料>创建小型模型监测和抽水系统

创建小型模型监测和抽水系统

2023-02-10 | zip | 0.10 MB | 次下载 | 免费

资料介绍

描述

介绍

农业和粮食生产是社会的一个主要方面,日常生活直接受到它的影响。我们正在寻求创建一个小型模型监测和抽水系统,以帮助维持家庭种植的植物的水位。未来的补充可以是大气水和温度监测。该项目旨在通过仔细平衡植物内的水位以确保不会因浇水过多或浇水不足而造成作物损失,至少是在小范围内解决作物损失问题。

流程/步骤

第 1 步:创建电路

按照链接的 Fritzing 图或面包板图像将电路放在一起。

 

 
 
 
pYYBAGOlJUmAW7MJAABZq1b8f9U017.png
 
1 / 2设备面包板接线示意图
 

第 2 步:云交互

IoT Cloud 上创建东西以设置用于云连接的仪表板

 
 
 
poYBAGOlJUuAZ9CwAAAzoTk4ckw371.png
 
1 / 2变量列表
 

首先在 Arduino IoT Cloud 上创建“事物”。然后创建你的三个变量;给出了信息查看仪表板图像以查看变量是“只读”还是“读/写”。最后创建仪表板并将变量链接到适当的小部件。

第 3 步:代码 [.ino]

将以下代码复制到 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 步:设置 Internet 连接

在 Arduino 编辑器的“秘密”选项卡中,设置您的无线网络 ID 和密码。测试并确保您的设备正确连接到云。

风险

运行这个项目有几个风险。

  • 短路的可能性:该项目中用水会造成危险,因此可能会以“试运行”的形式进行测试。
  • 项目结果可能无法准确工作,因为传感器读数可能不一致或结果解释不准确。

下载该资料的人也在下载 下载该资料的人还在阅读
更多 >

评论

查看更多

下载排行

本周

  1. 1储能电源市场分析
  2. 7.99 MB  |  11次下载  |  免费
  3. 2储能电源市场分析报告
  4. 2.61 MB   |  7次下载  |  免费
  5. 3labview文档教程资料(一)
  6. 24.29 MB   |  2次下载  |  免费
  7. 4第三代SiC功率半导体动态可靠性测试系统介绍
  8. 8.02 MB   |  1次下载  |  免费
  9. 5用于便携可穿戴设备的RX8130CE
  10. 277.67 KB  |  1次下载  |  免费
  11. 6英集芯IP5353 QFN32 规格书pdf
  12. 2.70 MB  |  1次下载  |  免费
  13. 742V、5A SIMPLE SWITCHER® 特性降压稳压器LM22677/-Q1数据表
  14. 1.54MB   |  1次下载  |  免费
  15. 83.5V 至 36V 输入、1V 至 20V 输出、6A 电源模块LMZM33606数据表
  16. 1.97MB   |  1次下载  |  免费

本月

  1. 1STM32国内外发展现状
  2. 1.15 MB   |  16次下载  |  免费
  3. 2传感芯片选型指南
  4. 3.60 MB   |  12次下载  |  免费
  5. 3储能电源市场分析
  6. 7.99 MB  |  11次下载  |  免费
  7. 4ATmega8芯片中文手册
  8. 2.45 MB   |  8次下载  |  1 积分
  9. 5TDK电容器产品指南
  10. 11.88 MB   |  7次下载  |  1 积分
  11. 62A多电池高效开关充电器AN_SY6912A中文资料规格书
  12. 1.43 MB   |  7次下载  |  免费
  13. 7储能电源市场分析报告
  14. 2.61 MB   |  7次下载  |  免费
  15. 816A 输出电流,高可靠、高效率 同步降压转换器PCD3201产品手册
  16. 0.47 MB   |  6次下载  |  免费

总榜

  1. 1matlab软件下载入口
  2. 未知  |  935091次下载  |  免费
  3. 2开源硬件-PMP21529.1-4 开关降压/升压双向直流/直流转换器 PCB layout 设计
  4. 1.48MB  |  420050次下载  |  免费
  5. 3Altium DXP2002下载入口
  6. 未知  |  233068次下载  |  免费
  7. 4电路仿真软件multisim 10.0免费下载
  8. 340992  |  191317次下载  |  免费
  9. 5十天学会AVR单片机与C语言视频教程 下载
  10. 158M  |  183316次下载  |  免费
  11. 6labview8.5下载
  12. 未知  |  81567次下载  |  免费
  13. 7Keil工具MDK-Arm免费下载
  14. 0.02 MB  |  73789次下载  |  免费
  15. 8NI LabVIEW中实现3D视觉的工具和技术
  16. 未知  |  70088次下载  |  免费