iOS Notifications with Arduino


One of the few things I really like about my Blackberry was the red blinky light that let me know if anything new happened. The iPhone is a great device, but it is easy miss that you have a new email or text. Apple has create a centralized place to collect all of these new things you might want to know about, called the Notification Center. However, there is still no red blinky light. If you miss the screen turning on when something comes in, you wouldn’t know that you had anything new.

Apple has added something that can help fix this, Apple Notification Center Services (ANCS). This allows for devices to connect over Bluetooth LE ¬†(BLE), also known as Bluetooth Smart, and receive notifications from the iOS device. It is in iOS 7.0 and most recent iPhones and iPads. ANCS is behind a lot of the new smart watches and fitness bands that do stuff when you have a new email. All this is great, but wouldn’t it be fun if you could do something really big when you get something new?

I thought it would, so I looked for a way to build a Arduino power device that would connect to iOS ANCS. There is a BLE Arduino shield that plugs right in and comes with lots of great code. AdaFruit also has a BLE Breakout Board. They are both based on the great nRF 8001 Chip from Nordic Semiconductor. They provide an Arduino library for their chip and a free software package that makes it easy to configure the features of the chip.

I also came across some great ANCS code for AVRs & Arduinos that was 95% there. I updated it the be compatible with the latest version of the Noridc library, made it easier to pair and rolled it into an Arduino library. I am going to work on getting my code Pulled back up, but until then use my branch to pull down the latest updates.

ANCS Arduino Library

Things are still a little messy, but the overall functionality seems to be pretty stable. You pair the devices once and after that, they automatically join. That alone could be used for some cool functionality. It would be easy to build a box that automatically unlocks when you are near-by or have it play a trumpet sound. This part about ANCS compared to other BLE profiles, is that it works natively and doesn’t require any Apps to be installed on the iOS device. With the BLE Proximity stuff, you need to have an App running on the device to make the initial connection.

Of course the reason for going through this trouble is to get notifications. ANCS pass along all of the Notifications from iOS, including 3rd party ones. You can filter them based on type or source, so you can have a different response depending on what it is. For example, you could do something really annoying for incoming calls, but more subtle for a Twitter mention.

The library works arounds Call Backs and will call the function you specify when a device Connects/Disconnects and sends a Notification.

I have included an example I am working on that displays Notifications on an LCD and turns on the Backlight.

Memory is a problem, so I have some notification fields turned off in order to have a smaller cache.

Also, is Notif a good name? Any thoughts on a better one for the library?

16 thoughts on “iOS Notifications with Arduino”

  1. Hi, I am trying to get this working with an Arduino and I am having some issues with the phone not pairing to the BT LE device. I am using the Adafruit Bluefruit board but I believe that it behaves the same. The documentation says

    “On the iOS device go into Settings, then Bluetooth. Under Devices look for Notif and tap it. It should ask you if you would like to Pair. After that, both the BLE board and the iOS device will be Bonded and remember the connection. If things are working right, both sides will automatically reconnect when they…”

    Whatever I do I cannot get the board to appear in the devices page when using the library. I just get the spinning icon and it sits there. I have tested and the board does work with the Adafruit app fine so I know the board works.

    Were there any settings you needed to change to get this working? Some internet searches say that changes needed to be made using the nRFtoGo software or something?


  2. This is so exciting. I have been wanting to do some version of this, but could not find any examples. Almost all of the BTLE examples out there use an arduino as a sensor, not for notifications. I have several fun ideas to do with this.

  3. Having trouble getting this to compile. Plz halp!

    Arduino: 1.0.6 (Mac OS X), Board: “Arduino Duemilanove w/ ATmega328”
    /Applications/ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=106 -I/Applications/ -I/Applications/ -I/Users/c474774ck/Documents/Arduino/libraries/Adafruit_nRF8001-master -I/Users/c474774ck/Documents/Arduino/libraries/avr_nrf_ancs_library-master -I/Users/c474774ck/Documents/Arduino/libraries/arduino-nrf8001-master -I/Applications/ -I/Applications/ -I/Applications/ -I/Users/c474774ck/Documents/Arduino/libraries/Adafruit-GFX-Library-master -I/Users/c474774ck/Documents/Arduino/libraries/Adafruit_SSD1306-master -I/Users/c474774ck/Documents/Arduino/libraries/RTClib-master /var/folders/2q/1r2mfjl14cxd7_76x8q169rr0000gn/T/build3812658565770576039.tmp/Watch.cpp -o /var/folders/2q/1r2mfjl14cxd7_76x8q169rr0000gn/T/build3812658565770576039.tmp/Watch.cpp.o
    In file included from Watch.ino:5:
    /Users/c474774ck/Documents/Arduino/libraries/avr_nrf_ancs_library-master/ancs_data_source.h:8:17: warning: aci.h: No such file or directory
    In file included from Watch.ino:12:
    /Users/c474774ck/Documents/Arduino/libraries/avr_nrf_ancs_library-master/services.h:37:27: error: hal_platform.h: No such file or directory
    Watch.ino:23:21: warning: lib_aci.h: No such file or directory
    Watch.ino:56: warning: only initialized variables can be placed into program memory area
    Watch.ino: In function ‘void setup()’:
    Watch.ino:91: warning: only initialized variables can be placed into program memory area
    Watch.ino:91: warning: only initialized variables can be placed into program memory area
    /Users/c474774ck/Documents/Arduino/libraries/avr_nrf_ancs_library-master/pack_lib.h: At global scope:
    /Users/c474774ck/Documents/Arduino/libraries/avr_nrf_ancs_library-master/pack_lib.h:128: warning: ‘size_t pack(unsigned char*, const char*, …)’ defined but not used
    /Users/c474774ck/Documents/Arduino/libraries/avr_nrf_ancs_library-master/pack_lib.h:133: warning: ‘size_t unpack(const unsigned char*, const char*, …)’ defined but not used

  4. This is really cool. I was able to get it to work! How can one disable specific notifications? Anyone have any ideas?

  5. Hi Luke!
    Thanks for this great Library! I just got it to work with the Adafruit Bluefruit BLE Breakout!
    Is it possible to make the Notifications cycle through?
    i.e. 2 Notifications are pushed to the LCD, every notification is shown for like 5 secs.
    Also, is there a way to delete a notification if it has been read on the iOS device?
    Shouldn’t it be possible through EventIDs? I am not sure if I understand the ANCS API correctly

Leave a Reply

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