Transform your Photon 2 with a Shelly BLE button, enabling customizable, wireless control for smart home automation and DIY projects.
Story
This guide will show you how to add Bluetooth Low Energy button functionality to your Particle Photon 2, enabling you to create customizable, wireless controls for various applications.
These buttons can be used with any current or future Particle device that supports BLE.
Particle Photon 2
This powerful Wi-Fi microcontroller from Particle continuously scans for nearby Shelly sensors.
For the longest range, add an external BLE antenna (and enable it in the code).
Shelly BLU button setup
Press shortly once, twice, or three times, or press and hold for about 2 sec to emit a signal. It advertises this data in the BTHome format.
It is recommended to update the Shelly devices to the latest firmware using the Shelly app. In case of trouble, you can use the Shelly debug app.
For more technical information, click here.
BTHome
BTHome is an open standard for broadcasting sensor data and button presses over Bluetooth LE.
BTHome is an energy efficient but flexible BLE format for devices to broadcast their sensor data and button presses. Devices can run over a year on a single battery. It allows data encryption and is supported by popular home automation platforms, like Home Assistant, out of the box.
For visiting the BTHome website, click here.
Code
The Particle beacon-scanner library was updated as part of this project to detect BTHome devices.
The minimal code to scan and get information from these devices is on GitHub.
Here's the output of a couple of these buttons read by the Photon 2:
0000124363 [app] INFO: Scanning...
0000124403 [app] INFO: BTHome Address: B0:C7:DE:2C:16:17, Battery: 97, Button: 1, Window: 0, Rotation:
00000124428 [app] INFO: BTHome Address: B0:C7:DE:61:14:15, Battery: 99, Button: 1, Window: 0, Rotation:
00000124454 [app] INFO: Scanning...
Printable examples
Here are some nice 3D printables:
- Shelly BLU Button Door bell
- Magnetic Shelly Blu Button1 Wall Holder
- Shelly Blu Button 1 Fuga Adapter
Usage Examples
Use these buttons in your project to accomplish practically anything you want on your Photon 2.
Connectivity Options:
If there is no Wi-Fi available, Particle offers alternative options:
- Wi-Fi: Use an Argon or Photon 2/P2.
- Cellular: Use a Boron, Tracker One, or Monitor One.
- LoRaWAN: Use the upcoming Particle Muon LTE CAT1/3G/2G + Wi-Fi + LoRaWAN Dev Board for Europe (MUON524) or the Muon LTE-M/2G + Wi-Fi + LoRaWAN Dev Board for North America (MUON404).
- Satellite: Use the upcoming Particle Muon LTE-M/2G/Satellite + Wi-Fi + LoRaWAN Dev Board for Global (MUON635).
Inspired by this project from @tnilsen