Introduction: DIY Long Distance Best Friend Lights
I made long distance synchronized lights known as "Best Friend" lamps. That just means that they are kept in sync to the current color of the other lamp. So if you were to change one lamp green, shortly after the other lamp would turn green. This is a very easy raspberry pi project that anyone can jump into and uses a lot of really basic concepts that are great to build upon.
This would be a great project to run during quarantine since you can't be close together all the time, and it can be used within the same home to signify if you are in a meeting or other important event.
Step 1: Build the Base
To get started you'll need a box to put the electronic components in and feed the light through. I had some left over cherry wood and red oak wood that I used to make the box. I used a single square piece of cherry for the top, which ended up being about 4.5 inches x 4.5 inches and 1.25 inches thick. Then I used mitered pieces of red oak wood to add a section the electronic components will be in. Those pieces were about 4.5 inches long, 1 inch thick, and 2 inches wide. If I were to do this again, I would certainly make the red oak thinner so that the electronic components had more space to fit. After cutting the pieces I sanded them down and drilled a hole for the ws2811 led using a 1/2 inch drill bit. Then I finished them with Mahoney's walnut oil.
Step 2: Make the Diffusion Block
After the base was made I started to make the diffusion block which will be used to spread out the light from the ws2811 led. To do this I cut rectangular pieces out of acrylic and then sanded the acrylic to make it really blurry. This will allow the light from the led to spread out and illuminate more. I then used hot glue to secure the structure
Step 3: Solder Up the Circuit and Run the Code
This is the time to solder up the circuit. Each light has a raspberry pi zero, a ws2811 led, a push button, and a resistor. One circuit is used to control the ws2811 led, while the other is used to check for user input. The ws2811 led circuit is a simple one that uses the ground, 5v, and pwm pins of the raspberry pi to control the led. The user input circuit has a current limiting resistor and a push button that is used to switch the voltage on and off from a raspberry pi input pin.
Each pi is running the same program. This program checks when the push button is pressed, and if so, changes the color. It then sends a message to a web server that tracks the current color. Every 5 seconds this program also checks the current color from the web server and if that color is different than the current color of the lamp, it changes to that color. This is how they are kept in sync. So if you change the color to red on one lamp, that lamp will tell the web server that the current color is red, the other lamp will check the web server in 5 seconds and see that the current color is red and subsequently change to that color. The web server I used was hosted on one of the pis since I was using it within the same network, but you could easily run this server on any public server and the lamps would work across continents.
Given this design you could easily scale this to many more than 2 lamps.
Below are the two repos you'll need to run the project. If you have issues installing BiblioPixel you can take a look at my video on making a message board. It goes into installing BiblioPixel in detail.
Best Friend Light Program running on each pi:
Web Server that keeps track of the current color:
Step 4: Run the Program on Each Pi, Run the Server, and See It in Action!
Now you can run the program on the command line by checking the readme in the previous repos, run the server following the readme, and see it in action!