13

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?

xiaobo
  • 131
  • 1
  • 1
  • 4
  • Could you please describe your problem in more details. If you want to transfer data between two phones using audio jack (or something similar) then its not possible since audio jack acts as an output port. The project you mentioned, just decodes the audio signal produced by the android app. The decoding is done using a custom developed hardware using audio processing technique and based on the decoded signal some action is taken. – Vinod Maurya Dec 29 '11 at 11:19
  • And, I want know how to decoding the data what I record from Audio Jack, it's 8n1 serial port data. but the [audioserial](http://robots-everywhere.com/re_wiki/index.php?title=Serial_on_Android_using_the_audio_port) just can to send. – xiaobo Jan 05 '12 at 03:20

1 Answers1

3

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

parasietje
  • 1,529
  • 8
  • 36
  • Now,I can get the data via the audio jack, I have a serial port data generater and sned data to phone audio jack. But the wave which get form different Android phone, is different. Is it have some method or algorithm to slove this problem. – xiaobo Jan 31 '12 at 04:09
  • I suppose the difference is because of different DAC hardware or different sampling frequencies. If the android phone applies equalization, compression or any other DSP effect, chances are your original waveform is lost completely. Try the OsciPrime app to see whether the problem is due to your phone or to your way of communicating with the API. – parasietje Jan 31 '12 at 11:17