如何使用 Android 设备 3.5 毫米耳机插孔读取/发送数据?
我只是在 EE Stack 上跌跌撞撞,发现了这篇文章:什么协议耳机插孔的使用。它激发了我的一些好奇心,我想,如果是 iPhone能做到,我也想做。
有谁知道现在有什么项目正在这样做或者它是否可能?
更新
RIP
I was just stumbling around EE Stack and found this post: What protocol does a headphone jack use. And it sparked some curiosity in me, and I figure, if the iPhone can do it, I want to as well.
Does any one know of any projects that are doing this now or whether or not it's even possible?
UPDATE
RIP
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您基本上是在问如何将麦克风输入转换为调制解调器输入。 Square 将这种巧妙技术的变体用于商业用途,用于 iOS 和 Android 设备上的磁条阅读器。
为此,需要从 Android 访问原始 PCM 流并对输入进行解码。对你来说幸运的是,有人已经做到了并将源代码扔到了那里。有关 Arduino 和 Android 示例,请参阅此 Hack a Day 链接项目仅用于传输的代码。
我找不到用于接收的示例 Android 代码,但在 此 Arduino 论坛帖子。
(虽然这不是你的问题,但从 Android 设备获取数据的更简单方法是新的 USB 主机和配件 支持。它需要新的手机和操作系统,因此不如音频路由灵活。)
You are basically asking how to turn the microphone input into a modem input. A variant of this clever technique is used commercially by Square for their magstripe readers on both iOS and Android devices.
To do so requires getting access to the raw PCM stream from Android and decoding the input. Luckily for you, someone has already done it and thrown the source out there. See this Hack a Day linked project for sample Arduino and Android code for transmitting only.
I couldn't find example Android code to receive, but there are rather extensive notes on doing FSK with iOS in this Arduino forum post.
(Though it wasn't your question, an easier way to get data in and out of an Android device is the new USB Host and Accessory support. It requires a newish phone and OS, so not as flexible as the audio route.)
我编写了一个 C 库,它可以通过音频电缆以 64kbps 的速度发送和接收数据。 https://github.com/quiet/quiet
就调制技术而言,它支持多种,因为它使用 SDR 库来执行调制。
如果您想尝试一下,这里有一个现场演示 https://quiet.github .io/quiet-js/lab.html
I've written a C library which can send and receive data through an audio cable at 64kbps. https://github.com/quiet/quiet
As far as modulation techniques, it supports a wide range, as it uses an SDR library to perform its modulation.
If you'd like to try it out, here's a live demo https://quiet.github.io/quiet-js/lab.html