In this lab, you are going to access and control Philips Hue lightbulbs via HTTP requests, then using an Arduino. You will also push data to the cloud using MQTT.

General Setting

The general setting for this practical session is the following:

  • The Philips Hue light bulbs communicate with the Hue Bridge using the IoT ZigBee Light Link protocol.

  • The WiFi Router exposes a WiFi network with SSID NETGEAR95 and password purpleunicorn212. Its IP is 192.168.1.1

  • The Hue Bridge is connected using Ethernet to the Hub. Its IP is 192.168.1.149.

  • The Hue Bridge provides a RESTful Web API that applications can use to interact with the lights at http://192.168.1.149/api/…​;..

  • The Hue Bridge provides a HTML form to write queries to the lights at http://192.168.1.149/debug/clip.html

  • A raspberry PI is connected to the hub using ethernet. Its IP on this interface is 192.168.1.3. It is the DHCP server for this LAN.

  • The raspberry PI is also connected to eduroam using WiFi. It has another IP address on this network. You don’t need to know.

  • Network Address translation (NAT) is set up in the raspberry PI to route requests between the two networks. This way, you can access the internet and the IoT devices.

  • You will develop a program to connect an Arduino to the WiFi, and issue HTTP requests against the Hue Bridge to control the light.

  • You will also send sensor data to the MATLAB cloud https://thingspeak.com/ using MQTT

Report

At the end of the session, you must demonstrate your setting to the professor, and push your code in a separate folder in your git branch with a README that explains everything.

Libraries

For this lab you may need the following libraries:

Philips Hue API

The Philips Hue API is documented at https://developers.meethue.com/develop/hue-api/ . You need to sign in to access it for free.

  • Create a developer key on the Hue Bridge. Update the name of the developer with the names of the members of your group.

  • Find the Philips Hue light bulbs that are available.

    • open the debug tool in your browser http://192.168.1.149/debug/clip.html

    • in the "URL" field, enter the following relative path: /api/<YourDeveloperId>/lights/

    • click the "GET" button to send an HTTP GET request at this URI

    • Open the "Developer Tools" tab of your browser to examine the HTTP request and HTTP responses that were exchanged. Check the raw HTTP headers of the received response.

  • If you cannot find these lights, then you may need to ask the Hue Bridge to discover lights, and potentially pass it the specific identifiers of the lights for your group (written in red on the side of the lamp, or on the lightbulb)

  • Experiment a few commands to change the light state (on/off, color)

  • Control the lights from the ESP32

    • The Arduino setting and examples from the libraries above provide very good starting points.

ThingSpeak MQTT Broker

The ThingSpeak documentation is available at https://fr.mathworks.com/help/thingspeak/