Arduino push notifications: My Solution

I’m working on a project that requires the Arduino to send me push alerts when certain conditions are detected. As those who’ve played with an Arduino know achieving basic Internet connectivity isn’t difficult but the limited processing power and RAM make doing much with that connectivity a challenge. For example SSL/TLS isn’t feasible. I wanted a solution that would be simple, lightweight from the Arduino’s standpoint and reliable. After quite a bit of Google-facilitated research I rejected trying to use email and SMS and instead went with Prowl.

Prowl is an iOS client for the Growl notification system and in my case combining that with PHP scripts from the ProwlPHP project proved to be a simple and reliable solution. The Prowl client for iOS costs $2.99 as of this writing so while this isn’t a free solution I do consider it very cheap. Notifications are free. The cost, assuming you have the necessary infrastructure, is negligible compared to the cost of an Arduino with Internet connectivity and once you’ve set this up you will likely find additional uses.

I plan to document the full project in detail at a later time – this post will focus on what was needed to create a notification environment suitable for an Arduino. Prowl and ProwlPHP are fairly simple but in the links I reviewed there was no step-by-step for getting the whole enchilada working on a Mac. Hopefully the information here will help those who follow. From a hardware standpoint all you’ll need is an Arduino with a Ethernet or Wifi interface. I’m using an Adruino Duo with Sparkfun’s WiFly shield attached.

I already have a Mac Mini functioning as both a server and a desktop machine for the kids and hence it is running 24×7. The Prowl based solution depends on having a computer running constantly (or at least at all the times you’d like to send notifications). You can certainly achieve this same system using a Windows machine or a hosted service that allows you to run your own PHP scripts but I won’t cover those other approaches here. At a high level the steps required to make this all work are:

  1. Sign up for Prowl and install the Prowl application on your iOS device
  2. Install Growl (if necessary, many applications use it so you may already have it on your machine) and install the Prowl plugin for Growl
  3. Enable PHP
  4. Start the built-in Mac web server
  5. Install ProwlPHP to enable the server to send push notifications to Prowl on your iOS device
  6. Test the server and prowl setup

As you can see the list of steps isn’t short though most are very straightforward. I’ve tried to check this list over but my apologies in advance if I missed a detail some where.

Step 1: First thing you should do is visit Prowl, sign up, this part is free!, and create your API keys. This key step will allow you to associate your PHP script with your iOS device so you can receive push notifications. Also make note of your Prowl username and password as those are needed in the next step. You should also now make the trip to the App Store (opens in iTunes) to pick up the iOS Prowl application.

Step 2: Continuing on with the easy stuff you need to install Growl, unless it is on your machine already, and then install and configure the Prowl plugin for Growl. I found these instructions on the Prowl site very helpful so I’m not repeating them here. Just click on over and do what they say :)

Step 3: Next you’ll need to enable the use of PHP with the Mac’s builtin web server (Apache). This is probably the most technical step in the whole process. Open the Terminal application and type (you may want to copy and paste to be sure you don’t have any typos):

sudo open -a TextEdit /etc/apache2/httpd.conf<

When prompted enter your password (your account needs to have administrator privileges) and once the file opens search for the following line, delete the “#” from the beginning, and quit TextEdit saving the changes. The ‘#’ is a comment indicator so removing it makes the PHP module “live” when the web server loads.

"#LoadModule php5_module        libexec/apache2/"

Step 4: Next you need to ensure the Mac can accept web page requests. To do this use the Apple menu to open System Preferences and select the Sharing icon. When presented with the below screen you will want to turn on Web Sharing (put a check in the box) if it is not already on. After doing that you can close System Preferences. Note: if the Web Sharing box was already turned on you may need to turn it off and then back on to be sure the change to httpd.conf in the above step takes effect. Sidebar: I configured my router to assign a static local IP address to the Mac I’m using as the server. This enables me to hard code the IP address shown in the below window into the Arduino code which avoids the need for a Bonjour library or other method for looking up the server’s address. 

Step 5: Hang with me! The hard part is over and you’re nearly done. Visit ProwlPHP on github and click the Downloads button on the right side of the window. In the popup window I recommend choosing the “Download .zip” button. The file is small so this moves fast. If your browser is not setup to automatically decompress downloads you will need to double-click on the resulting ProwlPHP .zip file. Next double click on the resulting folder and then double click on the “src” folder. Inside is a single folder called Prowl. You need to drag that folder’s icon to the Sites folder in your home directory. Once done the contents should include at least this:

Step 6: Next you will likely want to test things out. Go back to the ProwlPHP folder you downloaded but instead of going into the src folder open the “examples” folder and copy (or move) all the bootstrap and example PHP files to the Sites folder. Once done your Sites folder should like something like this

Double click on “example.php” and scroll down to this line


Select that long jumble of text and numbers between the quotes and deleted it. Then copy your API key from the Prowl site (which is a similar jumble of numbers and letters) and paste it between the quotes. Then save the file. Once this is done type the following into your browser’s address bar (substituting your short user name on your Mac for “my_user_name”)


and your browser should display a response with a first line of

Message sent. You have 999 Messages left

You will also likely see some error messages based on apparently outdated code in the example.php file. These errors can be ignored but they can also easily be fixed when you modify the example.php file to display your own content. To eliminate the errors simply delete this line to avoid the call to “date”.

print "Your counter will be resetted on " . date('Y-m-d H:i:s', $oResponse->getResetDate()) . PHP_EOL;

To customize the content of the alert that is sent find and modify the text in the quotes of these three lines in exmaple.php (only the first one is required, you could delete/ignore the other two if you want):

$oMsg->setEvent('My Event!');

$oMsg->setDescription('My Event description.');

$oMsg->setApplication('My Custom App Name.');

That’s it, you should be up and running! In your Arduino sketch once you are connected to the network and have created a Client object for the server you would use code like this to invoke the example PHP script:

client.println("GET /~my_user_name/example");

Hopefully if you’ve read this far you will have found this useful. Once again my apologies for errors and omissions in the details.

6 thoughts on “Arduino push notifications: My Solution

  1. Pingback: Arduino Alarm with Push Notifications » Slices of Ron - the blog

  2. My computer won’t run the localhost/~username/example in a browser. It will run example.php and just show me the code. I have edited the httpd file through terminal using the nano command (file is locked on lion), but I don’t know if the PHP server is live. Is there anything I’m not doing? Also, to run the file from my arduino, do I always need my computer open?

  3. hi Ryan. Did you replace “username” with your short user name from the Mac (e.g. “ryan” if that is your short user name)?

    Yes, the Mac has to be on anytime you want to send a Prowl notification.

  4. Hello Ron,

    apologies for my amateurish query but I am still the very beginning of my experiments with the Arduino.

    With the purchase of the WiFly Shield (or an ethernet device) I assumed that the Arduino unit would log itself into my home’s WiFi network independently from my computer (i.e.. computer switched off while the Arduino is still capable to send push messages via Prowl), yet you mentioned the necessity of your computer running 24/7. I am probably misunderstanding the principle idea here, thus please clarify. It’s much appreciated.


  5. Hi Chris. The Arduino cannot run php scripts directly. So to run PHP the Arduino connects to the computer using HTTP and the computer runs the PHP script. In the original design I used my own computer to execute the PHP script and hence it needed to be turned on.

    I have subsequently used my website at to run the PHP script instead so my own computer does not need to be on. Getting the scripts to run at GoDaddy was a bit trickier than doing it locally but it has been quite stable once I got it working.

Leave a Reply

Your email address will not be published. Required fields are marked *