Giving the Nexus 4 a serial port

nexus

Having a serial port on any Linux box is always useful, but with the tiny computers we’re carrying around in our pockets now, that isn’t always an option. Some of the more advanced phones out there break out a UART on their USB OTG port, but the designers of the Nexus 4 decided to do things differently. They chose to put the Nexus 4’s serial port on the mic and headphone input, and [Ryan] and [Josh] figured out how to access this port.

Basically, the Nexus 4 has a tiny bit of circuitry attached to the microphone input. If the Nexus detects more than 2.8 Volts on the mic, it switches over to a hardware UART, allowing everything from an Arduino to an old dumb terminal to access the port.

The guys used a USB to serial FTDI board wired up to a 3.5 mm jack with a few resistors to enable the hardware UART on their phone. With a small enclosure, they had a reasonably inexpensive way to enable a hardware serial port on a mobile device with GPS, cellular, a camera, and a whole bunch of other sensors that any portable project would love.

EDIT: An anonymous little bird told us this: “You should add a note to the Nexus 4 serial cable post that TX and RX need to be 1.8V.  If you use 3.3V USB cables, you will likely eventually fry something.  FTDI makes 1.8V IO cables that work – you just need to make the trigger voltage for the mic line.” Take that for what you will.

Comments

  1. Ren says:

    Double Plus Good!

  2. mikemac says:

    I don’t understand why the 1K resistor on the MIC-IN line?

    And is the trigger voltage 2.8V or 3.08V? They state 2.8V in the summary but derive 3.08V in their calculations.

    • Ryan says:

      The 1K resistor serves two purposes. The first is if you connect it to a device that shorts Vcc out to ground it prevents the FTDI chip from resetting. The second is if you plug it into the wrong device it makes it less likely that it will destroy the device. With the voltage calculation, 3.08V is the correct number.

  3. Luigi says:

    i am curious if the nexus7 has a similar thing too ? (different manufacturer though, asus versus LG)

  4. tomas316 says:

    So could i make my android(assuming my android has this ability) a serial terminal? would be nice in the datacenter to do this…

  5. greenbacks says:

    Cool, I have a nexus 4. This might come in handy when the screen cracks and I decide to get a new phone ;)

    • Ren says:

      After reading this article and blog, I did a Google on Nexus 4 and a review complained about the screen and back plate (also glass) easily breaking, Your Mileage May Vary…

      • mikemac says:

        I’ve had my Nexus 4 since early December and I haven’t had any problems with either the screen nor the back cover.

        There, you have two antidodal data points which mean nothing.

  6. Gdogg says:

    Headphone UART is a requirement for any Google flagship Android Product.

    This means any Nexus has this feature.

  7. I haven’t checked Nexus 4, but this is documented quite well in the Nexus 7 kernel code. No special circuitry there though – just standard SoC pinmuxing. Most of the time it’s pinmuxed to ‘nothing, and when it detects a special condition (if enabled), it pinmuxes the UART onto the pins and the audio off.

  8. Freddy says:

    Can this be used to bypass security on the phone? What exactly is enabled on the stock nexus 4 end?

  9. dimovnike says:

    any idea what levels are on this kind of UART? Is this TTL or a real RS232 levels?

  10. Usman says:

    any body tested this?
    well,… i created the circuit and no luck,…
    my nexus restarted couple of times as soon as i plug the headphone jack , computer showed lot of clutter and finally nexus went in to continuous boot loop

    i had to re-flash factory image,.. lost every thing :(

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 97,791 other followers