Retrieving SMS messages from Processing on Mac

Here is a sketch written in Processing that allows you to retrieve in real-time SMS messages from a phone. It uses a MySQL-driven database to store the messages, you’ll need to have one at your disposal (remote or local).
A convenient way to install such a database on your computer is to download and install MAMP, then it’ll be just a matter of drag’n'dropping a folder in your Applications folder, the easy and usual way on Mac.
The package comes also with phpMyAdmin, a popular web-based tool to manage MySQL databases from within your browser.
Softwares/hardwares needed to run this program (assuming you have Processing installed):
- Mac computer with bluetooth enabled.
- A mobile phone with bluetooth capabilities (and enabled).
- Access to a MySQL server. Download and install MAMP if you want to run one on your computer.
- Cocoa UltraSMS. This software uses bluetooth communication to connect to your phone, and SQL database to save the retrieved messages.
- MySQL library for Processing by Florian Jenett. The page comes with description to install a MySQL server too.
Here are the few steps to make the program run :
1. Install MySQL and create a database called processingsms.
If you installed MAMP, use phpMyAdmin to perform this operation. This step can be skipped if you have already access to a server.

2. Download and install Cocoa UltraSMS.
Run it and click on the Setup button to modify some parameters. Also, choose your bluetooth-enabled mobile phone in the list.

Note that the screenshot parameters are important and may differ from your MySQL configuration. This paramaters will be used in the Processing sketch to connect to the database :
- hostname + port. On a default MAMP installation, these are set to 127.0.0.1 and 8889.
- database. The name of the database that was created in the previous step.
- username + password. On a default MAMP installation these are both set to root.
3. Click on the Test button to check if UltraSMS can connect to the database. It will also ask you to create two tables (smsins and smsparts), click Ok. The Empty button will remove all the messages already saved.
4. Open Processing IDE, load the ProcessingSMS.pde sketch. In the config tab, change the values of the variables accordingly to your UltraSMS setup.

5. Click on the Start button of the UltraSMS application. If everything goes well, the status should switch to Connected.
6. Run the program, it should display in the console your sms messages that were inside your phone.
7. Tell a friend to send a message on the connected phone, it should be grabbed and saved in the database !
I recently used this configuration in two installations, one of them being the particles cloud that was shown during the Web Flash Festival.
One of the main drawback I had to face is that the UltraSMS application deconnected when messages were sent massively to the receiving phone. You have then to reconnect manually , which may not be a good thing if this system is to be used in standalone installation. UltraSMS source code is available and there may be a hack to force an automatic reconnection in such situations.
The mobile phone I used for the tests was a Sony Ericsson K600i.
The .zip file containing the Processing sketch also contains a php script to simulate the sending of a SMS into database, which is quite handy when you’re in debugging mode. MAMP is then the tool of choice as it also installs Apache which runs a localhost webserver and lets you execute php scripts.
Any feedback would be very much appreciated. If you have tips, mobile phones that worked / not worked with this configuration, projects using this stuff (or other type of configuration), that would be lovely to share. Thanks!
26 Comments