Controlling Arduino With Android Using Processing
Controlling Arduino With Android Using Processing
IMPORTANT NOTE:
These examples are optimized for Processing version 2.0.3a. Since Processing was heavily
rebuilt at version 2.0.6a, these examples are no longer compatible with the latest releases. The
good news is that the rebuilt software is significantly easier to work with. The latest official
instructions for Processing+Android are available here.
We will continue to host these examples, as we feel that they are valuable for the community as inspiration, building blocks
and for future reference. Feel free to take these examples and update them to the latest procedure- if you share with us, well
link to them from here.
Doing this will popup a window asking if the SDK is installed. Click Yes.
Select the location of the Android SDK installation, and click Choose.
Your Processing window should have now changed colors from a blue to a green background, like this:
Great work! The Arduino SDK and Processing are now connected, and you can begin developing applications for use on
your Android.
Once the Arduino software is installed, you will need to install two libraries to enable communication with the ADKs usbconnector to work with the ADK board. Download and unzip the following file.
http://sandbox.tellart.net/apa/Arduino.zip
Inside the libraries folder you will find two Arduino libraries, named AndroidAccessory and USB_Host_Shield. Both of these
need to be placed in the Arduino libraries folder:
Mac: /Users/username/Documents/Arduino/libraries
Win: My Documents Arduino/libraries
If the Libraries folder does not already exist, you may create it
Once those are moved into the right folders, installation is complete. You should double check that everything has gone as
planned.
Arduino.
8. If your upload completes, without any errors, you have finished with the Arduino part.
In Processing:
1. Make sure that the Android device is in USB debugging mode. This is usually found in the
Settings/Applications/Development menu, but might be different depending on your Android version.
2. Connect the Android device to the computer
3. Open the Processing software
4. Open the example RGB_processing from the folder Android_Proccesing_Arduino_Examples/RGB
5. Make sure you are in Android mode
6. Use the Arduino tool you installed previously by pressing Tools/Arduino ADK.
This brings up this dialog:
7. Press Run on Device. This should launch the application on the Android device and start it up right away.
8. Once it is running on the device, you should see a small red circle in the top left. This means that it is not connected. Quit
the application on the Android device and disconnect it from the computer, and connect it directly to the ADK board.
9. Launch the application again and this time the circle in the top left should be green, which means you have established a
connection and everything is communicating properly.
10. Done! Spin the potentiometers and the background should change color accordingly.
Next steps
Now that all the pieces of the puzzle are set up, we can get to the fun part of exploring the tools. In the files you downloaded,
there is a set of examples which each include a Processing sketch, an Arduino sketch and a schematic on how to connect
the sensor/actuator just like the RGB one. Use these as the building blocks to start developing and exploring your own
ideas.
When developing your ideas we recommend a five step process:
1. When you develop the code for the Arduino, make sure all the sensors and actuators work by sending commands from
the Serial Monitor in the Arduino software.
2. When you develop the code for the Processing, make sure it works on the computer by using the mouse as a
replacement for the Arduino.
3. Test your Processing code on the Android device to make sure it behaves as expected.
4. Connect the Processing code with the Arduino code.