Find all your DIY electronics in the MakerShed. 3D Printing, Kits, Arduino, Raspberry Pi, Books & more!

Getting iPhone push notifications from objects in your physical world is possible using an Arduino with an Ethernet Shield, a PHP-enabled web server and an iPhone app called Prowl. In this video, I show how to set up a mailbox so that it pings your phone when snail mail is delivered, but it’s very easy to adapt this project to whatever suits your needs.

Prowl is an iPhone app with the sole purpose of delivering push notifications to you from your computer via Growl or from online services with the API. In order to connect the Arduino to Prowl’s API, we need a PHP proxy server. This is because Prowl’s API requires an SSL connection, which the Arduino isn’t capable of making. Luckily, setting up the server is easy because all of the hard work has already been done by the fine people behind the ProwlPHP class. All you need to do is paste your Prowl API key into the example code and change the example text to the alert that you want to send. When your Arduino requests the URL of that example script from your web server, the alert is pushed to your phone almost instantaneously.

For the code on the Arduino, I simply adapted the WebClient example that’s included with the Arduino IDE. I changed the server address, the URL, and the basic structure of the code so that it requested our ProwlPHP script’s URL when it sensed a “high” signal from the switch. I also added serial output for debugging. You can check out the code I used for this project on Google Code or just download the Zip file.

There are a lot of great uses for this project. You could have push alerts delivered to your iPhone when you leave your garage door open, when someone opens your front gate, when the temperature drops below freezing, or when your home power usage exceeds a certain level. Whatever kind of switch or sensor you can hook up to your microprocessor can trigger a push alert. I’m eager to see how you decide to implement iPhone push alerts into your projects.

Subscribe to the MAKE Podcast in iTunes, download the m4v video directly, or watch it on YouTube and Vimeo.

More:

Ask MAKE: Pull-up resistor

In the Maker Shed:

Makershedsmall

Arduino Family

Make: Arduino

Matt Richardson

Matt Richardson

Matt Richardson is a Brooklyn-based creative technologist, Contributing Editor at MAKE, and Resident Research Fellow at New York University’s Interactive Telecommunications Program (ITP). He’s the co-author of Getting Started with Raspberry Pi and the author of Getting Started with BeagleBone.


Related

Comments

  1. rolandojones says:

    I think this is an awesome project, but it needs Wi-Fi. It’s not very realistic to string CAT-5 across your lawn to connect the Arduino to the Internet.

    I haven’t tried it yet, but a YellowJacket Wi-Fi shield sounds like a good solution.

    How come there aren’t more/easier WiFi arduino shields out there?

    1. Collin Cunningham says:

      good question – I remember reading something about the chip on the WiShield requiring some special proprietary/closed code to be DLed/installed from the manufacturer’s site – might be discouraging for open source oriented devs (?)

    2. Matt Richardson says:

      Certainly for some people running cable from the mailbox to the home isn’t practical. But I recommend keeping the Arduino in the home and just running some two conductor insulated wire from the mailbox switch into the house. A wireless solution like Xbee or Wifi would be awesome, but would require power somehow.

    3. bld says:

      For mine I am using a commercial product to do the wireless stuff.

      I did a search on ebay, and found a few that should be possible to hack into http://shop.ebay.co.uk/i.html?_nkw=mailbox+alert

      I am using something like that for mine too http://bld.is-a-geek.com/2011/01/02/snail-mail-notifier/ and using a 2N2222 transistor to ‘press’ the reset button. And was able to find a 5V pulse for the LED that flashes when the transmitter in the mailbox is activated.

    4. Kevin says:

      HI! I have found a page that you can buy a mail alerter kit you build your self, check it out onhttp://diymail.webs.com

  2. buddyhollyclone says:

    i’ve got a similar setup for my doorbell, except my arduino+ethernet sends a twitter direct message (through NeoCat’s twitter library) which is pushed to me via the iPhone app “Chirpy” within about 5 seconds. the benefit of this approach is that i don’t need my own php server, just twitter’s service.

    1. Matt Richardson says:

      What a great idea to use Twitter. I was trying to find a way to make it “cross platform” by using an SMS gateway, but most charged services an arm and a leg for access to their SMS API. A twitter DM triggers an SMS to me, so that would have been a great way to do it. Thanks for the suggestion!

      1. Marc de Vinck says:

        I did something very similar with my Kitty Twitty project. (basically a switch that Twitters)

        http://makezine.com/22/kittytwitty/

        There are a few issues using Twitter (and the new authentication) but there are ways to work around it.

        FYI – Great job on the video, and build, looking forward to many more!!!

  3. Collin Cunningham says:

    forgot to say – great vid, Matt!

    1. Matt Richardson says:

      Thank you! And thank you for the awesome music!

  4. Pete Prodoehl says:

    Notifo may be another alternative to Prowl. Their iPhone app is free, and you can use their API for free as well (within limits which are high enough for any personal projects.)

    supertweet.net is another site to check out, since their tagline is “helping things that tweet” and you can use HTTP rather than HTTPS.

    1. Matt Richardson says:

      Hey Pete! Thanks for the info about Notifio. Their site says that Android and Blackberry versions of their client are in development, which would be great for making this project useful for people with those types of phones. If only the API didn’t require SSL, it would be perfect!

      Supertweet.net is great too. For a project I’m working on now, I thought I was going to have to “roll my own” twitter API proxy server, but I think this will help me out a lot.

  5. bld says:

    Hi, I found this great video, and wanted to do something similar to my new mailbox before putting it up.

    Only downside is that my mailbox would require around 30m of wire, to reach out to the switch.

    Instead I took one of the already made wireless mail notifier, and hacked into it instead.

    So now I got the wireless notifier connected to my arduino, and my snail mail notifier is wireless :)

    Here is how I did it: http://bld.is-a-geek.com/2011/01/02/snail-mail-notifier/

    1. bld says:

      Just updated the arduino sketch for my project.

      Added debounce, so it will only send maximum one message pr. 30th second, and using interrupt instead of the loop checking if the ping is HIGH.

      1. Matt Richardson says:

        I’m glad you liked the project, and thank you for sharing how you’ve extended it!

  6. DIDAMEDIA says:

    Sorry I paid more attention to the video quality than the content. Really nice video was it shot on a DSLR? Possibly a Canon 5D Mk2 or 7D?

    Cheers,

    Frank
    DIDA MEDIA
    http://www.didamedia.com/

    1. Matt Richardson says:

      Thank you! Yep, you’re absolutely right: I shot this video on a 5D Mark II.

  7. 3leftturns says:

    This is very cool, but what is the mailman going to think when there are wires and circuit boards all over the mailbox? This project may go the right way for having the bomb squad blow up your MB and consequently, your project.

  8. one2one says:

    1 – Thanks for the post
    2- You can setup and wireless network with cheap RF modules. ($5 receiver an sender)
    3 – with the sensor network your can scale the sensor network easier
    4 – use an online platform/service to set policies and the respective matching action

    I did a similar experience before :
    http://middlewaresensing.wordpress.com/2010/05/12/intelligent-mail-box/

    Here is the platform i use:
    http://dev.hci.uma.pt/sawa/
    http://hci.uma.pt/wiki/index.php/File:Services.png

  9. bld says:

    I have just “finished” a project where you can send messages to multiple platforms.

    With just one call to an url, you can send a free push message to iPhone and Android phones, send an email, or send a message to growl.

    I am working on getting the twitter to work with OAuth too, and when it is stable, it will go into the system too.

    It is possible to select what you want to send the message to, and even create multiple messages with different content in, and individual selection of how you want to get notified.

    And even better, my system can be called directly from an arduino, because it doesn’t use https, the arduino just calls a normal http url, and my server then takes care of the https with the different services you want to use for notification.

    The project is still in beta, and I am looking for some beta testers. :)

    And best of all… It is totally free to use. :)

    If you are interested, please send me an email http://captain-slow.dk/contact-me/

  10. Anonymous says:

    Any way to do this with an android phone?

    1. You could use a text messaging gateway such as Twilio.

  11. Anonymous says:

    hey is there any code out there that just sends an email from the arduino an am not really an expert in programming yet but am looking to the the same thing only send an email unless it is easier to send a text. just looking for some help

  12. danst0 says:

    I just finished a wireless version of this project (German: http://danst0.com, Google Translate: http://translate.google.de/translate?js=n&prev=_t&hl=en&ie=UTF-8&layout=2&eotf=1&sl=de&tl=en&u=http%3A%2F%2Fdanst0.com ). Using a wireless doorbell, Arduino Mini, Growl and Prowl.

  13. MyFreeWeb says:

    Why PHP? Try Node.js. And the Prowl API doesn’t require SSL anymore. You can remove the proxy part and notify directly from the Arduino.

    1. Do you have an example of this you can share please.

      Many thanks.

  14. awesome work. i’ve adapted your code to give me notifications from my website (which runs an older version of PHP) based on the username, and it works great! thanks for helping me figure this push thing out!

  15. Anonymous says:

    Hi Matt, thanks for this cool intro project to Arduino. I almost have this going but I’m not able to connect from the Arduino, connection failed.

    I know my php script is working correctly because I can call it from a browser and get the push alert. I’ve also been able successfully telnet into the shield.

    I’m using Xport Direct Plus if that makes a difference.

    What can I try next to debug this?

    Thanks

  16. Hi, id like to do that! But is there a way to do everything Wireless also the “ethernet” part? if so, can u help me to find what i need for it? (im new to that stuff, so please be kind ;))

    Edit:
    I Already found a WiFi Shild for Arduino for 55$ (http://asynclabs.com/store?page=shop.product_details&flypage=flypage.tpl&product_id=26&category_id=6)

  17. Kevin says:

    HI found a page where they sell mail alerter kit works great, bought last week check it out if you want to build your own or have your own! diymail.webs.com