Introduction: Visual Notification Alert

This tutorial teaches you how to code to inform Phillips Hue to alert. It would be very useful for people who are Deaf and Hard-of-Hearing, have low-vision or sensory disabilities. Visual Notification Alert is to inform the users after getting notifications from e-mail, Facebook, Trello, or similar. The Hue LED bulb starts to alert by flashing the light.

The Photon Particle is a tiny, reprogrammable Wi-Fi development kit for prototyping and scaling your Internet of Things product.

Step 1: A List of Hardware and Software

Step 2: Installation

You should have your Particle Maker Kit, which includes everything, such as sensors, jumper wires, LEDs, resistors, and more. You can read more information about Particle Photon.

Before you connect your photon, you need to know the status of the LEDs on the Photon. Here is the information about the LED status.

Connect Your Photon

  1. Plug the USB cable into your power source. (Your computer works perfectly for this purpose). Your particle device does not need your computer to connect to wifi.
  2. When it is plugged in, the RGB LED on your photon device should begin blinking blue. If your device is not blinking blue, hold down the SETUP button for 10 seconds, then release the SETUP button.
  3. Log in Setup Particle if you already have an account. If you do not have an account, create the account for Photon.
  4. Click on Photon/P Series.
  5. After clicking on NEXT, you should be presented with a file (photonsetup.html)
  6. Click CONTINUE WITH A LOCAL FILE to download a file.

After opening a file

  1. Connect your PC to the Photon, by connecting to the network named PHOTON-...
  2. Configure your Wi-FI credentials. Note: if you mistype your credentials, the Photon will blink dark blue or green. You have to go through the process again by refreshing the page or clicking on the retry process part.
  3. Rename your device. You will see a confirmation if the device was claimed or not.

Before moving to the next part, if your Photon device has a breathing cyan, then it is successful to the Internet and Photon Cloud! We are moving on to the Particle IDE, Build.

Step 3: Coding in Particle Web IDE

You need to create your account for Particle IDE, Build. If you already have an account, then great! Sign in Particle IDE.

We want to test to see if the LED blinks on the board. There is the little blue LED on your Photon board. It is next to D7.

You can download the file, gettingstarted-blinknet.ino, and see the codes there. There is an explanation. Click this link to open the source code in the Particle Web IDE.

If D7 (little blue LED) blinks, congratulations, you just blinked an LED using your Particle device!

If you want to learn more about Photon, such as blinking different LED, reading photo sensor, etc, here is the link.

Now, we will move to the Philips Hue.

Step 4: Philips Hue

For reference: Click here about Phillips Hue API.

Before you can access the Philips Hue API documentation, you will need to register as a developer. It is free, but you need to accept the terms and conditions.

1. First, make sure your Philips Hue Bridge (first picture) is connected to your network is functioning properly. Test Hue App (Hue App is available on iOS and Android) that controls the light on the same network.

If you test it successfully, then you need to discover the IP address of the bridge on your network. Use Philips' broker server discovery by visiting

When you find your IP address, type it into your browser address bar with debug/clip.html appended to the URL: http://bridge IP Address/debug/clip.html.You should see an interface (second picture) like this. Note: Replace "bridge IP Address" to your IP address.

2. Let's do a simple command and get information about your hue system. Fill in the details below leaving the body empty and press GET button. You should see an interface (third picture) like this. You should get an error message. Note: Replace "bridge IP Address" to your IP address.

Address: http://bridge IP Address/api/newdeveloper
Method: GET

Congratulations! You just send your first command!

3. Next, fill in the information below and press the POST button. Note: Replace "bridge IP Address" to your IP address and "phonetype name" to your own phone.

Address: http://bridge IP address/api
Body: {"devicetype":"my_hue_app#phonetype name"}
Method: POST

The link helps to create it for you. When you press POST button, you should get back an error message (fourth picture) letting you know that you have to press the link button on the Hue Bridge. This is the security step so that only apps or servers you want to control your lights. By pressing the link on the Hue Bridge, it proves that the user has the physical access to the hue bridge.

When you get a successful response (fifth picture), congratulations! You just created an authorized user, which we will use from now on.

4. Last example before we integrate it into the Photon Particle, make sure one of your lights is visible and on, and you need to know which number light is. Change the URL to /api/username/lights/light number/state (change the light number [it can be 1, 2, 3, or ?]), and send a PUT button with the following data:

Note: Make sure you change the bridge IP address, username, and light number.

Address: http://bridge IP address/api/username/lights/light number/state

Body: {"on":true, "sat":254, "bri":254,"hue":10000}

Method: PUT

You should see your light changing the color:

Step 5: Setting Photon Up With a Button and Wires

Before we develop more codes into Photon Web IDE, we want to set up our Photon with a button and wires.

You have several buttons and many wires from your Particle Starter Kit.

I have attached two images, one is a diagram and one is an actual picture.

  1. Make sure you place your photon on the breadboard.
  2. Place a button on the bottom of the breadboard as shown in the image.
  3. Put an end of the black wire in J4 (GND) and put another end of the same black wire in J30.
  4. Put an end of the yellow wire in J7 (D5) and put another end of the same yellow wire in J28.

If they match my image I show you, then you are good!

Step 6: Writing Codes in Photon Particle

We will create our first application in the Photon Particle - Web IDE.

  1. Go to and log in (register if you haven't created yet)
  2. Type "Visual Notification Alert" under Current App.
  3. Press the Enter button (see the first picture).

The application is saved in Photon Particle Cloud. The setup() function is called when the application starts and run once. The loop() function does precisely what does it do and loop consecutively, allowing your application to change and respond.

To add HttpClient for the Photon Particle:

  1. Click Libraries from the bottom left of the Web IDE.
  2. Type "HttpClient" in the search bar.
  3. Click "Include In project" in the blue button.
  4. Click the VisualNotificationAlert (it removes the spaces after you created the app).
  5. Click Confirm.

Now, It added HttpClient at the beginning of the Web IDE.

<p>/ This #include statement was automatically added by the Particle IDE.<br>#include <HttpClient.h></p><p>/*** Configuration for Philip Hue ***
/ 1. Replace this with your API username from Step 1
const String API_USERNAME = "<strong>Your API username</strong>";
// 2. Replace this with your bridge's IP address from Step 1
IPAddress hueIP<strong>(x, x, x, x);</strong>
// 3. Replace with the path to the lights you want to control. Use webpage from Step 1 to verify it works.
// Make sure you recognize the number of the Philip Hue light
// /lights/NUMBER/state
const String LIGHT_PATH = "/lights/<strong>Number</strong>/state";
// 4. Replace this with the body of your request for turning the lights on.
const String REQUEST_BODY_ON = "{\"on\":true,\"bri\":254}";
// 5. Replace this with the body of your request for turning the lights off.
const String REQUEST_BODY_OFF = "{\"on\":false,\"bri\":254}";
/*** END Configuration for Philip Hue ***
/ Button
const int BUTTON_PIN = D5;
// HttpClient object used to make HTTP requests to the Hue bridge
HttpClient http;
// Default header for HTTP requests
http_header_t headers[] = {
    { "Accept" , "*/*"},
    { NULL, NULL } // NOTE: Always terminate headers will NULL
// Request and response objects
http_request_t request;
http_response_t response;
void setup() {
    request.ip = hueIP;
    request.port = 80;
    // Onboard LED as indicator light for sensed tap
    pinMode(D7, OUTPUT);
    // For input, we define the BUTTON_UP as an input-pullup. This uses an internal pullup resistor
    // to manage consistent reads from the device.
    pinMode(BUTTON_PIN, INPUT_PULLUP); // sets pin as input
    //We "Subscribe" to our IFTTT event called Button so that we get events for it 
    Particle.subscribe("RIT_Gmail", myHandler);
    Particle.subscribe("Trello", myHandler);
}   // setup() function
void loop() {
    * This is section of testing to whether the light alerts
    // find out if the button is pushed or not by reading from it.
   int buttonState = digitalRead(BUTTON_PIN);
   // When the button is PUSHED, we will get a LOW signal.
   // When the button is NOT PUSHED, we will get a HIGH.
   if(buttonState == LOW)
}   // loop() function
void printInfo() {
    Serial.print("Application>\tResponse status: ");
    Serial.print("Application>\tHTTP Response Body: ");
}   // printInfo() function
int i = 0;
//The function that handles the event from IFTTT
void myHandler(const char *event, const char *data) {
    // Test for printing in serial
    Serial.print(", data: ");
    if (data)
    if(strcmp(event, "Trello") == 0) {
    else if(strcmp(event, "Gmail") == 0) {
}   // myHandler() function
/** The hue value to set light to.
 * The hue value is a wrapping value between 0 and 65535.
 * Both 0 and 65535 are red, 
 * 25500 is green and 46920 is blue.
  * It will alert using the Philips Hue Smart Bulb using the blue color. It will alert for 15 seconds.
void trelloAlert() {
    String trello_body_alert = "{\"on\": true, \"bri\": 255, \"sat\": 255, \"hue\": 46920, \"alert\": \"lselect\"}";
  * It will alert using the Philips Hue Smart Bulb using the red color. It will alert for 15 seconds.
void gmailAlert() {
    String gmail_body_alert = "{\"on\":true, \"sat\":254, \"bri\":254,\"hue\":65535, \"alert\": \"lselect\"}";
 * We will send the PUT to the Philips Hue
 * @param httpPutBody   the body of the string
void sendHttpPut(String httpPutBody) {
    request.path = "/api/" + API_USERNAME + LIGHT_PATH;
    request.body = httpPutBody;
    http.put(request, response, headers); 

When you finish typing or copying the code to your Photon Particle Web IDE, click check icon (Verify) on the top left of the bar.

If it complies very successfully, then we will go to next step!

Step 7: Uploading Code to the Photon

This step is very simple. Before we upload the codes to the Photon:

  1. Plug the USB cable into your power source (I recommend laptop).
  2. Make sure your photon has the breathing cyan LED. If it is not breathing cyan or have different color, go to Step 2: Installation
  3. Click Lighting icon from the Photon Particle Web IDE.
  4. When it uploads the codes to the Photon, you should see magenta. It means the code starts being uploaded to the code. Then, it will blink green fast, then return back to breathing cyan.
  5. Press the button to see if your Philips Smart Bulb flashes (or alerts).

If Philips Smart Bulb alerts, then congratulations! We are almost done!

We will move on to the software part.

Step 8: Creating Applets From IFTTT (If This, Then That)

We will create the applets from IFTTT (If This, Then That) website. The applets will publish an event to the Photon, and then the Photon sends a command to the Philips Hue Bridge to alert the smart bulbs.

For this project, we will use Trello and Gmail to publish events to the Photon.

Go to and sign up.


  1. Click My Applets on the top.
  2. Click New Applet.
  3. Click + this in blue text.
  4. Type Trello in the search bar and click.
  5. Click Card Assigned to me.
  6. Select your board from Trello.
  7. Click +that in blue text.
  8. Type Particle in the search bar and click.
  9. Click Publish an event.
  10. Type "Trello" in Then publish (Event Name).
  11. Select public.

Gmail (Note: they will use your email address when you sign up)

  1. Click My Applets on the top.
  2. Click New Applet.
  3. Click + this in blue text.
  4. Type Gmail in the search bar and click
  5. Select Any new email in inbox
  6. Click +that in blue text.
  7. Type Particle in the search bar and click
  8. Click Publish an event.
  9. Type "Gmail" in Then publish (Event Name).
  10. Select public.

Once you have two applets, Trello and Gmail working, we are moving on to the last step.

Step 9: Finally, Testing

We will test to publish events from Applets to the Photon. Make sure your applets are on.


When someone creates a new card in Trello, they will assign (tag) you in the card. IFTTT listens that and starts to publish an event to the Photon. Then the Photon sends a command to the Philip Hue Bridge to alert smart bulbs.


When you get any new email in your inbox, IFTTT listens that and starts to publish an event to the Photon. Then the Photon sends a command to the Philip Hue Bridge to alert smart bulbs.


  • Whenever we get a new notification from Trello and Gmail, there is a huge delay for sending an event from IFTTT and sending a command from the Photon. It should take less than 5 minutes to alert the smart bulbs.
  • The Gmail Applet sometimes turn off by itself because the applet needs to be reconnected or updated.