IoT Smart Room Part 1/3 — Automated Lighting

Smart lighting though Python and the Watson IoT Cloud Platform.

This is the first part in a three part series outlining the integration of different components in a smart room through the Watson IoT Cloud Python modules, as well as a documentation of my learning from the project. I’d like to thank the team at IBM IoT, especially Ashek Mahmood and Santanu Sarker, for the guidance and support during development. All code can be found in my Github at

  • 2 Sunfounder Light Seeking Sensor modules (regular photocells can also be used)
  • 6 female to female jumper wires
  • A Philips Hue light bulb
  • A Philips Hue Bridge

Photocell Setup

This approach to automated lighting can be divided into two different components that work together: photocells (sensors) and our Philips Hue light bulb (the actuator). Light sensors (photocells) need to be set up first to continuously monitor the amount of light in a room. These sensors can then send this information to the IoT cloud platform, which will be used later on by the light bulbs.

Sending Data to the IoT Cloud

Now that the sensory component is working, the next step is to send all information to the Watson IoT cloud platform. On the same Python script, I import a few modules for access to the cloud. All devices used on the cloud (in this case the Raspberry Pi) must first be registered on the IoT platform, then accessed with a configuration file parsed in our Python script. You can find the format and documentation for creating a device configuration file here.

Smart Light Bulb Setup

Now that sensory data is sent to the cloud based on whether a room is dark or light, we can setup the remaining hardware to automate the smart lighting. The Philips Hue Bridge will need to be connected to your home router in order to get an IP address, so that it can be used in the Python script. The bulb will need to be connected to the Bridge in order for it to be accessed through Python as well.

Receiving Data from the Cloud

This new Python script will act as an application that controls the smart light bulb and will start by importing another wiotp module, this time being the application class instead of device.

some chaos for you