This project combines a Hexabitz IR range sensor module (H08R60) with five RGB LED modules (H01R00) to create a dome of light. Using gesture control you can change colours or intensity in various modes.
The IR module does all the work basically. It detects motion"measuring distance" and sends a broadcast message to RGB LEDs.
You can change between modes by fixing your hand for more than 2.5 seconds. Each changing time triggers an indicator LED blink.
Here's a description for all the dome modes.
Mode1: First LED click turns off all LEDs. When the dome powers on, the mode counter starts from one.
Mode2: This mode cycles through colours by changing distance.
Mode3: This mode varies LED intensity based on distance. Note how colour saves your last intensity setting so that it doesn't jump to maximum when you remove your hand.
Mode4: This mode swipes right or left to turn the LEDs ON/OFF.
Mode5: This mode swipes right or left to cycle through LED colours. So fun!
You can perform this project easily and professionally by doing it as stages.
Stage 1: SolderingYou start combining the modules and soldering them creating the Dome.
Stage 2: IdentifyingAfter you finish soldering the modules, you should identify them with a certain ID's. I didn't define a fixed topology in this project. Instead, I ran the exploration CLI command starting from any module since there is an identical firmware in RGB modules and then let the modules generate their own topology as shown below.
Attached project firmware includes one uVision project for the IR sensor module (H08R6) only. Note that for LEDs, all of them have a master firmware which includes no project. That's why I created only one target in that project: A target for all LED modules.
RGB Modules Code:
As mentioned before, all LED modules have native module firmware. In the callback, the colours code cycles through modes and writes the value to a BOS variable via a remote write API.
IR Module Code:
The IR sensor module code is a bit more complicated but easy to understand. First, we declare a timer "TIM7" to count 2.5 seconds. Then we set sensor units to mm and stream range continuously to a memory variable.
After that, we cycle throw modes by fixing your hand near the IR sensor for 2.5 seconds. For example, mode 1 just broadcasts a turn OFF message to all LEDs.
In modes 2 and 3, we convert the measured distance directly into colour or use it the distance to cycle through available basic colours and then broadcast a set colour message. Colour mapping for absolute distance is straight forward. The HorizontalSweepToColor()
function calls another function that detects a sweep or a motion. The HorizontalSweepToColor()
then cycles through detected sweeps to change colour.
Note how the broadcast message is only sent if there's a colour change and not at the loop 100 Hz rate to avoid spamming the array:
Mode 5 has a lock state. If the measured range is > h08r6MaxRange, this means there's no object in the sensor field of view and the intensity shouldn't get updated. If the distance to an object is > 100 mm, that distance is converted into a valid intensity value.
The final result of this project:
Comments