Introduction: Globally Synchronized Wifi Touch Lights
This fall a recent death in the family left a bit of a gap in our life. My wife started searching for a way for our family to better keep in contact with each other. After some searching, she came across these long distance touch lamps. Intrigued by the concept, I searched to see if I could build a similar product at a more appealing price point.
After some searching, I discovered the kickstarter project of the same lamps found on Uncommon Goods and the creator’s step-by-step how-to explaining how he made the Filimin touch lamp. What follows is my own how-to on how I created wifi enabled touch lamps to connect my wife, her mom, grandma, and aunt.
The wifi lamps change color when touched and synchronize their colors to be the same no matter where in the world they are located. Each lamp gets assigned a default color so you know who has touched their lamp. This implementation is adapted and heavily borrowed from John Harrison’s original touch lights. You can find more detailed instructions in my wifi touch light blog post.
Step 1: Materials, Supplies, and Tools
Below are the materials, supplies, and tools I used to make my touch lamps.
Materials
- Unifun Touch Lamp ($15 on Amazon with code 6PZD8VVK)
- Particle Photon without headers ($19)
- NeoPixel Ring 24 ($17)
- 10M-Ohm Resistor ($1)
- 3/8” felt pads for covering screw holes on the bottom of the lamp
- A USB phone charger, should be name brand such as Apple, Samsung, Motorola, etc.
- A wooden dowel (1-1/2” inch) for bracing the Photon when plugging in the USB cable
Supplies
- Wire (gauge 22AWG)
- Solder
- Hot Glue
- Goo Gone to remove sticky adhesive from the bottom of the lamp
Tools
- Screwdriver
- Razorblade
- Soldering iron
- Hot glue gun
- Drill and 3/32” drill bit
- Wirecutter/wire stripper
Step 2: Disassemble the Unifun Touch Lamp
The first step is to disassemble your Unifun Touch Lamp. The finished product should look like the following.
- Remove the foam ring from the bottom of the touch lamp. Be careful to remove as much of the stickiness as possible from the bottom of the lamp.
- Unscrew the screws from the bottom of the lamp and remove the bottom plate.
- Remove the four silver screws to loosen the top white dome from the base of the lamp. Do not remove the dome yet.
- Peer between the white dome and the base for a thin wire connecting the top touch plate to the circuitboard. Cut this wire with a razorblade or wire cutter.
- Unscrew and remove the circuit board from the lamp base.
- Use a screwdriver to push the flaps holding the touch plate to the white dome.
- Use a soldering iron to remove the wire connected to the touch plate.
Step 3: Prepare the Shell
Once you have your lamp disassembled, you need to prepare it to be reassembled with your wifi-enabled components.
- Use Goo Gone or some other solvent to remove the sticky residue off of the bottom plate of the lamp.
- Use a 3/32” drill bit to drill a whole through the center of the battery compartment of the white dome.
- Cut a 6-3/4” piece of wire and solder it to the touch plate.
Step 4: Connect the Electrical Components
Now it’s time to connect the electrical components together.
- Solder a 3-3/4” wire to each of the VIN, GND, and D2 pins of the Particle Photon.
Solder the 10M-Ohm resistor to pins D3 and D4 of the Photon.
Thread the wires through the holes in the base and solder them to the NeoPixel. VIN should connect to “PWR +5V”, GND should connect to “GND”, and D2 should connect to “Data Input”. There may be multiple power and ground pins, choose the ones that are closest to the wires. It is helpful to plug a USB cable (unpowered) into the photon through the USB hole in the lamp base to help hold the Photon in place.
Step 5: Test the Lamp’s Functionality
At this point we are ready to test the Lamp’s functionality to ensure we soldered everything correctly and all the components are working.
If you have not yet set up your Photon, plug it in and use the app provided by Particle to connect to your Photon and get it connected to the internet via wifi. Particle provides good instructions for getting your Photon connected.
Once you have your photon connected, you should set up your development environment for getting code onto the Photon, I prefer using their command line tool, but their web IDE is pretty nice as well if you want to get started quickly.
If you are using the command line tool, then you can clone the repository containing the code from Github in order to flash it onto the Photon, otherwise you will need to copy and paste the code into the web browser in order to use it.
Find more details on working with the touch light code on my blog.
Step 6: Secure the Components
Once you have verified the lamp lights up as expected, you can secure the electrical components to the lamp fixture.
- Apply four dollops of hot glue to the lamp base in order to secure the NeoPixel. Do this quickly to prevent having the glue prematurely dry without securing the NeoPixel.
- Secure the wooden dowel to the lamp base (I used a pencil) behind the Photon board. This is used to prevent the Photon from moving when a USB cable is plugged into it. When gluing the wooden dowel, be careful to not cover the three holes that are used to secure the white dome to the lamp base (the fourth hole will be covered by the Photon).
- Unplug the USB cable from the Photon and check if it comes loose. If the Photon comes loose, secure it by gluing it to the base. If you cannot remove the Photon, put glue around the edges to make sure it stays in place. As soon as the Photon is put in place, make sure the Photon is aligned with the USB hole and plug the USB cable into the Photon to ensure it fits easily when the Photon is secured.
Step 7: Reassemble the Lamp
You’re almost finished! All that’s left is to connect the touch plate to the Photon and reassemble the lamp.
- Screw the white dome back into the lamp base.
- Reattach the touch plate to the white dome, threading the attached wire through the hole drilled in the battery compartment.
- Solder the wire from the touch plate to the D3 side of the resistor.
- Screw the bottom plate back on to the base.
- Place six felt pads along the bottom ring of the lamp, covering the exposed screw holes.
- You’re done! You can now play with your wifi touch lamp!
Step 8: Final Product
I built four lamps to give to my wife, her mother, grandma, and aunt. They work beautifully and were a joy to build. As a first Photon project, they were easy to get started and assemble. Check out the video above for a demonstration of how they work.
53 Comments
1 year ago
any suggestions for an alternate for the particle photon? I cant seem to find them anywhere, seems like they are no longer made. thanks
Reply 5 months ago
I used an esp8266 mini and it worked great.
Tip 5 months ago
I was able to successfully build three of these lamps for Christmas gifts this year, thanks for the tutorial!
I used esp8266 mini chips instead of photons since I had them readily available. Given that I ended up writing my own code and using the free Adafruit IO service to connect them which was super easy! If you Google "Friendship lamps Adafruit IO" you will find some example code.
Also, tip for anyone else using esp8266 minis and following this tutorial, you'll only need a 100K ohm resistor vs the 10M specified. I ran it between D3 and D6.
2 years ago
I love the tutorial. I hope you know that there's a company selling
these exact things calling them friend lamps. They are identical to
yours.
2 years ago
Hi! First, thank you so much for this awesome tutorial!! So I am doing this project with my two nephews to give to them, my mom and sister, yep 5 of them haha. I have a couple questions.
I don't really understand how the int's in the particleColors array correspond to actual colors...how is Green = 0, Orange = 79, etc?
I'm a software engineering student, but I've never used C and I'm pretty new to the Photon and hardware in general. I saw on your GitHub comments that the desired behavior is if a button is touched on the same device more than once within 10 seconds "it will pick a random color within a restricted distance of its current color", can this be changed to not change the default color of that device?
My worry is my nephews are 3 & 4yrs old. They're gonna repeatedly press the button lol. What I would like is if they keep touching the button and their default color is say Green, the only thing that would change would be brightness. What I would also love is if the button is pressed X amount of times the light would turn off.
Any suggestions or point me in the right direction would be GREATLY APPRECIATED!!
Question 2 years ago
been struggling to finish this for months but did it!! by removing this
void setupWifi() {
WiFi.on();
WiFi.disconnect();
WiFi.clearCredentials();
int numWifiCreds = sizeof(wifiCreds) / sizeof(*wifiCreds);
for (int i = 0; i < numWifiCreds; i++) {
credentials creds = wifiCreds[i];
WiFi.setCredentials(JobergHome.ssid, 0395275386.password, creds.authType, creds.cipher);
}
WiFi.connect();
waitUntil(WiFi.ready);
Particle.connect();
}
and uncommenting everything in the wifi_creds.h it compiled and successfully flashed.
if i can ask for you help on one thing it would be how to fix this code for the wifi so i can set the ssid and password before sending this overseas
(heres the wifi creds code)
/*
* wifi_creds.h * Description: Specify any wifi credentials in this file to be automatically * added to your Particle Photon. * NOTE: If you specify any credentials here, all other credentials * stored on your photon will be cleared. * NOTE: Credentials should never be stored in version control. If you plan * to specify credentials here, you should not commit them to your repo. * Author: Patrick Blesi * Date: 2018-01-29 * */ // Uncomment the line below if specifying credentials in this file // #define WIFI_CREDENTIALS_SPECIFIED // See https://docs.particle.io/reference/firmware/photon/#setcredentials- for details struct credentials { char *ssid; char *password; int authType; int cipher; }; const credentials wifiCreds[] = { // Set wifi creds here (up to 5) (last entry will be tried first) // {.ssid="SSID", .password="password", .authType=WPA2, .cipher=WLAN_CIPHER_AES} };
also sorry im new to this and its probably very obvious
Answer 2 years ago
Hi, I've managed to get mine working and set up with other people's wifi credentials before sending them off without changing any of the code aside from Wifi details. This is the code within my wifi creds file (passwords replaced with 'xxxxx')
hope it helps...
/*
* wifi_creds.h
* Description: Specify any wifi credentials in this file to be automatically
* added to your Particle Photon.
* NOTE: If you specify any credentials here, all other credentials
* stored on your photon will be cleared.
* NOTE: Credentials should never be stored in version control. If you plan
* to specify credentials here, you should not commit them to your repo.
* Author: Patrick Blesi
* Date: 2018-01-29
*
*/
// Uncomment the line below if specifying credentials in this file
#define WIFI_CREDENTIALS_SPECIFIED
// See https://docs.particle.io/reference/firmware/photo... for details
struct credentials { char *ssid; char *password; int authType; int cipher; };
const credentials wifiCreds[] = {
// Set wifi creds here (up to 5) (last entry will be tried first)
{.ssid="wififorhouse1", .password="xxxxxxxxx", .authType=WPA2, .cipher=WLAN_CIPHER_AES},
{.ssid="wififorhouse2", .password="xxxxxxxxx", .authType=WPA2, .cipher=WLAN_CIPHER_AES},
{.ssid="wififorhouse3", .password="xxxxxxxxx", .authType=WPA2, .cipher=WLAN_CIPHER_AES}
};
Question 2 years ago on Step 5
Hi I have been trein to get the lamp to work for some time now. And I am at step 5 but I cant get my neopixelring to light up. Therefore I was wondering if the touchplate should be soldered already at this step. In order to test it out. Op should the ring already work when its connected to the Photon ? I am making this as a gift so I would really appreciate your help.
Thanks !
Stefanie
2 years ago
I know this instructable has been around for a while. But I just found this particular one. I have to say this is a very nice instructable. I have used Particle products in the past and had some SERIOUS difficulties. I was able to work through them. But it was very painful so I wasn't looking forward to trying these again. But I followed your instructions (including advice you gave other commenters) and the Photons behaved surprisingly well this go around. I was able to hack this together as a prototype. I have the UNIFUN lamps and the neopixel rings will be here soon. I tested with small neopixel strips I had laying around.But this seems to be working! There seems to be a little delay when touching one lamp and having that lamp's color show up on the other one. But it is not ridiculously long. I think I can live with it!
My daughter wanted me to build these for her and a friend. I think she will be very happy!
Thank you very much for the great article.
Joe
2 years ago
I was able to compile my code, but when I try to flash to a lamp it says permission denied. I'm not sure what's going wrong.
Reply 2 years ago
Hi Nainaaa,
Could you post the exact command and error message you are receiving?
-- Patrick
Reply 2 years ago
I actually figured it out a few hours after I posted but totally forgot to remove the comment. Thank you though!
Question 2 years ago on Introduction
Hi, are there additional lamp models that will work?
Answer 2 years ago
to be honest you remove most of the internals from the lamp so any lamp casing will work as long as you can fit all the bits in.
Question 3 years ago
Has anyone managed to get multiple Wifi cedentials set up on the lamps? I want to send one to my parents but don't want them to have to do anything other than plug it in. I'm able to put on one set of credentials but when I try and add a second the code doesn't compile. I want to be able to test that it works here before sending it too.
Thanks
Question 3 years ago
My lamps are working perfectly and I have lamp 2 setup with static wifi credentials (tethered to my phone). I am experiencing a weird issue though:
- When lamp B (setup on tethered SSID and the second lamp in the array) is touched after many seconds of inactivity, it will always change color of both lamps.
- When lamp B is touched within 10 seconds of receiving a color change from lamp A, it will always change color of both lamps.
- When lamp A (setup on home SSID and the first lamp in the array) is touched after many seconds of inactivity, it will always change color of both lamps.
- When lamp A is touched within 10 seconds of receiving a color change from lamp B, it will change only its own color for ~6 seconds and then assume the color of lamp B again. Once touched again after any amount of time thereafter, it will change both lamps colors.
Any ideas anyone?
Question 3 years ago
I have two lamps that light up the same color at the same time.
The touch plate on neither lamp works for me. With the default settings the lamps seem to change color randomly and I've tried messing with the variables in the code to no avail. 'particle subscribe' doesn't seem to register touches, it just updates every 6seconds for both devices...
Any help would be much appreciated
Answer 3 years ago
I was using a 10-Ohm resistor instead of a 10M-Ohm resistor lol. Mystery solved
Question 3 years ago
Edit solved!
I was having trouble with a stupid "Error: Failed to Compile. Please review your code."
I'm new to this so I did not specify which device I wanted to flash to smh. This is great work Patrick. Thanks!
Question 3 years ago
Very cool lamps, would love to build a couple myself. Do they turn off automatically after a certain amount of time? If so, how long?