Saturday, May 5, 2012

Arduino Mega ADK to V1 HowTo

Pictures and Videos to come.

What you will need

You can get most things at Radio Shack

Arduino Mega ADK (the Mega should also work but I plan on adding Android support so you might want the ADK). for more info

5.5/2.1 Coax Plug (optional, but powering from the plug is easier and keeps it in ESP mode even if no USB, and will be needed for the Android version)

Standard old USB A to B cable - the one with the end that looks like a house or barn if you don't have one.

Things you might want to pick up if you don't have at home:
A Modular cord, or plugs and cable and crimper so you can do a "build your own".
Basic electronics tools (I can use a one-edged razor to strip wire, but you might want something a bit better).
Wire - solid or a kit to hook up wires to the connector on the Arduino board.
(optional but recommended) Basic soldering - a soldering iron and solder.

If there's a Lowes nearby, you might want to get the phone cables from them, as they are cheaper, and/or a dual modular jack.  RCA TP42662WHN, Lowes sku 303140, UPC 0-44476-06065-6.  This might be easier to wire - no cutting the modular cord - and will allow upstream accessories.

Hardware Setup

(I will describe the RCA jack setup below if you want to do it that way).

Get the modular cord.  I prefer to use the end such that if the cord is coming out to the right, and the latch is facing you and the connector pads are facing away from you, from top to bottom will be Yellow, Green, Red, and Black.   When plugged into the accessory jack, this will make Red the vehicle power, Green the ground, and Yellow the data line.

(Click on any picture to bring up a much larger, detailed version).

Cut the modular cable so that the end you want is a convenient length.  Strip several inches of the jacket off the Modular cable.  The Data wire will need to go to two pins, 18 (TX1)  and 49.  (Hint - I used a lighter to burn/melt the insulation in a middle area and the end so I had two wires.  A bit of solder made them stiff enough).

These have a yellow square in the image below.  If you aren't going to power the Arduino via the V1 power line, you can run the ground line where the green square is.  (Image from, modified to show connection points)

If everything is wired correctly, plugging the modular cord into the accessory jack and the barrel connector into the arduino, the power light should come on.  (The picture is a bit sloppy, the black wire doesn't attach to anything, and the yellow wire is going to the two pins in the above image.

Software Setup

Download the Arduino IDE at  and install (it is a zip file with a folder, not an installer program).  If there is a problem, there are troubleshooting resources on this site, so if you have trouble programming or compiling, this should explain what is happening.

Get my code.  At there is a "Zip" button on the upper left that is the easiest.  It will download everything as a .zip file.

Programming the Arduino

Unpack the Arduino software folder into a convenient location (arduino-1.0) and go into the folder and double-click "arduino.exe".  This will bring up the IDE but should also create a directory called "Arduino" in "My Documents" which is the sketchbook directory.  Open the zip file downloaded from github ( and copy the bluev_sketch into the sketchbook directory.  Quit the Arduino IDE.

Plug in the Arduino Mega ADK board using the USB cable.  Windows will ask for a driver, use the "manual" install and point into the arduino-1.0/drivers directory.  It should find and install the driver.

Go into the bluev_sketch folder and double click the bluev_sketch.ino file.  This should bring up the Arduino IDE.  Click the right arrow icon (upload) at top.  This should compile and upload to the Mega ADK board.  You might need to tell it which COM port the first time (the Tools->Serial Port menu is used to select which com port).  When it is finished (at the bottom it will say "Upload Finished"), go to the Tools menu and select "Serial Monitor".  This will open another window, to interact with the board, and "V1 Mega Tool" should appear at the top.  (If the V1 is hooked up and sending packets the user menu will appear).

OPTION: Dual Modular Jack Wiring (to allow upstream accessories)

Open the box

Pull the right side connector out and straighten the wires.

Connect them crosswise, i.e. Left Yellow to Right Black, Left Green to Right Red, Left Red to Right Green, Left Black to Right Yellow.
Reinsert the right side jack

Attach 3 (or 4) wires to the connectors, from top to bottom, Audio, Battery, Ground, Data.  The Left jack will go toward the V1 (on either side of the power connector).  The right one will go toward more accessories.  (if you want a quick remote switch, you can put this between power and the V1 and wire a switch between the battery wires).

 Here I have a cable, Black and Red are ground and battery, white is data, green is audio.

You can swap the modular jacks if they are wrong (there is a reverse polarity protection diode, so the power light will only work if the power from the accessory jack is going to the right one).

  Reattach the cover and run the wires to the Mega.


  1. Hi,

    Why only Arduino Mega boards supported? what about UNO? any hardware limitations presents?

    1. It requires two UARTs, at least since that is the only way the Arduino communicates to the PC, and the UNO has only the one used to talk to the PC.

      The new Leonardo should work as the "uart" is a virtual USB device and the hardware UART is available - I assume it has an ICP.

  2. What about, as I understand this library allow to use UART on digital pins?

  3. The software serial library might work - I'm doing something very similar with the ICP pin but that is the problem - I need very tight timing and they are using pin change interrupts and timing like I am to generate the software UART. I am disabling the Arduino timers and other interrupts. I might be able to write one myself (bitbang the ICP pin or a second pin that would act as TXD), but don't really have the time at the moment.

    I don't have a Leonardo yet (and it likely won't be soon), but its USB is separate from the on-chip UART so it could work.

  4. Ok, thanks for explanation.
    UNO board quite more popular than MEGA and it can make sense to use software serial instead of buying new hardware :)
    Your bluev sketch based on custom libraries and not so easy to adapt it to Software serial without good C knowledge.