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

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

问题描述

我想通过音频插孔使用串行端口获取数据。 我没有这方面有任何想法。但我发现一个应用程序,<一个href="http://robots-everywhere.com/re_wiki/index.php?title=Serial_on_Android_using_the_audio_port">audioserial可以发送数据到。 所以,我觉得应该得到这样<数据href="http://robots-everywhere.com/re_wiki/index.php?title=Serial_on_Android_using_the_audio_port">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?

推荐答案

您可以录制音频的麦克风插孔,没有任何问题。这样做,你基本上可以用你的Andr​​oid手机作为数字示波器。然后,您可以通过程序转换这一回数字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 code检测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速度。我不知道,你将能够谈19200baud与对方,并能够生成一个用户界面的同时。

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).

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

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