Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 263
xiaobo Avatar asked Dec 08 '11 03:12

xiaobo


1 Answers

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

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!

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

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.

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

like image 60
parasietje Avatar answered Sep 28 '22 22:09

parasietje