Created by AppNearMe


Visit us at

NFC with AppNearMe

Here is a demo of hacking a "SAD" lamp to become a colour lamp that can be controlled by placing an NFC-enabled smartphone near it - in this case, an Android Samsung Galaxy Nexus.


When you place a smartphone near it, the NFC connection is made and the lamp tells the phone what app to launch. If the app isn't found, it can be automatically downloaded from the Play Store! Then a colour wheel is presented which can be used to select the lamp colour.

The demo was built with a LPC1768 Cortex-M3 MCU connected via SPI to a PN532 NFC chip (we're using Adafruit's NFC breakout board), and via PWM to a high-power RGB LED using some LED drivers. The software is based on AppNearMe's µNFC stack. The phone is a Samsung Galaxy Nexus running Android.


We chose to retrofit the demo in to a "SAD" lamp to get an easy diffuser for the LED. The great thing about using NFC is there are no buttons or interfaces on the device, simply a power lead (although a device could even be battery powered so there are no interfaces or cables!)

Here is the basic construction of the prototype in to the lamp body:

/media/uploads/AppNearMe/_scaled_bottom_zoomed.jpg /media/uploads/AppNearMe/_scaled_top.jpg

Build your own


To build this demo you will need an Adafruit PN532 Breakout Board and a high-power RGB LED (the one we used can be bought here), three 1K resistors, three BC547 transistors and three 15 Ohm resistors (these ones depend on the particular RGB LED you are using).

Connect everything according to the schematics. You can use a 5V power block to provide the 5V power source.



The code is available here and is ready to be used!

Import programNFCMoodLamp

NFC Mood Lamp Demo Code


Download the program to your mbed, and reset it.

When your Android phone is placed close to the antenna it should redirect you to the Google Play store to download the AppNearMe Android app. If something unexpected happens (including nothing) just shout in the forums!

Get Started with NFC

For more info on how to use NFC with mbed, visit the NFC handbook page

All wikipages