Android G1 Serial to USB Cable
by macpoddotnet in Circuits > USB
148475 Views, 36 Favorites, 0 Comments
Android G1 Serial to USB Cable
Learn how to make an Android G1 2.8v serial to USB Serial device adapter (using a 3.3v ttl to usb serial adapter). This can be used for kernel debugging/etc with your computer. This project shouldn't cost you more than 40 bucks if you already have basic electronic tools such as a soldering iron.
Notice: The ability to use 3.3v ttl level serial is based off of google group discussions and a picture of a serial cable used by an alleged android dev. 2.8v level serial was determined via someone using a voltmeter. Build/use at your own risk and check the comments of this instructable too before beginning!
Information may be applied to build a 2.8v serial to RS232 converter to interact with RS232 devices, or a 2.8v serial to serial 5v level converter to interact with microcontroller such as an Arduino. I may post instructables on how to make these once I play around with the G1 kernel some more. :)
This tutorial assumes basic knowledge of soldering. If you don't have this skill you should find an instructable regarding it and practice a bit. The soldering required for this project isn't difficult, but needs to be done in a small amount of space which could be difficult for beginners.
This cable was created based off of information received from the Android-Platform Google Group.
... Specifically these two threads:
http://groups.google.com/group/android-platform/browse_thread/thread/f03730e25cc3fe55?fwc=1
http://groups.google.com/group/android-platform/browse_thread/thread/439d3f3af7a88a09/10a80eb835e8dbcc?lnk=gst&q=serial#10a80eb835e8dbcc
...This picture of a "mystical" g1 serial cable helped (and confused!) too:
https://www.noisebridge.net/wiki/Image:G1-two-usb-to-serial-cable.jpg
Please leave constructive criticism/comments if you find any steps wrong, confusing... or poorly written!
Notice: The ability to use 3.3v ttl level serial is based off of google group discussions and a picture of a serial cable used by an alleged android dev. 2.8v level serial was determined via someone using a voltmeter. Build/use at your own risk and check the comments of this instructable too before beginning!
Information may be applied to build a 2.8v serial to RS232 converter to interact with RS232 devices, or a 2.8v serial to serial 5v level converter to interact with microcontroller such as an Arduino. I may post instructables on how to make these once I play around with the G1 kernel some more. :)
This tutorial assumes basic knowledge of soldering. If you don't have this skill you should find an instructable regarding it and practice a bit. The soldering required for this project isn't difficult, but needs to be done in a small amount of space which could be difficult for beginners.
This cable was created based off of information received from the Android-Platform Google Group.
... Specifically these two threads:
http://groups.google.com/group/android-platform/browse_thread/thread/f03730e25cc3fe55?fwc=1
http://groups.google.com/group/android-platform/browse_thread/thread/439d3f3af7a88a09/10a80eb835e8dbcc?lnk=gst&q=serial#10a80eb835e8dbcc
...This picture of a "mystical" g1 serial cable helped (and confused!) too:
https://www.noisebridge.net/wiki/Image:G1-two-usb-to-serial-cable.jpg
Please leave constructive criticism/comments if you find any steps wrong, confusing... or poorly written!
Items Needed
To build this converter you will need the following:
- Soldering Iron (Whatever Radioshack/online/etc has should work)
- Solder (Whatever Radioshack/online/etc has in stock that is 0.032 dia. or a little smaller will work)
- Wire Strippers (Don't buy these from Radioshack.. your local hardware shop should have them however)
- Wire cutters
- HTC ExtUSB Breakout board
- 22 AWG solid Wire - It would be best to get red,black and another color of your choice (white) but it is not necessary.
- USB to 2.8V (or 3.3v) serial level converter. It would be best if you could get one that lets you use the 5v line of the USB bus to power the G1, but it is not necessary. Any of the following should work (you only need ONE):
- (Has no 5v line for power) http://www.sparkfun.com/commerce/product_info.php?products_id=8772
- (May be difficult to modify to get 5v line for power) http://www.sparkfun.com/commerce/product_info.php?products_id=718
- (I used this one, has 5v connector) http://www.sparkfun.com/commerce/product_info.php?products_id=198
- (VCC pin should supply 5v... double check however!) http://www.sparkfun.com/commerce/product_info.php?products_id=199
- (This should have a 5v line (VCC).. but there is conflicting information between the store and company specs page) http://apple.clickandbuild.com/cnb/shop/ftdichip?productID=68&op=catalogue-product_info-null&prodCategoryID=47
Soldering the HTC ExtUSB Breakout Board Data Wires
= 1. Using the wire cutters, cut three lengths of wire that are each about 5 inches long. If you bought more than one color of wire, make one black wire and two of your custom color.
= 2. With the wire strippers, remove about 5mm of insulation from each end of the three cables.
Now, before continuing, go grab your HTC ExtUSB breakout board and take a close look at it. One side will have tiny numbers on it that reflect the following:
6 9 11 5
O O O O
7 8 10 4
O O O O
1 2 3
O O O
The bold holes are what we are interested in. Those three holes represent GND (Hole 7), TXO (Hole 8), and RXI (Hole 9), all of which are necessary for the G1's serial communications. In case you were wondering what the other pins were tied to, this is what PodGizmo.com currently has listed:
1: USB VCC +5v
2: USB Data -
3: USB Data +
4: N / C
5: USB GND
6: Left Audio +
7: Labeled "AG" (Serial 2.8v Level GROUND)
8: Audio - (GND) Labeled "CK" (Serial 2.8v Level TX0)
9: Switch (Talk) Labeled "OT" (Serial 2.8v Level RX'I)
10: Right Audio +
11: Mic +
12: Chassis Ground (GND)
= 3. Plug in your soldering iron and let it warm up.
= 4. Grab a wire you cut earlier (the black one if you have multiple colors) and solder it through hole 7 (GND).
= 5. Grab another wire you cut earlier and solder it through hole 8 (TXO).
= 6. Grab the last wire you cut earlier and solder it through hole 9 (RXI).
After that it should look something like the picture below.
= 2. With the wire strippers, remove about 5mm of insulation from each end of the three cables.
Now, before continuing, go grab your HTC ExtUSB breakout board and take a close look at it. One side will have tiny numbers on it that reflect the following:
6 9 11 5
O O O O
7 8 10 4
O O O O
1 2 3
O O O
The bold holes are what we are interested in. Those three holes represent GND (Hole 7), TXO (Hole 8), and RXI (Hole 9), all of which are necessary for the G1's serial communications. In case you were wondering what the other pins were tied to, this is what PodGizmo.com currently has listed:
1: USB VCC +5v
2: USB Data -
3: USB Data +
4: N / C
5: USB GND
6: Left Audio +
7: Labeled "AG" (Serial 2.8v Level GROUND)
8: Audio - (GND) Labeled "CK" (Serial 2.8v Level TX0)
9: Switch (Talk) Labeled "OT" (Serial 2.8v Level RX'I)
10: Right Audio +
11: Mic +
12: Chassis Ground (GND)
= 3. Plug in your soldering iron and let it warm up.
= 4. Grab a wire you cut earlier (the black one if you have multiple colors) and solder it through hole 7 (GND).
= 5. Grab another wire you cut earlier and solder it through hole 8 (TXO).
= 6. Grab the last wire you cut earlier and solder it through hole 9 (RXI).
After that it should look something like the picture below.
Soldering the USB to TTL-Level Serial Adapter Data Wires
Now that the ExtUSB board is soldered, the next step is to solder those wires into the respective holes in the USB to 2.8v serial board. Before continuing, it would be a good idea to grab this board and look carefully to find the GND, RX, and TX holes.
= 1. Solder the GND wire (The one Soldered in Hole 7 of the HTC ExtUSB board) in the hole labeled GND on your USB to 2.8v Serial adapter.
= 2. Solder the TXO wire (The one Soldered in Hole 8 of the HTC ExtUSB board) in the hole labeled RX on your USB to 2.8v Serial adapter.
= 3. Solder the RXI wire (The one Soldered in Hole 9 of the HTC ExtUSB board) in the hole labeled TX on your USB to 2.8v Serial adapter.
= 1. Solder the GND wire (The one Soldered in Hole 7 of the HTC ExtUSB board) in the hole labeled GND on your USB to 2.8v Serial adapter.
= 2. Solder the TXO wire (The one Soldered in Hole 8 of the HTC ExtUSB board) in the hole labeled RX on your USB to 2.8v Serial adapter.
= 3. Solder the RXI wire (The one Soldered in Hole 9 of the HTC ExtUSB board) in the hole labeled TX on your USB to 2.8v Serial adapter.
Verify the Data Wire Connections
= 1. If needed, install any drivers necessary for the USB to 2.8v serial adapter you used.
= 2. Download a serial console app for your computer. For OS X/Linux users, the command line minicom or screen are good choices. I will be using minicom under Ubuntu.
= 3. Plug in the converter you made into a USB port on your computer. Do NOT plug it into the phone yet.
= 4. Open up your serial console app and see if the device is detected. For me it shows up under /dev/ttyUSB0 and minicom picked it up automatically. You may need to configure your software.
= 5. With the serial port now recognized, now you need to change the baud rate/stop bits, and flow control. To change these in minicom, type Ctrl-a then type Shift-O (O as in Obama). A configurations dialogue will pop up. You should choose "serial port setup", hit enter then change the values to be the following:
= 7. Go grab your G1 Phone and make sure it has a good charge. Once it does, you should go to Settings->Sounds and Display->Screen Timeout and increase it to 10 Minutes or Never Timeout. From preliminary tests, It seems serial doesn't work with the display off.. but this has not been verified.
= 8. Plug the HTC ExtUSB connector into the phone.. if you smell anything funny or see sparks, quickly disconnect the connector from the phone then the USB cable and review the prior steps to see what you missed.
= 9. If all looks and smells ok, take a look at the serial console output, it should say "debug>" immediately. This reflects that you at least soldered the GND and RX wires correctly, woo!**
= 10. Try typing "ps" and hit enter, if you see ps appear and lots of text scrolls by when you hit enter, that means you cable works fine. Neat!**
**If you do not see the expected "debug>" text or you don't see what you type, hit enter a few times. Sometimes the communications can get garbled since no software/hardware flow control is used. If that doesn't work, you can try restarting your console app, verifying serial communication settings, unplug/plug in the phone, and finally double checking what you soldered.
= 11. Trim the excess wires off both boards.
= 2. Download a serial console app for your computer. For OS X/Linux users, the command line minicom or screen are good choices. I will be using minicom under Ubuntu.
= 3. Plug in the converter you made into a USB port on your computer. Do NOT plug it into the phone yet.
= 4. Open up your serial console app and see if the device is detected. For me it shows up under /dev/ttyUSB0 and minicom picked it up automatically. You may need to configure your software.
= 5. With the serial port now recognized, now you need to change the baud rate/stop bits, and flow control. To change these in minicom, type Ctrl-a then type Shift-O (O as in Obama). A configurations dialogue will pop up. You should choose "serial port setup", hit enter then change the values to be the following:
- Bps/Par/Bits: 115200 8N1
- Hardware Flow Control: No
- Software Flow Control: No
= 7. Go grab your G1 Phone and make sure it has a good charge. Once it does, you should go to Settings->Sounds and Display->Screen Timeout and increase it to 10 Minutes or Never Timeout. From preliminary tests, It seems serial doesn't work with the display off.. but this has not been verified.
= 8. Plug the HTC ExtUSB connector into the phone.. if you smell anything funny or see sparks, quickly disconnect the connector from the phone then the USB cable and review the prior steps to see what you missed.
= 9. If all looks and smells ok, take a look at the serial console output, it should say "debug>" immediately. This reflects that you at least soldered the GND and RX wires correctly, woo!**
= 10. Try typing "ps" and hit enter, if you see ps appear and lots of text scrolls by when you hit enter, that means you cable works fine. Neat!**
**If you do not see the expected "debug>" text or you don't see what you type, hit enter a few times. Sometimes the communications can get garbled since no software/hardware flow control is used. If that doesn't work, you can try restarting your console app, verifying serial communication settings, unplug/plug in the phone, and finally double checking what you soldered.
= 11. Trim the excess wires off both boards.
Soldering the USB to TTL-Level Serial Adapter Power Wire (optional)
Now that you know your cable works you can either use it as is, make it provide power to the G1, or make it work as a dual standard USB and USB serial device. The following explains how to supply power to the G1 provided your adapter has a 5v hole to solder to.
= 1. Take a look at your 2.8v level serial to USB adapter and look for a something labeled 5V. It may also be labeled VCC but if this is the case, check your adapters data sheet to verify it actually does supply 5V directly from the USB bus. It also probably wouldn't hurt to double check this using a voltmeter.
If you do not have this connection, you will not be able to complete the next few steps. If you run into this situation you might want to consider just soldering a USB cable to the proper HTC ExtUSB pins as this should allow you to both power the G1 and also have standard USB access to the G1
= 2. Using the wire cutters, cut a wire that is about 5 inches long. If you bought more than one color of wire, use the red wire.
= 3. With the wire strippers, remove about 5mm of insulation from each end of the cable.
= 4. Solder the wire through the 5V (or VCC) hole on your adapter.
= 1. Take a look at your 2.8v level serial to USB adapter and look for a something labeled 5V. It may also be labeled VCC but if this is the case, check your adapters data sheet to verify it actually does supply 5V directly from the USB bus. It also probably wouldn't hurt to double check this using a voltmeter.
If you do not have this connection, you will not be able to complete the next few steps. If you run into this situation you might want to consider just soldering a USB cable to the proper HTC ExtUSB pins as this should allow you to both power the G1 and also have standard USB access to the G1
= 2. Using the wire cutters, cut a wire that is about 5 inches long. If you bought more than one color of wire, use the red wire.
= 3. With the wire strippers, remove about 5mm of insulation from each end of the cable.
= 4. Solder the wire through the 5V (or VCC) hole on your adapter.
Soldering the HTC ExtUSB Breakout Board Power Wire (optional)
Take a look at the HTC ExtUSB breakout board again. We are interested in the USB VCC +5v hole which is bolded below.
6 9 11 5
O O O O
7 8 10 4
O O O O
1 2 3
O O O
1: USB VCC +5v
2: USB Data -
3: USB Data +
4: N / C
5: USB GND
6: Left Audio +
7: Labeled "AG" (Serial 2.8v Level GROUND)
8: Audio - (GND) Labeled "CK" (Serial 2.8v Level TX)
9: Switch (Talk) Labeled "OT" (Serial 2.8v Level RX)
10: Right Audio +
11: Mic +
12: Chassis Ground (GND)
= 1. Solder the other end of the (red) wire you just soldered in hole 1 (USB VCC +5v).
6 9 11 5
O O O O
7 8 10 4
O O O O
1 2 3
O O O
1: USB VCC +5v
2: USB Data -
3: USB Data +
4: N / C
5: USB GND
6: Left Audio +
7: Labeled "AG" (Serial 2.8v Level GROUND)
8: Audio - (GND) Labeled "CK" (Serial 2.8v Level TX)
9: Switch (Talk) Labeled "OT" (Serial 2.8v Level RX)
10: Right Audio +
11: Mic +
12: Chassis Ground (GND)
= 1. Solder the other end of the (red) wire you just soldered in hole 1 (USB VCC +5v).
Verify the Power Wire Connection
= 1. Plug in the adapter into your computer. If it starts to smell funny or spark, quickly remove it and check what you soldered.
= 2. Grab your phone, power it on if it is off, then plug the adapter into it. After about a second or two, the amber charging light should turn and stay on.. if it doesn't, quickly disconnect it and double check your connections.
That's it, go hog wild!
= 2. Grab your phone, power it on if it is off, then plug the adapter into it. After about a second or two, the amber charging light should turn and stay on.. if it doesn't, quickly disconnect it and double check your connections.
That's it, go hog wild!
Now What?
So now that you know how to interact with the serial port on the G1, you probably have a bunch of ideas floating around your head for how to take advantage of it, right?
Wouldn't it be nice to use this to:
-Control a robot
-Use the G1 as a serial console to connect to servers in a beowulf cluster like System-X
-Communicate with sensors/activators over a 3g network for remote monitoring/control
-Use the serial port to attach a blood glucose reader or other medical device (psst, any big medical companies hiring?) and combine two devices into one for many people?
Here's a project that explains how to compile the G1 phone's kernel so you can use the serial port from the userland. It also features an api so you can use the serial port directly from Android Gui apps!
http://code.google.com/p/android-serialport-api/
Don't forget to post your projects here when you're done!
Wouldn't it be nice to use this to:
-Control a robot
-Use the G1 as a serial console to connect to servers in a beowulf cluster like System-X
-Communicate with sensors/activators over a 3g network for remote monitoring/control
-Use the serial port to attach a blood glucose reader or other medical device (psst, any big medical companies hiring?) and combine two devices into one for many people?
Here's a project that explains how to compile the G1 phone's kernel so you can use the serial port from the userland. It also features an api so you can use the serial port directly from Android Gui apps!
http://code.google.com/p/android-serialport-api/
Don't forget to post your projects here when you're done!