使用 Arduino / 适用于 Arduino 的 XMPP 客户端实现家庭自动化

发布于 2024-08-13 11:40:45 字数 1250 浏览 5 评论 0原文

我正在尝试设置一个系统来自动执行家里的某些任务。

我正在考虑一种解决方案,其中服务器端应用程序能够向 Arduino< 发送/接收命令/数据/a>(附有 Arduino 以太网扩展板)通过网络。

在这里,Arduino 可以充当服务器应用程序的传感器接口或服务器应用程序的命令执行器接口。

例如(用户故事):

  1. 我家的高架水箱有一个与 Arduino 相连的水位传感器(附有 Arduino 以太网扩展板)。

  2. 另一个 Arduino(附有 Arduino 以太网扩展板)附有继电器/锁存器。然后将该继电器/锁存器连接到水泵。

  3. 现在网络上的服务器端应用程序可以从水箱上的 Arduino 获取/接收水位信息。

  4. 根据收到的水位信息,Web 应用程序应向水泵上的 Arduino 发送适当的信号/命令,以“打开”或“关闭”水泵。

现在,为了让这样的系统在网络上工作,我正在考虑按照优先顺序使用其中一种解决方案:

  1. 使用 XMPP 用于服务器应用程序和 Arduino 之间的通信。

  2. 使用 HTTP 轮询。

  3. 使用 HTTP 悬挂 GET。

对于解决方案 1,我需要实现一个驻留在 Arduino 上的 XMPP 客户端。

是否可以编写一个足够小的 XMPP 客户端以驻留在 Arduino 上?

如果是的话,我需要为 Arduino 编写的最小可能的 XMPP 客户端功能是什么,以便它能够联系 XMPP 服务器解决方案,例如 GTalk等?

对于解决方案 2 和 3,我需要实施指导。

另外,哪种解决方案具有成本效益且易于扩展?

I am trying to setup a system for automating certain tasks in my home.

I am thinking of a solution wherein a server side application would be able to send/receive commands/data to Arduino (attached with Arduino Ethernet Shield) via the web.

Here the Arduino may both act as a sensor interface to the server application or command executor interface for the server app.

E.g. (user story):

  1. The overhead water tank in my house has a water level sensor attached with Arduino (attached with Arduino Ethernet Shield).

  2. Another Arduino (attached with Arduino Ethernet Shield) is attached with a relay/latch. This relay/latch is then connected to a water pump.

  3. Now the server side application on the web is able to get/receive water level information from the Arduino on the water tank.

  4. Depending on the water level information received, the web application should send suitable signals/commands to Arduino on water pump to switch 'ON' or switch 'OFF' the water pump.

Now for such a system to work across the web, I am thinking of using one of the type of solutions in order of my priority:

  1. Using XMPP for communication between server application and Arduino.

  2. Using HTTP polling.

  3. Using HTTP hanging GET.

For solution number 1, I need to implement a XMPP client that would reside on Arduino.

Is it possible to write a XMPP client small enough to reside on an Arduino?

If yes what are the minimum possible XMPP client functionality that I need to write for Arduino, so that it would be able to contact XMPP servers solutions like GTalk, etc.?

For solution number 2 and 3 I need guidance in implementation.

Also which solution would be cost effective and easily extendable?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

睫毛上残留的泪 2024-08-20 11:40:45

你可以看看MQTT,它有一个arduino库,它是一个简单的发布者-订阅者消息代理。

You can take a look at MQTT, it has an arduino library, its a simple publisher-subscriber message broker.

飘落散花 2024-08-20 11:40:45

我认为我不会为您想做的事情而寻找其中任何一个。

只需按照给定的时间间隔从 Arduino 输出传感器数据,然后让另一方进行智能操作即可。

另外,对于这些类型的项目,我一直在寻求避免以太网屏蔽并使用 XBee 或 RFM12B。这些将引导您朝这个方向发展,但更重要的是,使更多设备进行遥测和控制变得更加容易。

如果有像 XMPP 这样的东西可以在 Arduino 上运行,那它就真的是一个精简版了通过更智能的服务器端进程代理存在协议。也就是说,这将是类似的工作量。尽管有可能,但 1 KB RAM 中的 XMPP 和应用程序代码听起来确实很痛苦。

I don't think I'd look for any of those for what you're trying to do.

Just feed the sensor data out of the Arduino on a given interval and have the other side do the smarts.

Also, for these types of projects, I've been looking to avoid the Ethernet shields and use either XBee or RFM12B. These would guide you in that direction, but more importantly, make it far easier to have lots more devices doing both telemetry and control.

If there were something like XMPP that ran on the Arduino, it'd be a really stripped down presence protocol proxied through a smarter server-side process. That is, it'd be a similar amount of work. Though it may be possible, XMPP in 1 KB of RAM alongside your application code sounds really painful.

大海や 2024-08-20 11:40:45

我们正在开发一个开源中继基础设施,以使 Arduino(以及任何其他支持 TCP/IP 套接字的设备)可以通过 Web 进行访问。然后,您的应用程序可以通过简单的 REST API 调用 Arduino。请参阅 http://www.yaler.org/ 了解更多信息和现场演示。

问候,
坦贝格

We're working on an open source relay infrastructure to make Arduinos (and any other device supporting TCP/IP sockets) accessible over the Web. Your application could then call the Arduinos through a simple REST API. See http://www.yaler.org/ for more info and a live demo.

Regards,
tamberg

可是我不能没有你 2024-08-20 11:40:45

有一个项目正在开发中,具有策略和数据记录器功能。 (通过 xmpp 的传感器/any_data_source)
http://middlewaresensing.wordpress.com/

There is a project in development, has policies and data recorder capabilities. (sensors/any_data_source over xmpp)
http://middlewaresensing.wordpress.com/

箜明 2024-08-20 11:40:45

为什么不使用老式的 RS485 来连接传感器执行器?
只需发明一些简单的协议(地址、命令、数据)即可。如果您需要更复杂的东西,请使用另一个人作为 RS485/以太网桥。

Why not use the good old RS485 to reach the sensor actuators?
Just invent some simple protocol (address, command, data). If you need something more complex, use another guy as a RS485/ethernet bridge.

愁以何悠 2024-08-20 11:40:45

开源项目

管理传感器和网络|记录传感器数据|图表|政策|历史/日期/传感器规则 |短信/电子邮件/url/twitter/xmpp 通知 |事件记录|谷歌地图 |以及更多

演示,请访问 http://dev.hci.uma.pt/sawa

wiki dev.hci.uma.pt/mediawiki/index.php

博客位于 middlewaresensing.wordpress.com

您可以使用 HTTP Post 将数据发送到服务器,然后通过 XMPP 发布传感器数据。
HTTP Post(适用于资源有限的设备,例如 arduino)
sox_tools 是一个 xmpp 客户端,用于通过该系统上的 xmpp 发布

Open source project

Manage sensors and networks | record sensor data | charts | policies | history/date/sensor rules | sms/email/url/twitter/xmpp notifications | event logging | Google Maps | and much more

demo at http://dev.hci.uma.pt/sawa

wiki at dev.hci.uma.pt/mediawiki/index.php

blog at middlewaresensing.wordpress.com

You can use send data to server using HTTP Post, then sensor data is published via XMPP.
HTTP Post (for resource limited devices, such as arduino)
and sox_tools a xmpp client for publish via xmpp on this system

最佳男配角 2024-08-20 11:40:45

有一个名为 RESTduino 的新库,用于在 Arduino(带有以太网)上发出类似 REST 的 HTTP 请求并接收 JSON 响应。对于您的 Arduino 项目来说,它可能是有用的嵌入式 HTTP 接口。

http://jasongullickson.posterous.com/restduino-arduino -为我们其他人黑客攻击

There is a new library for making REST-like HTTP requests and receiving JSON responses on an Arduino (with Ethernet) called RESTduino. It could be useful drop-in HTTP interface for your Arduino project.

http://jasongullickson.posterous.com/restduino-arduino-hacking-for-the-rest-of-us

孤君无依 2024-08-20 11:40:45

在研究了所有可用的选项后,我对任何一个都不满意。

目前,我正在努力为我上面定义的问题提供自己的解决方案。

解决方案就在我上面回复“达斯汀”的评论中。

一旦我在这里提出我的解决方案的第一个版本,就会发布项目 URL。

After looking into all of the available options I was not satisfied with any.

Currently I am working on to put my own solution to the problem that i defined above.

The solution is on the lines of the comment that i replied to 'Dustin' above.

Will post the project URL as soon as i come up with the first release of my solution here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文