Serial Communication - G1 Android Development

Hey Guys,
I was reading the Forkknife robot thread, and in the last paragraph or so, he mentioned that the android kernel could be modified to allow serial communication through the audio-out plugs in the USB cable.
He said that the audio plug could be used as Ground (Ground), Left (TX), and Right (RX).
I'm trying to find a way to output the sensor data from the HTC Dream to my arduino board, and not have to buy $100+ in sensors i already have.
I imagine it would not be hard to write a program to output the sensors data, but I have not begun Android coding yet, so if anyone could help, it would be greatly appreciated
-Brian

See this new thread...
http://forum.xda-developers.com/showthread.php?t=559380&page=2

Related

3.5mm Audio/Mic/Video out pinout - compilation of info

3.5mm Audio/Mic/Video out pin out - compilation of info​
After searching on here, XDA and other sites, this is a compilation of accurate data I have found Please comment with known good info and I will update this post so it can be used as a single source rather then having 20 different post with hijacked conversations.
Information desired to be compiled into this thread consists of technical pin out of the 3.5MM jack on the Samsung Galaxy S: Captivate i897 and Vibrant T959 (let me know which others and I will add them as compatible).
3.5mm pin out:
1.LEFT EARPHONE
2.RIGHT EARPHONE
3.GROUND
4.MIC
***Note: I have not hacked up a factory earphone/mic/button to confirm this, I will once I get a spare set. This is the only sure fire way I know to be certain as to the OEM wiring and button configuration, NO/NC (Normally Open/Normally Closed) switch, what wires are made (connected/shorted) by the switch to achieve the pause, answer call/terminate call when pressed. This pin out makes sense because a standard headphones without a mic operate normally and the only other way that would be possible would be to have ground and mic switched, and I don't believe that is the case due to info I have found, but not yet tested concerning Video Output.
Audio/Mic compatibility
I have found that the Galaxy S audio output and mic input are wired the same as a.....are you ready for this???? Same as the old trusty Sharp Sidekick... I was shocked to find this but shouldn't be soo since there are only so many options possible to achieve this functionality with a limited number of connectors. Let me know what others are fully compatible and tested. I will add them to this post so it will remain easy to refer to.
So here the list starts: (full OEM functionality only)
Sharp SideKick earphones/mic/button
Audio/Video compatibility
Speculated pin out (will update once tested). This makes sense because it offers the simplest way to share an connector using an electronic switching mechanism triggered by the TV Out switch in the OS settings.
3.5mm pin out:
1.LEFT EARPHONE
2.RIGHT EARPHONE
3.GROUND
4.Video
I have none yet as I have not purchased any to test. I did test with a set of A/V cables for a digital camcorder I have but they were not compatible. I am not listing or mentioning the brands that do not work correctly. If plugs need to be switched (yellow/Red, or white/yellow) I do not want to add to this until I am able to test correct pin out for A/V. Once the pin out is confirmed, I will add A/V cables that work with plug switching.
The goal is to create a "Master List" if you will of compatible/fully function earphones/mic (with or without button), and A/V cables. If button is inline with the earphones it should work the same as OEM, if it does not then please note and I will note that in the list also.
I will consider making another "Master List" for the USB/Charging/HDMI once i have completed testing and a clear understanding of the usb charging pins/voltages etc. There is much info on other posts concerning USB charging, jumping pins 2 and 3, etc. I can say at this time I have only been successful charging in (charger mode) with the OEM cable and charger and with the AT&T MicroUSB charging (only) cable and and most USB port wall warts and car changers. AT&T charging cable is available Here. (Will add link when my account is verified (been a member since 2009 and had a HTC 8125.
I have also confirmed charging loads, current draw in both USB mode and Charging mode.
More to come. Please feel free to offer good tested and proven compatible I/O.
Barry
Search terms: Audio Video Mic Samsung "Galaxy s"
Nice thread, although it is totally going to get buried lol.
Once you verify that information I recommend putting [REF] in the title and posting in the dev section... it's not Q&A so I think it's appropriate there... plus it looks like you've done a lot of research
Sent from my SAMSUNG-SGH-I897 using XDA App
bleerii said:
3.5mm Audio/Mic/Video out pin out - compilation of info​
After searching on here, XDA and other sites, this is a compilation of accurate data I have found Please comment with known good info and I will update this post so it can be used as a single source rather then having 20 different post with hijacked conversations.
Information desired to be compiled into this thread consists of technical pin out of the 3.5MM jack on the Samsung Galaxy S: Captivate i897 and Vibrant T959 (let me know which others and I will add them as compatible).
3.5mm pin out:
1.LEFT EARPHONE
2.RIGHT EARPHONE
3.GROUND
4.MIC
***Note: I have not hacked up a factory earphone/mic/button to confirm this, I will once I get a spare set. This is the only sure fire way I know to be certain as to the OEM wiring and button configuration, NO/NC (Normally Open/Normally Closed) switch, what wires are made (connected/shorted) by the switch to achieve the pause, answer call/terminate call when pressed. This pin out makes sense because a standard headphones without a mic operate normally and the only other way that would be possible would be to have ground and mic switched, and I don't believe that is the case due to info I have found, but not yet tested concerning Video Output.
Audio/Mic compatibility
I have found that the Galaxy S audio output and mic input are wired the same as a.....are you ready for this???? Same as the old trusty Sharp Sidekick... I was shocked to find this but shouldn't be soo since there are only so many options possible to achieve this functionality with a limited number of connectors. Let me know what others are fully compatible and tested. I will add them to this post so it will remain easy to refer to.
So here the list starts: (full OEM functionality only)
Sharp SideKick earphones/mic/button
Audio/Video compatibility
Speculated pin out (will update once tested). This makes sense because it offers the simplest way to share an connector using an electronic switching mechanism triggered by the TV Out switch in the OS settings.
3.5mm pin out:
1.LEFT EARPHONE
2.RIGHT EARPHONE
3.GROUND
4.Video
I have none yet as I have not purchased any to test. I did test with a set of A/V cables for a digital camcorder I have but they were not compatible. I am not listing or mentioning the brands that do not work correctly. If plugs need to be switched (yellow/Red, or white/yellow) I do not want to add to this until I am able to test correct pin out for A/V. Once the pin out is confirmed, I will add A/V cables that work with plug switching.
The goal is to create a "Master List" if you will of compatible/fully function earphones/mic (with or without button), and A/V cables. If button is inline with the earphones it should work the same as OEM, if it does not then please note and I will note that in the list also.
I will consider making another "Master List" for the USB/Charging/HDMI once i have completed testing and a clear understanding of the usb charging pins/voltages etc. There is much info on other posts concerning USB charging, jumping pins 2 and 3, etc. I can say at this time I have only been successful charging in (charger mode) with the OEM cable and charger and with the AT&T MicroUSB charging (only) cable and and most USB port wall warts and car changers. AT&T charging cable is available Here. (Will add link when my account is verified (been a member since 2009 and had a HTC 8125.
I have also confirmed charging loads, current draw in both USB mode and Charging mode.
More to come. Please feel free to offer good tested and proven compatible I/O.
Barry
Search terms: Audio Video Mic Samsung "Galaxy s"
Click to expand...
Click to collapse
I posted a similar link a while back on this over in the accessory forum..http://forum.xda-developers.com/showpost.php?p=9033585&postcount=1
I waiting for a oem set being sent to take apart me by Samsung to verify it..This was for the I9000 not the Captivate though
Mac

[Q] Android to Sony/Claron integration

So I'm considering starting a new project, but before I dive in I was hoping to get a little input from some more experienced people as to whether or not I should even try. I would like to try to really integrate an android device with a car stereo, being able to control the head unit with the android device, and display info from the stereo unit on the android device. Sony has a bus called Unilink, Clarion's is called CeNet, which they use to communicate with external devices like cd changers and wired remotes with displays. Sony makes an accessory that plugs in to the stereo head unit and has a usb port. I was wondering how difficult do you think it would be to connect the android device to this usb port, or a bluetooth connection and decode the info, and be able to send commands? The actual decoding wouldn't be too bad, there is plenty of literature out there, just writing the software to display and send commands.
Another option would be the new Parrot Asteroid which runs android, so the software to control a head unit exists (atleast when the Asteroid is released it will), so possibly a connection to the Asteroid with another android device?
Any advice would be helpful. Ive written a little software before, I've always been better at the logic/semantic part than with the syntax, so I've help developers with things like that.

[Q] Using hd2 as a external BT or USB soundcard for PC

Hi, folks!
My old laptop is nearing the end of its lifecycle and now its soundcard got busted and I can't find a way to get it working again.
I could go to a shop to buy an USB-soundcard, but that would be
a) too easy and
b) waste of resources
- as I'm aiming to buy a new laptop soon enough. But until that time I need to hear some sound from the box anyway (some music, some movies and some training videos) so I wonder if it's possible to use the HD2 as a soundcard and get the audio output from its 3,5mm jack. Either by bluetooth or cable connection..
Is there a specific application for this?
phone is running stock winmo 6.5
pc is win7ultimate in intel T7700:2x2.4GHz/4GbRam/500GbHDD box, BT enabled.
Any ideas how it could be done?
Thanks a lot!
Edit: Ohcrap. Posted it in the wrong subforum. n00b-ish, I know. The correct post/thread can be found here: http://forum.xda-developers.com/showthread.php?t=1279180

[Q] Earphones stucked on "Plugged in"

I have an SGS I9000 with a major issue. It thinks that the headset/headphones are plugged in. I sent it to service support and they said there is water damage so no fix.
I have tried toggleheadset, toggleheadset2. I've rooted my device and installed the Android 2.3 Dark's ROM.
I read a post somewhere about how you can create a wrapper for the AudioSystem class as the setRouting is still available there. I as of yet have not been able to figure out how to go about doing this as the AudioSystem class is hidden in the SDK and the code makes use of native functions.
Does anybody know of a way to go about creating and implementing a wrapper for AudioSystem or of another way to disable the headset?
P.S. I've cleaned out the headset port, so there is no dust or anything sending false signals to the mainboard.
Any help will be greatly appreciated.
I'd really like a way to force the output, as my headphone jack consistently "unplugs" itself. Meaning I have to walk up and unplug and re plug it, as the music pauses and thinks the jack was unplugged.

Hardware Development Enabling audio output on VW MkVI GTI w/ Dynaudio

I'm not sure this is the best place for this, but given how hard it was to find good information about this combination, I thought I'd put it here.
I purchased a M500S for my MkVI GTI, however when I installed it, I couldn't get any audio output. Searching the internet for how to use the stock amp with an aftermarket head-unit yielded lots of different information, most of it wrong. I talked to the vendor, but they were less than helpful, indicating that Dynaudio was unsupported with this head unit (true) and that VW used an optical signal to communicate between the head unit and amplifier (untrue). I saw a post from @COASTER19 regarding reading the steering wheel buttons on an Audi here, which looked awfully similar to my steering-wheel/gauge cluster, so figured I'd give it a go myself.
So I built hooked a cheap CAN bus controller to a Raspberry Pi, and analyzed my current (working head unit). I was able to determine that:
The media CAN bus runs at 100 kbps (as opposed to the drivetrain canbus which runs at 500 kbps)
The amplifier has an identifier of 0x6C7
The amplifier can be powered on/off via CAN bus commands
Once powered on, the M500S audio worked fine
The amplifier supports direct balance/fade commands (which may be useful some day in the future)
With this info, in hand, I made a simple circuit from an Arduino Pro Mini + MCP2515 module that is activated from the 'Amp Power' lead on the back of the radio. It simply replays the messages I snooped from the current head-unit, and now my M500S works perfectly with the stock Dynaudio amplifier/speakers. I don't currently send the fade/balance commands to the amp, so maybe the quality could be better, but that is a project for another day.
I have released the schematics, code and what CAN info I have on GitHub here.
In theory this project could completely replace the module that came with the unit and/or provide music/navigation updates on the gauge cluster as well, but that requires figuring out how to get that info out of the head unit, and I don't have the time to write an Android application to do so right now.
While trying to identify the CAN ids, I found this post by @hugovw1976
regarding a Golf 6 with some CAN bus commands: https://forum.xda-developers.com/t/mtcd-kgl-px5-canbus-problem-with-vw-golf-6.3632690/post-73939457
That post identifies the following canids:
0x2C3: power on/off
0x635: lights on/off
0x470: doors open
0x35B: RPM
0x527: Speed and outside temperature
0x621: Wiper state and fuel level
0x65D: odometer
0x351: reverse and brake
0x571: battery voltage
0x151: seat-belt state
I didn't spend too much time investigating these, but I at least see some correlation with the battery voltage, door-open, and fuel-level canids, so they are probably accurate. However, I was not able to correlate the odometer, so probably further investigation is needed there.
AxesofEvil said:
I'm not sure this is the best place for this, but given how hard it was to find good information about this combination, I thought I'd put it here.
I purchased a M500S for my MkVI GTI, however when I installed it, I couldn't get any audio output. Searching the internet for how to use the stock amp with an aftermarket head-unit yielded lots of different information, most of it wrong. I talked to the vendor, but they were less than helpful, indicating that Dynaudio was unsupported with this head unit (true) and that VW used an optical signal to communicate between the head unit and amplifier (untrue). I saw a post from @COASTER19 regarding reading the steering wheel buttons on an Audi here, which looked awfully similar to my steering-wheel/gauge cluster, so figured I'd give it a go myself.
So I built hooked a cheap CAN bus controller to a Raspberry Pi, and analyzed my current (working head unit). I was able to determine that:
The media CAN bus runs at 100 kbps (as opposed to the drivetrain canbus which runs at 500 kbps)
The amplifier has an identifier of 0x6C7
The amplifier can be powered on/off via CAN bus commands
Once powered on, the M500S audio worked fine
The amplifier supports direct balance/fade commands (which may be useful some day in the future)
With this info, in hand, I made a simple circuit from an Arduino Pro Mini + MCP2515 module that is activated from the 'Amp Power' lead on the back of the radio. It simply replays the messages I snooped from the current head-unit, and now my M500S works perfectly with the stock Dynaudio amplifier/speakers. I don't currently send the fade/balance commands to the amp, so maybe the quality could be better, but that is a project for another day.
I have released the schematics, code and what CAN info I have on GitHub here.
In theory this project could completely replace the module that came with the unit and/or provide music/navigation updates on the gauge cluster as well, but that requires figuring out how to get that info out of the head unit, and I don't have the time to write an Android application to do so right now.
Click to expand...
Click to collapse
I registered to this forum specifically to reply to your post. THANK YOU. I have just installed an aftermarket head unit and it went swimmingly until I discovered that it doesn't play nicely with my factory upgrade audio system. Then things went from bad to worse when I discovered that the Dynaudio/Fender amplifier is controlled via CAN, not just some 12V signal. I was going to reinstall the factory RNS510 and sniff the CAN bus when I came across this post and your github code.
I have not tried it yet, as I am hoping that the vendor (who is VERY responsive) will be able to integrate it right into the radio. Failing that, I'll be able to whip up a similar circuit to yours and be up and running. Thank you for sharing not just the code, but the technical details behind it. I truly appreciate it!

Categories

Resources