简体   繁体   English

Arduino +蓝牙模块+ Android

[英]Arduino + Bluetooth module + Android

I'm trying to think of a way to do a simple home automation project that involves an Arduino, a Bluetooth module and an Android phone. 我正在尝试一种方法来完成一个涉及Arduino,蓝牙模块和Android手机的简单家庭自动化项目。 The idea is that I have two Arduino boards in different parts of my home. 这个想法是我在家里的不同地方有两个Arduino板。 And if I walk into a room then a LED lights up on the board that has discovered my phone. 如果我走进一个房间,发现我手机的板上的LED就会点亮。 If I walk out of the Bluetooth range, the LED should turn off. 如果我走出蓝牙范围,指示灯应该熄灭。

I have tried the DomoticHome project with a router, but it's only for manual on/off and it's based on the Ethernet module. 我已经尝试过使用路由器的DomoticHome项目,但是它仅用于手动开/关,它基于以太网模块。

I don't want to make an Android application from scratch, but I would like to take some existing open-source application that I could extend to use Bluetooth and/or turn on the LED automatically. 我不想从头开始制作Android应用程序,但是我想使用一些现有的开源应用程序,可以扩展为使用蓝牙和/或自动打开LED。

Actually, you might skip that Android application requirement. 实际上,您可能会跳过该Android应用程序要求。 Just make the Arduino board l2ping your phone by Bluetooth periodically and switch your LED based on success or fail. 只需使Arduino开发板定期通过蓝牙您的手机进行充电 ,然后根据成功或失败来切换LED。

As a side effect, you could automate with just any phone, that supports Bluetooth. 副作用是,您可以使用支持蓝牙的任何电话自动进行操作。 But the devil is in the detail. 但是细节决定成败。 It might be necessary to pair boards and phone initially. 最初可能需要将板和电话配对。

Additionally, most Android phones switch off visibility after a minute or two. 此外,大多数Android手机在一到两分钟后就会关闭可见性。 So you will have to check, whether a ping will work then. 因此,您必须检查ping是否可以正常工作。 (I don't know whether l2ping is available on Arduino out of the box, but it should be portable easily.) Trying to open a Bluetooth port on your mobile device may be an alternative to l2ping. (我不知道l2ping是否在现成的Arduino上可用,但它应该很容易携带。)尝试在移动设备上打开蓝牙端口可能是l2ping的替代方法。 So a no-application-solution should be possible. 因此,没有应用程序解决方案应该是可能的。

最好的方法是每1秒或2秒使用一次握手信号..如果手机收到我应回复HI的信号,则蓝牙模块应发送HI。一旦手机不回复,应将灯关闭。如果它接收到HI,则应重新打开灯。.我有一个代码,可以使用串行通信连接到这些蓝牙模块。.它非常简单易用..我将检查并向您发送代码。 ..

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM