Skip to content

Elixir library for controlling a BSR Smart Bluetooth LED Bulb.

Notifications You must be signed in to change notification settings

diacode/bsr_bulb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BSRBulb

<img align="right" src="https://raw.githubusercontent.com/diacode/bsr_bulb/master/web/bsr_bulb.jpg", width="400">

An Elixir library for interacting with a BSR Smart Bulb that is connected via bluetooth. This is an RGB LED Bulb with built-in speaker.

It seems there are others brands that sell this bulb under their own name. Some of them are:

In order to reverse engineering the Bluetooth protocol of the bulb we used the Bluetooth HCI snoop log from Android, to capture the bluetooth packets between the mobile app and the smart bulb, and Wireshark to analyze the packets. You can read more about this approach here.

## Supported features

  • Switch on
  • Switch off
  • Set color

Usage

On Mac OS X, pair your computer with your bulb by using the normal Bluetooth device explorer. Once connected, you should hear a sound coming from the bulb's speaker.

Then you need to find the serial port for your bulb. You can use ls /dev | grep tty. For the 1byone version the port is /dev/tty.1byoneBulb-SerialPortSe.

Then open an elixir terminal with iex -S mix and type:

device = "/dev/tty.1byoneBulb-SerialPortSe"
{:ok, bulb} = BSRBulb.Client.start(device)
BSRBulb.Client.switch_on(bulb)
BSRBulb.Client.set_color(bulb, "#ff0000") # Red
BSRBulb.Client.switch_off(bulb)

Acknowledgments

This library was based on the Sphero library. While the bulb and Sphero are different devices, both are controlled through Bluetooth using erlang-serial.

About

Elixir library for controlling a BSR Smart Bluetooth LED Bulb.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages