Introduction: Control a Arduino With Your Phone.

About: I live in Toronto, Canada and I build almost anything computer related, Anything from robots to computer interaction devices. My favorite programming language is C+ and micro controller is avr with the Arduin…

In this Instructable I'll show how to control your stuff with your phone and the arduino board. I've controlled everything from smoke machines too christmas light's with this program.

Video:

sorry the video is kinda odd because my camera is trying to adjusting for the light difference.

Step 1: The Parts

The parts

-NPN transistor

-Iphone/ Android(Using Iphone)

-The TouchOSC app (awesome app)

-Arduino 5v (any type)

-some wire

-Soldering iron

-Breadboard (optional but recommended)

- A Mac or PC

-Some sort of remote or low power button (anything that runs on AA,AAA batteries is usually fine)

-If you want to control a appliance look at the last step fore more info.

and thats it!

Step 2: Open Your Device (low Power)

Hopefully you can figure out this step by yourself. Remove a screw or two and open it. In the pictures Im opening an LED strobe lamp.

Step 3: Find the Button

Now on the the circuit board from you device find the button/switch you want to control with your smartphone. For me it was the On/Off switch on the strobe lamp. if your opening a remote control you likely find these pads shown in the 2nd picture

Step 4: Solder to the Contacts

Once you have found the contacts solder some wire to them, one for the positive and another for the ground. I strongly recommend using solid strand wire as its much easier to solder. For more help look at the photos.

Step 5: Connect the Transistor

Now you will need to connect your transistor to your Arduino and to your device. Look at the picture below for how to wire it up. I have annotated it if you need help. That little black thing is your device.   If you know the polarity of the wires you can connect the positive to the left terminal of the transmitter and the ground to the right terminal 

If you  want to control more buttons connect additional transistor's the same way but instead of using pin 12 use 8, 9 or 11

Step 6: Make a TouchOSC Layout

Skip this step if your on Android!

1.Download the TouchOSC editor from here

2. Watch the video  for a quick how to, on creating a layout.

3.Make your own layout
Right click to make a button and select pushbutton
     you can have up to 4 buttons

4. When your done click the sync button and follow the on screen instructions.


Step 7: TouchOSC

1.Download TouchOSC  to your iPhone/ Android
I imagine you will be able to find  the app by searching for it on your local app store, if not go to hexler.net to find more info.

2.Find your IP
on a PC: start >run >cmd 

Once your in command line type "ipconfig" (without quotes) and hit enter. your iP is next to the line "IPv4 address" it should be in this format"192.168.0.000" the 0's is your personal number

on a mac: click the apple at the top left of the screen, Then click about this mac.
Then more info. Then network. your ip will be under the IPv4 heading, it should be in this format"192.168.0.000" the 0's is your personal number

3. configure TouchOSC
On a iPhone:
I have attached pictures at the bottom for help. Just match your pages to mine except the ip/host address where you can replace the ?'s with your own IP address. the first picture is the main page make sure stay connected is on, Then click the box that says not configured and set it up according to the second photo just replace the ?'s with your address.

On Android:
I don't actually own an Android so I'm not sure how to configure it  but i imagine it is very similar to the iPhone. If you own an Android device it would be great if you could post some pics to put in the Instructable



If you need any help just leave a comment below and i will try to help as fast as i can

Step 8: Setup the Programs

1. If you don't have  it already download processing IDE from processing.org.

2. You will need to download the oscP5 library for processing
     Go here  and download the library. Extract the files and move the folder oscP5 to this directory {C:\Users\[your user name]\Documents\Processing\libraries\[put the folder here]}

3. Open the the code which can be downloaded below and open it in it's respective program.
      For some reason Instructables renames the programs files so rema,e them back to the                 orignal (ControlArduino.pde) 
       The Processing IDE works just like the Arduino IDE.    File->open
      control Arduino goes with the Arduino IDE or  vice versa

4. Select the COM port for the Arduino board in the Arduino IDE and remember the number.
Tools-> serial port-> COM?

5. Bring up the processing IDE and change "COM4" in the line " arduinoPort = new Serial(this, "COM4", 9600)" to the Arduino serial port you found in the previous step.


Step 9: Try It Out/Troubleshoot!!

Your almost done 

1. Upload the code to the Arduino

2. Run the processing code.


3. Open the TouchOSC app
    Just hit done in the right corner.

4. Hope it works! 

If it doesn't work, don't fret.
You very likely got the polarity wrong. To solve this flip the wires that connect the transistor to your device and try it again. 

If it still doesn't work leave a comment below and i will try to help


Thank you for reading my instructable! please Vote for this If you like it!

Step 10: Expansions

Your probably thinking "This is great but how can i control my coffee maker with my phone?" 

Well here's the solution, You will need a relay. It allows you to control 110v/220v voltages. 
I recommend getting a power switch tail available here .
If you feel to do something more DIY Sparkfun has a tutorial that can be found here
And if your dumb like me you can buy a relay board off eBay by searching "relay 5V board Arduino" and parse it into a extension cable and shock yourself while doing it.

These boards connect the same way as a transistor.

Microcontroller Contest

Participated in the
Microcontroller Contest