Easy Peace Tree - Visualizing Peace With WLED

by reachandteach in Circuits > LEDs

30 Views, 0 Favorites, 0 Comments

Easy Peace Tree - Visualizing Peace With WLED

peacetreewled.jpg

Back in 2021, I wrote the instructable "Peace Tree - an Internet-responsive String of Lights". To recap, the Reach and Teach Peace Tree was designed to ask and hopefully answer the question: "Can a holiday decoration change the world?" The hope of the design was that a set of LED lights creating light patterns based on the number of Instagram posts tagged with #peace might inspire more peace and peaceful actions.

The original instructable offers code that can be downloaded into an ESP8266 Wi-Fi board. The board automatically connects to a public MQTT data source that regularly provides a number representing the current number of posts tagged with #peace on Instagram. Peace trees everywhere respond with light patterns based on this number. In addition, anyone who posts with the hashtag #peaceaction or types in a peaceful mediation or thought at https://www.reachandteach.com/peacetree will cause all peace trees to display a special light show... It is kind of a shared secret way that anyone who has a peace tree can signal to other peace trees that they are currently visualizing peace. The original turn-key design still works and should continue to work for the foreseeable future. One of the limitations of the code is that the light patterns displayed can only be changed by recompiling the code.

However, with the wonderful open source WLED controller design https://kno.wled.ge, it makes a lot of sense to have a version of the peace tree that could be configured using the WLED controller's built-in MQTT capability. This allows very high flexibility on the light colors and patterns displayed based on the peace tree data making a cool set of lights even cooler.

So, this is what this instructable is all about.

Supplies

fairylights1024.jpg

WLED controller with a string of 50 addressable LEDs (If you don't have one, you can get it at reachandteach.com, build one yourself using parts from adafruit.com, or get it from a number of places online)

WiFi network where the WLED controller is connected

Browser (Chrome works best) to configure the controller. It should be connected to the same WiFi network as the WLED controller

Summary of Installation Steps

For folks who are already pretty well-versed in configuring and using a WLED controller, this summary of steps may be sufficient to accomplish the task. Otherwise, continue on with this instructable.

  1. Connect to the WLED interface screen for your WLED controller
  2. Create presets with IDs 21 through 26 by copying the JSON text for each setting provided in step 3 of this instructable and pasting them into the API box for each ID.
  3. In Sync Interfaces (which you can get to from the configuration menu), enter the MQTT settings for the public peace tree feed which you can find in step 5 of this instructable. Enable MQTT. Save the settings. This MQTT feed is hosted at takeoneworld.com and is specifically designed to work with WLED controllers. Save the settings.
  4. Reboot the WLED controller (usually by simply unplugging it and replugging it in) and the peace tree should start operating within a couple of minutes.
  5. Please let me know in your comments if you make this since I'm trying to keep track of how many peace trees are out in the world.

Connect to the WLED Interface for Your WLED Controller

wledscreen.jpg

This instructable assumes that you already know how to connect to your WLED Controller either using a web browser on the same WiFi network as your WLED Controller or using the WLED application on your mobile device. I'm also assuming that you already know how use this interface to change colors and effects and have some knowledge about presets.

IF YOU HAVEN'T YET CONFIGURED YOUR WLED CONTROLLER ON YOUR WIFI NETWORK, read and follow my WLED Fairy Lights configuration instructions at: https://shop.reachandteach.com/wled

Creating the Peace Tree Presets

preset.jpg
presets.jpg

Besides the ability to create almost an endless combination of patterns and color palettes using WLED, we can create presets that will allow us to store these configurations so we can easily recall them later. You can either setup the lights as you want them to be, click "+ Preset" and save the current state of the lights OR you can uncheck the "Use current state" checkbox and you can type your desired configuration directly into the API window and save that. We will use this second technique to create a number of presets which the peace tree will need to operate.

So let's do the following steps:

1. Click "+ Preset" to create a new preset

2. Uncheck "Use current state"

3. Copy the following text (which is in JSON format)

{"on":true,"bri":128,"transition":7,"mainseg":0,"seg":[{"id":0,"grp":1,"spc":0,"of":0,"on":true,"frz":false,"bri":255,"cct":127,"set":0,"n":"","col":[[150,0,0],[255,0,0],[0,0,0]],"fx":33,"sx":126,"ix":43,"pal":11,"c1":128,"c2":128,"c3":16,"sel":true,"rev":false,"mi":false,"o1":false,"o2":false,"o3":false,"si":1,"m12":0}]}

4.. Paste it into the API box

5. In the "Save to ID" box, type 21 (to save this as Preset 21)

6. Highlight and change the name of this preset to "peacetree21"

7. Click the "Save" button to save this preset

In a similar way, create Presets 22 through 26 using the following content:

peacetree22 (id 22)

{"on":true,"bri":128,"transition":7,"mainseg":0,"seg":[{"id":0,"grp":1,"spc":0,"of":0,"on":true,"frz":false,"bri":255,"cct":127,"set":0,"n":"","col":[[5,146,0],[255,0,0],[0,0,0]],"fx":33,"sx":126,"ix":43,"pal":11,"c1":128,"c2":128,"c3":16,"sel":true,"rev":false,"mi":false,"o1":false,"o2":false,"o3":false,"si":1,"m12":0}]}


peacetree23 (id 23)

{"on":true,"bri":128,"transition":7,"mainseg":0,"seg":[{"id":0,"grp":1,"spc":0,"of":0,"on":true,"frz":false,"bri":255,"cct":127,"set":0,"n":"","col":[[0,0,157],[255,0,0],[0,0,0]],"fx":33,"sx":153,"ix":43,"pal":11,"c1":128,"c2":128,"c3":16,"sel":true,"rev":false,"mi":false,"o1":false,"o2":false,"o3":false,"si":1,"m12":0}]}


peacetree24 (id 24)

{"on":true,"bri":128,"transition":7,"mainseg":0,"seg":[{"id":0,"grp":1,"spc":0,"of":0,"on":true,"frz":false,"bri":255,"cct":127,"set":0,"n":"","col":[[0,131,133],[255,0,0],[0,0,0]],"fx":33,"sx":153,"ix":43,"pal":11,"c1":128,"c2":128,"c3":16,"sel":true,"rev":false,"mi":false,"o1":false,"o2":false,"o3":false,"si":1,"m12":0}]}


peacetree25 (id 25)

{"on":true,"bri":128,"transition":7,"mainseg":0,"seg":[{"id":0,"grp":1,"spc":0,"of":0,"on":true,"frz":false,"bri":255,"cct":127,"set":0,"n":"","col":[[155,122,0],[255,0,0],[0,0,0]],"fx":87,"sx":128,"ix":128,"pal":0,"c1":128,"c2":128,"c3":16,"sel":true,"rev":false,"mi":false,"o1":false,"o2":false,"o3":false,"si":1,"m12":0}]}


peacetree26 (id 26)

{"on":true,"bri":114,"transition":7,"mainseg":0,"seg":[{"id":0,"grp":1,"spc":0,"of":0,"on":true,"frz":false,"bri":255,"cct":127,"set":0,"n":"","col":[[255,255,255],[0,0,196],[0,0,0]],"fx":73,"sx":91,"ix":128,"pal":4,"c1":128,"c2":128,"c3":16,"sel":true,"rev":false,"mi":false,"o1":false,"o2":false,"o3":false,"si":1,"m12":0}]}

Explanation of the Previous Step


Let's explain what we have done in the previous step. A special peace tree data source has been set up to work with WLED. The peace tree number (which is determined from the number of current #peace Instagram posts) is translated into direct WLED preset commands to invoke presets 21 to 26 based on the following assignments:

0 - 10 posts invoke Preset 21 (red pattern)

11-20 posts invoke Preset 22 (green pattern)

21-30 posts invoke Preset 23 (blue pattern)

31-35 posts invoke Preset 24 (aqua pattern)

36+ posts invoke Preset 25 (rainbow glitter pattern)

A special post invokes Preset 26 (blue and white sparkle pattern)

So if 25 posts with #peace are occurring right now, Preset 23 will be invoked. If 40 posts, Preset 25 is invoked, etc.

Preset 26 is invoked when a #peaceaction tag is used or a post is made at https://www.reachandteach.com/peacetree .

We have created light patterns for each of these Presets which closely mimic the colors of the peace tree but you are welcome to change these patterns to anything you wish.

Connect WLED to the Peace Tree (MQTT) Data Source

mqtt.jpg

A MQTT feed providing peace tree data is hosted at takeoneworld.com and is specifically designed to work with WLED controllers. It is a public, read-only feed.

  1. Go to the Config menu and select Sync Interfaces.
  2. Scroll down to the MQTT section of the page
  3. Enter takeoneworld.com for the Broker. Leave the port number as 1883.
  4. Enter reachandteachpub for the Username
  5. Enter peacetree1234 for the Password
  6. Enter peacetree for the Device Topic
  7. Enter peacetree/all for the Group Topic
  8. Enable MQTT by clicking on the checkbox
  9. Click the Save button to save the settings

Reboot Your WLED Controller and Enjoy Your Peace Tree

peacetreeform.jpg

The WLED controller must be rebooted for your changes to take effect. You can most easily accomplish this by unplugging your controller and plugging it back in. Wait a couple of minutes and you should start seeing light patterns which can be interpreted by the listing in Step 4 of this instructable.

Go to https://www.reachandteach.com/peacetree and type in your meditation or idea for peace in the form on that page, click Submit, and watch your peace tree react to your idea.

Feel free to tinker with the presets in your controller to edit or completely change the light patterns. Remember to uncheck Enable MQTT and reboot when you no longer wish to use your WLED controller and lights as a peace tree. I hope you enjoy your peace tree and it gives you hope and inspires you to help create a more peaceful world.

Thanks!

Thank you for viewing this instructable. Please do me a great favor and leave a comment if you make a peace tree. I'm trying to track how many peace trees are out in the world.