Have you ever wanted to control electronics with your smartphone? The Arduino ADK (Android Development Kit) is the Arduino Mega with a built in USB host device, ready for your smartphone to be plugged in! We'll make a simple introductory project with a few LED strips and a relay (to control the high voltages of the LED strip). For this project, you will need no Android programming experience (or even learn how to code Android!), but a moderate Arduino code understanding. We'll use the easy Handbag app for Android.
This Instructable will cover how the Arduino ADK works, how to use it with Android devices, and how to make a cool example project of lighting up LED strips with Android!!!
Please vote for me in the Make to Learn Youth Contest and Lamps and Lighting Contest!!! Every vote counts!
What did you make?
I made a tutorial on the Arduino ADK, which I found little documentation on in the past. I wanted other people to learn all about the Arduino ADK easily, once they got one and didn't know how to use it. The 'ADK in-depth' part of this Instructable is a compilation of many resources that I have found on the internet. I also created an 'example project' in Step 4-8 to interface an LED strip (with a relay, which I have never worked with in the past) with the Arduino ADK, and an Android device. The simple program uses the Handbag application and libraries (wasn't designed by me) to make a simple application menu for the Android to turn on/off the LED strip.
How did you make it?
I used many of my prior electronics and soldering skills, and some electronic components I have gotten in the past. My parents gave me the LED strip last Christmas, and I got the Arduino ADK at Maker Faire Bay Area 2012, but didn't know what to do with it. Later on, I looked online and found the Handbag application, and started coding in minutes. Using only Arduino programming (which is the great part of Handbag, you don't have to write any Android code), I coded a simple application menu that activated the relay that switches the LED strips on and off.
Where did you make it?
I made the project mainly in my garage/hackerspace (Qtechknow Labs), where I teach many of my friends DIY electronics. I also used my soldering iron and project desk. I have gotten many of my soldering skills at booths at Maker Faire, and lots of my electronics skills around the internet! I looked at Arduino.cc as well as Google Developers to get to know what the Arduino ADK was about, even though I didn't understand it at first.
What did you learn?
I learned all about the Arduino ADK, relays, and Android devices, all of which I had no experience with in the past. I learned that everything fails at first, but you have to keep on trying to get it the way you want it. I'm super excited that I now know all about the Arduino ADK, so I can design some more cool Android projects!
Step 1: Parts and Tools
The total cost of the parts is about $28.50, excluding the Arduino ADK and LED Strip.
Arduino Mega ADK (Makershed, $85)
USB-B Cable for Arduino ADK Programming (SparkFun, $4)
LED Strip - 1M (you only need 2 feet; Adafruit, $20)
2N2222 Transistor (Digikey, $0.34)
Relay SPDT (SparkFun, $2)
Diode Small Signal 1N4148 (SparkFun, $0.15)
10K Resistor - 1/6W (SparkFun, $0.25)
Half Size Breadboard (SparkFun, $6)
12V DC Power Adapter (SparkFun, $6)
Jumper Wires (SparkFun, $4.50)
Android Phone (Check OS requirements)
USB cable for Android Phone
Safety Mask or Solder Fume Extractor
Wire (only a little bit is needed)
Step 2: Introduction to the Arduino ADK
The Arduino ADK is basically an Arduino Mega with a built in USB host controller. It has over 50 digital pins, 15 analog pins, and many more for communication. It has a very fast processor with over 200kb of memory to store code!!! In most programs, you use less than 15kb.
The Arduino ADK can communicate with Android devices, or basically any USB slave (i.e. keyboard, mouse). It has a MAX3421E that communicates with the ATmega2560 through SPI to transmit and receive data to the Arduino ADK.
Some of these concepts might be a little confusing, but you don't have to understand them in full detail to make a simple Android app.
Step 3: Handbag for Android
Just a few days ago, I stumbled upon this amazing app for Android called Handbag. With this app, you don't even have to write any android code, you only have to write Arduino code!!! It's quite possibly the easiest way to interface the Arduino ADK with your Android device. You can use the simple Handbag classes/libraries for Arduino ADK to program both the phone interface and the Arduino ADK IO pins (sensor and output pins).
Go here to download the program for your Android device, since it isn't on Google Play. Click on the .apk package, and it should download and run.
To enable developer options, go into Settings>Developers>Enable USB Debugging and click OK, so that the Handbag app will run properly on your Android phone.
Step 4: Arduino ADK Project
Last year for Christmas, my parents gave me two LED strips, each white and ~2ft long. At first, I didn't know what to do with the LED strips, because they are basically just multiple LEDs in a line, but when I kept on straining my eyes to see some of my tiny electrical components, I figured I needed a new light.
First, I hand crafted some balsa wood to make a base for the LED strip to stick to. Then, I soldered the GND to GND and the +12V to +12V on each of the LED strips, so that when you applied power to one, the other one would light up also. This part of the step doesn't require any programming. I soldered a yellow wire (I didn't have any red) to the + side of the LED strip, and a black wire to the - side so I could remember which pins they were later on. Next I soldered a switch in series to the positive side of the LED strip (not at all needed). The two wires that were left were my + and - from the LED strip.
Step 5: The Circuit
Next, we'll move on to making the relay circuit. You can see how to assemble the circuit using the Fritzing diagram above. Here are the pin assignments from the breadboard to the Arduino ADK or LED strip:
Note: You should only be connecting wires to the JST to Barrel Jack connector, not the power supply. Also, don't plug in your JST to Barrel Jack to the power supply, or the power supply to the wall. For safety, we will do this after we are sure that we don't have a short in our circuit.
Make sure that your circuit looks exactly like the one above.
Step 6: Coding
Below is both of the Arduino libraries that you will need to install to run the programs correctly on your Arduino ADK, as well as the actual Arduino code. First, unzip them using an extraction tool (built-in for the Mac and Windows). To install the libraries, go to your Documents folder, then into the Arduino folder, and then drag and drop both libraries into the libraries folder. If you don't happen to have a libraries folder, don't worry. You can make one yourself! While in the Arduino folder, make a new folder, and name it "libraries" without the quotations.
Once you are finished, go ahead and close the Arduino program, and then go back into it. The only reason we did this is because every time that you install a new library, you have to restart the Arduino program.
Unzip the ledStripADK folder, double click the ledStripADK.ino file, and it should open the Arduino IDE (Integrated Development Environment, the main program to code Arduino) with the code. I strongly encourage you check out the code and the comments in the code that I made, to understand it better.
Basically, the code makes an app menu using the Handbag library, initiates the relay control pin, and when the user presses a virtual button on the Android device, the relay should turn on or off, depending on which button you pressed.
Step 7: Final Touches!
Now, plug the USB into your Arduino ADK (if you haven't done so yet), and plug the 12V DC Power Adapter into the wall. Then, plug the barrel jack of the power adapter into the mating barrel jack on the JST connector together. Plug in your Android phone, and load up the Handbag app. Plug in your USB cable for your Android into the Arduino ADK, and plug the other side into your Android device. If you soldered in a switch with your LED switch, turn it on, so that current flows.
The app that I designed should come up, and when you press the "Turn LED Strip On" button, you should hear a click (which is the switch in the relay), and the LED strip will light up. When you press the "Turn LED Strip Off" button, you should hear another click (which is the same switch in the relay, just going the other direction), and the LED Strip should go off. However, if you press the "Turn LED Strip Off" button while the LED strip is off, the relay won't click, or the LED won't go off, because it is already in that state.
Step 8: Finished!
Yay!!!! You have finished your Arduino ADK LED Lighting project, as well as learned a bunch of electronics, code, and Android!!!
If you like this Instructable, please tell all of your friends!!! If you know of a person that loves LEDs, would like them installed in their house, wants an easy way to control them, but doesn't know how to do it, you can modify the project to fit your needs!!!
Thanks for reading my Instructable!!!
P.S. I'm 12 years old :D