Android 串口通过音频插孔 [英] Android serial port via audio jack

查看:27
本文介绍了Android 串口通过音频插孔的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过音频插孔使用串行端口获取数据.我对此一无所知.但我发现一个应用 audioserial 可以向其发送数据.所以,我认为应该获取 audioserial 之类的数据.是否有相同的项目或熟悉这个?

I want to get data using serial port via audio jack. I don't have any idea about this. But I find a app audioserial can send data to. So, I think it should be get data like audioserial. Is there same project or familiar about this?

推荐答案

您可以毫无问题地在麦克风插孔上录制音频.这样做,您基本上可以将您的 Android 手机用作数字示波器.然后,您可以通过编程方式将其转换回数字 I/O.

You can record audio on the microphone jack without any problems. Doing this, you can essentially use your Android phone as a digital oscilloscope. You can then programatically convert this back to digital I/O.

Serial output -> Android audio input -> Sampled square block wave -> digital I/O

请注意,大多数串行电平是 5V 或 3.3V.这会破坏您的麦克风输入!消费类音频电子产品的峰值电平通常为 1.7V.您将需要使用两个电阻器创建一个分压器,以便能够将您的 android 麦克风输入用作串行输入.如果您想创建符合规范 (http://en.wikipedia.org/wiki/RS-232#Voltage_levels) 的设备,您需要能够处理 -3V 到 +25V!

Please note that most serial levels are either 5V or 3.3V. This will destroy your microphone input! Peak level for consumer audio electronics is usually 1.7V. You will need to create a voltage divider using two resistors to be able to use your android microphone input as a serial input. If you want to create a device that behaves according to the spec (http://en.wikipedia.org/wiki/RS-232#Voltage_levels), you will need to be able to handle -3V to +25V!

然后您需要对音频输入进行采样.请参阅 http://en.wikipedia.org/wiki/File:Rs232_oscilloscope_trace.svg 获取您将收到的输入内容的良好示波器轨迹.您将需要创建 Java 代码来检测 RS-232 的时间以及开始和停止位(如果已配置).

You will then need to sample the audio input. See http://en.wikipedia.org/wiki/File:Rs232_oscilloscope_trace.svg for a nice oscilloscope trace of what you will receive as input. You will need to create Java code to detect the timing of RS-232 as well as the start and stop bits (if configured).

我认为您项目的决定因素将是手机的 CPU 速度.我不确定您是否能够以 19200 波特率与对方通话并同时生成 UI.

I think the determining factor in your project will be CPU speed of the phone. I'm not sure you will be able to talk 19200baud with the remote party and be able to generate a UI at the same time.

顺便说一句,也可以进行反向操作(生成方波来驱动串行输出),但需要一些电压倍增器(达林顿链或其他基于晶体管的方法)将电压增加到所需的水平(+5V).

Doing the inverse is also possible by the way (generating a square waveform to drive a serial output), but will require some voltage multiplier (darlington chain or other transistor-based method) to increase the voltage to the desired level (+5V).

这篇关于Android 串口通过音频插孔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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