Bluetooth Mesh Party Lights
Introduction
In this project, we wanted to learn more about the nordic microcontrollers and Bluetooth mesh. Therefore we created a party light that was controlled with a nordic microcontroller and works with the Bluetooth mesh protocol. With an app on your phone, you can select the color and the pattern of the Party lights. And via Bluetooth mesh, the whole network of Bluetooth mesh party lights running on a nordic microcontroller will be updated.
Use case
Bluetooth mesh is a flexible protocol used for connecting devices to each other. For this project, Bluetooth mesh will be used to communicate from the phone to the party lights. Every party light in the room would have a microcontroller with Bluetooth mesh onboard. Using Bluetooth mesh, the multiple-party lights in the house would be connected. This would make a network of party lights that can be operated with one phone.
Every party light consists of a microcontroller, a led strip with 3 individual operable lights, a power supply, and 3 ping pong balls that are glued onto the led strip. By connecting with the Bluetooth mesh app on your phone to the network. You can choose a pattern that the party lights will play. Using 2 sliders on the app, The color and the patterns on the party lights can be set to your likings.
Bluetooth-Mesh
Bluetooth has existed for roughly 20 years. Because of this, it comes to no one’s surprise that several extensions have been created in those years. The introduction of the Bluetooth Low Energy (BLE) standard was created in 2010 to accommodate for the large increase in Internet of Things (IoT) use cases. One of the things that BLE was still missing was support for many-to-many communication. This type of communication means that several BLE devices can communicate with each other within a network.
This changed in 2017 with the introduction of the Bluetooth-Mesh standard. Bluetooth Mesh is a networking standard based on BLE. It supports many-to-many communication. Earlier versions of BLUE only supported:
- One-to-one: Two BLE devices communicating with each other.
- One-to-many: One BLE device communicating to several other devices.
The two main benefits of mesh networks are:
- Increased range: Since devices can pass on their messages, a device can be further away from the controller before it loses the ability to communicate
- Self-restorative capabilities: A mesh network has many different intertwining connections. This means that even if a device loses connection with the network, other devices can still pass messages along.
Supplies
Supplies
- NRF52840-DONGLE - $9,31
- APA102 SK9822 Smart LED Pixel Strip 1m 30 leds - $6,31
https://nl.aliexpress.com/item/33023914601.html?spm=a2g0s.9042311.0.0.174d4c4dnmr40s
- 3x white Ping pong ball - $4,12
https://nl.aliexpress.com/item/1005001620003141.html?spm=a2g0s.9042311.0.0.174d4c4dnmr40s
- 5V 1A power supply - $7,95
Connection Diagram
Connection diagram
In the image below, the required connections between the microcontroller, led strip and power supply are displayed. Pin 0.17 of the microcontroller is connected to the CI pin of the led strip and pin 0.20 of the microcontroller is connected to the DI of the led strip. The plus wire of the power supply is connected to the VBUS of the microcontroller and the 5V of the led strip. The minus wire of the power supply is connected to the GND of the microcontroller and the GND of the led strip.
Microcontroller Setup
Microcontroller setup guide
- Plug the Bluetooth dongle into a USB port and press the reset button at the end of the dongle.
- Startup the nRF programmer,
- We made use of nRF Connect v3.7.1
- And nRF Programmer v1.4.11
- Select the desired dongle from the dropdown menu in the top left. If it doesn’t appear here, check that you’ve inserted it properly and make sure you’ve pressed the reset button.
- Click the “Add HEX file” button and add the accompanying “dimming_server_nrf52840_xxAA_s140_7.2.0.hex” and “s140_nrf52_7.2.0_softdevice.hex”.
- Click the write button to write the files to the controller. This may take a few seconds.
Configuration Guide
Configuration guide
App setup guide
- Press the “+” button.
- Click on the “nRF5x Mesh Dimmer”.
- Click “IDENTIFY”.
- Click “PROVISION”.
- Click OK with “No OOB” selected.
- The app will say “Mesh node had been successfully configured”. If this step doesn’t work. Flash the microcontroller again with the same firmware and try again.
- Click on the recently added nRF5x Mesh Dimmable Light.
- Click on the arrow facing down in the elements tab.
- Click on Generic Level Server.
- Click on “BIND KEY” and click on the application key. Then click on the arrow at the top left of the screen to go back.
- Click on “SUBSCRIBE” and select an existing group that you want the lamp to be a part of. If you don't have a group already, Click “Create a new group to subscribe” and click OK.
- Click the arrow back in the top left of the screen to go back.
- Click the arrow back in the top left of the screen to go back.
- You are now on the main menu.
App use Guide
- Click on ”Groups” at the bottom of the screen.
- Click on the group you want to turn on
- Click on the dimmer pad.
- With The level slider, you can select the animation you want to activate. With some of the animations, you can use the Transition time slider to change the color of the animation.
IMPORTANT: -When choosing an animation with the level slider, Completely let go of the slider to send the animation to the lamp.
-When choosing a color for the animation. First Slide the transition time slider to the preferred color the select the animation again using the level slider to send the new color to the lamp.
Animations:
- Off animation
- Rainbow phase animation
- Rainbow same animation
- Dropping ball animation (customizable color)
- Fade animation (customizable colour)
- Party animation
- Idle animation (customizable colour)
Party Light Patterns
Some of the patterns have a variable color that can be set using the color sliding bar. Other animations have a predefined color. Such as the rainbow animations.
Files
Included are the softdevice and hexfile for the microcontroller.