Gerrit redesigned the T-shirt from the original polar bear design to a design which will help alert users to which interests they matched on, as seen below. This will match the size of the LED ring once it is fitted onto the T-shirt, allowing a quick visual reference to which interests or hobbies the wearers have matched on.
Gerrit’s T-shirt design, made to accommodate the LED ring within the design
Since my part of the project includes handling the physical prototyping with NodeMCU, I had to change my code to work with this design.
Creating Lighting Effects – Neopixel 24
The new T-shirt design incorporates a thirds system to allow users to identify which interests they matched on.
For single matches, only specific parts of the board will light up.
I changed my code to accommodate this thirds system – I split the LED ring up into thirds relating to which match was made. Since the Neopixel Library allows you to set individual LED colours based on their number, it is possible to count around the ring between specific numbers.
Although the LED ring will need to be ‘reset’ to off between animations, the left/right match code can otherwise stay the same.
Basic match with direction
This visual code works not only for the wearer but for other wearers too – It acts as a quick visual reference to allow you to instantly see who you matched with!
I also made my own functions for lighting effects such as breathe effects and directional matches. The breathe effect cycles through brightness as a percentage (in a similar way to setting the brightness in the code setup). Whilst this works, it does require perfect timing on delays, as if you miss the timing the LED ring will not go back to full brightness. Percentages should also be used as to not overwrite the initially set brightness of the LED ring (to avoid it turning down to ‘0’ brightness and staying there!)
Final Lighting Effects
I modified my code to show more interesting lighting effects and fix some issues that I previously came across.
One of the main issues I noticed was that when a match was made, if the ‘background’ was left as the default blue the matches were not as easy to notice (for example, if two matches were made, the last third would stay blue, so it could be interpreted as 3 matches instead of 2). I combated this my programming the LEDs to switch off after matches and between directional animations. This also has the added bonus of being more eye-catching to both users and viewers!
Matches count across one third of the ring (always in sequence, so the motion is a constant clockwise direction for a smoother appearance) If there are multiple matches, this will count across all of the thirds in sequence (as seen above). Once it has finished counting round, the ring lighting will “Breathe” for one cycle.
After this, the directional lighting will begin. This lights up half of the ring white and green. The effect means that the ring will appear to light up white with a green “arrow” moving towards the center in whichever direction the match is. To achieve this, I programmed the LEDs individually to delay the change in colour. This animation will run for 4 cycles.
Handling Multiple devices across MQTT
In order to keep it efficient, each board takes a unique ID and then an instruction, then a direction. for example “1” for board 1, followed by “1” for match one and “2” for match right. at the same time, board 2 would receive “2” followed by match “1” and “1” for match left.
MySQL database, where the interests are stored
When this is hooked up to Glenn’s MySQL and Node-Red code, these sets of instructions are sent to the relevant T-shirts when a match is made within a certain location. This location is worked out using the Google Maps API (also used to determine the Left/Right directional matches).
2 LED rings matching on all 3 interests. Note the motioning towards each other. (Delay due to internet!)