2. Connect the candle to the IoT Platform

In this section, you connect a PLAYBULB Candle to the Watson IoT platform by using the Raspberry Pi as a gateway.

  1. Insert the batteries in the candle.
  2. Turn on the candle and note that in default mode, the candle changes color every few seconds.
  3. Install several Bluetooth packages that will allow your Raspberry Pi to talk to the candle:
    1. In your SSH terminal, run the command:sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev
    2. Create and then navigate to a development directory into which you will install the DeveloperWorks recipe application.
    3. Clone the following repository:git clone https://github.com/markusvankempen/playbulb.git

    4. Navigate to the newly created clone:cd playbulb

    5. Install the application dependencies:sudo npm install

  4. Find your PLAYBULB Candle by running the application:sudo node pipb ???

    The application finds all Bluetooth broadcasting devices, including your SensorTag, but fortunately the PLAYBULB Candle is clearly sign-posted.

  5. Use the application to control the candle:sudo node pipb <device mac address> blue

    The candle color should be set according to your command.

  6. Determine the mac address of the Raspberry Pi:Ifconfig
  7. Make a note of the mac address of the PLAYBULB Candle, which will be HWaddr.