How the mobile sketch works:
The brain of the system is really on the arduino or the web page the phone requests. . . The phone just passes any data it sees back and forth. . .
For the phone app to run, it needs the URL of a server and the path to a web page. Once that information has been made available by the arduino board, the phone will request that web page anytime it sees a # on its serial port. . . Additionally, any results from the web page requested are sent back to the arduino via the serial port.
So, if you just need to request data from the web at a set time frame, the arduino sketch needs only to send a # from time to time and wait for the result.
If you need to pass variables to a website, the arduino must pass a string with those variables and end the string with a .
I used a cheap Motorola Iden i415 phone with a pay as you go plan from boostmobile. . . It has unlimited data for 33c/day. It is quite convenient since I can just reboost the account when I need to use it. . .
Debugging this sketch on the phone was a real pain because the phone emulator I use with Mobile Processing does not really have any serial ports. . . Additionally, uploading it to the phone required a trip to an old pc in order to use the Motorola Java Application Loader. So, once I got it all working, I moved all variables off onto the arduino. That way I (or you) wouldn’t have to recompile the phone app should the server address change. . .
There is so much more that can be done with Mobile Processing. Just as an example, Mobile Processing has bluetooth and SMS capable libraries. Those could add a whole new level of interactivity to an arduino board and they are definitely in the list of features I’d add to the sketch. Additionally, using bluetooth would make it compatible with more phones. . . seems like getting access to the hardware serial port is restricted on some devices. . .
Website and webpage:
On that note, you can/should add lots of logic to the web component of this system. The page requested by the arduino can be the result of some preprocessing. . . like this example from Tom Igoe where his php does some page scraping before giving the results back to his arduino.
The length of the messages passed back and forth are limited by the arduino serial buffer which I think is about 128 bytes. I’m sure there are ways around it but I have not gone that far.
The speed at which the phone and arduino communicate is limited by the phone serial port – In my case I used 9600bps, which is fast enough if all you have to toss around is 128 bytes. . . Some phones my not operate at that speed so your mileage may vary.
For more detail: Arduino Mobile Processing