如何使Android设备成为从设备,并从物联网硬件(如Electric Imp,Arduiono甚至PC)读取从设备数据? [英] How to make android device as slave and read the slave data from iot hardware as Electric Imp, Arduiono or even PC?

查看:62
本文介绍了如何使Android设备成为从设备,并从物联网硬件(如Electric Imp,Arduiono甚至PC)读取从设备数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种解决方案,其中我的Android设备通过USB连接到IoT设备,例如Electric Imp,Arduino或Windows PC.

I am looking for a solution where my Android Device is connected to IoT devices such as Electric Imp, Arduino or Windows PC via USB.

因此,这里的要求是我想在Android USB端口上写入一些数据(文本或二进制数据),以便通过USB连接的其他IoT设备能够读取该数据.

So the requirement here comes that I want to write some data(text or binary data) at my Android USB port so that the other IoT devices which are connected via USB are able to read that data.

Android设备将充当从设备,物联网设备将充当主设备,以读取信息.

Android Device will act as a slave and IoT devices will act as master which will read the information.

注意:没有与WiFi或蓝牙的连接,只需要通过USB即可.

Note: There is no connection with WiFi or Bluetooth, only via USB it is needed.

推荐答案

实际上,这对于架构而言可能是个坏主意,但如果您要追求的是Android

This is in practical terms likely a bad idea as an architecture, but if you want to pursue it is is exactly what the Android USB Accessory Protocol was designed to enable.

您需要一个能够作为USB主机的嵌入式设备,参考实现是Android附件开发套件(ADK),认为硬件从来都不是一个好选择,并且已经过时了,即使在那个时代,具有本机USB主机支持的ARM MCU都是已经很常见了.

You need an embedded device capable of being a USB host, the reference implementation was the Android Accessory Development Kit (ADK) thought that hardware was never a great choice and obsolete as even in it's era ARM MCU's with native USB host support were already common.

请注意,此方法与Android设备为USB主机的"USB OTG"相反.尽管附件模式需要功能更强大的嵌入式硬件(仅支持主机而不是设备),但附件模式受到Android设备的更广泛支持,其中一些无法在OTG模式下运行,并且许多附件在运行时会很快耗尽电池电量.但是,与通常为半永久连接的接口选择的连接器类型相比,两者都遭受到与雕刻手机的物理USB连接的困扰,这些连接经常造成断续且容易损坏的连接.

Note that this method is opposite that of "USB OTG" where the Android devices is the USB host. Although Accessory mode requires a more capable embedded hardware (with host vs only device support) Accessory mode is more widely supported by Android devices, some of which cannot function in OTG mode, and many of which rapidly run down their battery when doing so. But both suffer from the physical USB connection to a sculpted-for-a-hand phone often making an intermittent and easily damaged connection in comparison to the sorts of connectors typically chosen for interfaces which will be semi-permanently connected.

这篇关于如何使Android设备成为从设备,并从物联网硬件(如Electric Imp,Arduiono甚至PC)读取从设备数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆