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.
- Insert the batteries in the candle.
- Turn on the candle and note that in default mode, the candle changes color every few seconds.
- Install several Bluetooth packages that will allow your Raspberry Pi to talk to the candle:
- In your SSH terminal, run the command:
sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev
- Create and then navigate to a development directory into which you will install the DeveloperWorks recipe application.
- Clone the following repository:
git clone
https://github.com/markusvankempen/playbulb.git
- Navigate to the newly created clone:
cd playbulb
- Install the application dependencies:
sudo npm install
- In your SSH terminal, run the command:
- 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.
- Use the application to control the candle:
sudo node pipb <device mac address> blue
The candle color should be set according to your command.
- Determine the mac address of the Raspberry Pi:
Ifconfig
- Make a note of the mac address of the PLAYBULB Candle, which will be
HWaddr
.