简体   繁体   English

Android串口通过音频插孔

[英]Android serial port via audio jack

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? 有相同的项目或熟悉吗?

You can record audio on the microphone jack without any problems. 您可以毫无问题地在麦克风插孔上录制音频。 Doing this, you can essentially use your Android phone as a digital oscilloscope. 这样做,您基本上可以将Android手机用作数字示波器。 You can then programatically convert this back to digital I/O. 然后,您可以以编程方式将其转换回数字I / O.

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

Please note that most serial levels are either 5V or 3.3V. 请注意,大多数串行电平为5V或3.3V。 This will destroy your microphone input! 会破坏你的麦克风输入! Peak level for consumer audio electronics is usually 1.7V. 消费类音频电子设备的峰值电平通常为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. 您需要使用两个电阻创建分压器,以便能够将Android麦克风输入用作串行输入。 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/RS-232#Voltage_levels)的设备,您将需要能够处理-3V至+ 25V!

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. 请参阅http://en.wikipedia.org/wiki/File:Rs232_oscilloscope_trace.svg,以获得一个很好的示波器跟踪,了解您将收到的输入信息。 You will need to create Java code to detect the timing of RS-232 as well as the start and stop bits (if configured). 您需要创建Java代码来检测RS-232的时序以及启动和停止位(如果已配置)。

I think the determining factor in your project will be CPU speed of the phone. 我认为你项目的决定因素是手机的CPU速度。 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. 我不确定您是否能够与远程方通话19200baud并能够同时生成UI。

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). 顺便进行反转也是可能的(产生方波以驱动串行输出),但需要一些电压倍增器(达林顿链或其他基于晶体管的方法)将电压增加到所需的电平(+ 5V)。

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

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