Magnetic levitation desktop atmosphere light (Arduino+WS2812)
Author: tomouwerkerkerk
This is a small and warm floating desktop atmosphere lamp. The color-changing dim light adds a touch of gentleness to the room.
It is built based on Arduino and 3D printed components. It is very easy to build and beginners who are interested can give it a try.
Materials List
Arduino Nano x 1
PLA material x several
LED light strip (WS2812 60led/m) x several
12.7mm x 5mm Magnet x 2
5mm x 3mm magnet x 2
Magnetic switch x 1
5v plug x 1
5v power adapter x 1
Silicone wire x several
Electric soldering iron x 1
Glue x 1
3D Printer x 1
Screwdriver x 1
3D Printed Parts
General Part Printing Settings
Fill 20-100%, no support required.
LED bracket setup
Fill 100%, 100% fill can make the light have better diffusion!
The 3D printable files can be downloaded in this project’s file library:
https://make.quwj.com/project/427
Making LED lights
There are three wires that need to be run from the LED to the base of the light. This is the hardest part of the whole process.
1. Cut three wires of 130mm in length (you can reserve some extra to prevent the length from being insufficient) and cut an LED light strip of appropriate length.
2. Solder all the wires to the LED strip. Mark the ends of the wires so that you don’t get them mixed up when you connect them to the Arduino.
3. Install all the wires into the small holes in the lamp housing.
4. Glue the LED light strip and put it into the main body of the lamp housing. You can braid the wires to make it look more beautiful.
5. Place a magnet on the upper part of the body.
Prepare the power supply
The power supply can be a battery or a power bank. As shown in the picture, I chose to charge with a USB plug.
1. Stick the power jack connector to the round hole at the bottom of the lamp.
2. Connect the red and black wires to the connector and lead them out. They will be soldered to the Arduino.
Making a magnetic switch (optional)
This step is optional. You can choose to just unplug it and just put a magnet on the base.
1. Use pliers to remove the white part from the magnetic switch.
2. Solder three wires on SIG, VCC and GND.
3. Glue the magnet to the round side of the magnet/switch base and slide the switch into place. Note that we need to test that the switch is not triggered by the small magnet. If it is triggered, the system will not work, and we will test this later in the programming step.
4. Place the magnet/switch base in the appropriate position at the bottom of the lamp. When the lamp is placed on the lamp holder, it is expected that the normal lamp will turn off. We can test this by placing the LED strip with magnets on the other side of the lamp holder.
Soldering the Arduino
1. Connect two wires to VIN and GND of the power socket respectively.
2. Solder the wires of the LED strip to GND, V5 and a digital port (D1-D12).
3. Solder the magnetic switch wires to GND, V5 and a digital port.
programming
This step is very simple. If the components used are the same as in the article, the code files can be downloaded in this project’s file library:
https://make.quwj.com/project/427
1. Download Arduino IDE.
2. Install the FastLed library (depending on the LED you use):
https://www.arduino.cc/reference/en/libraries/fastled/
3. Magnetic switch code:
https://wiki.seeedstudio.com/Grove-Magnetic_Switch/
4. Run the code.
5. Check whether the magnetic switch is triggered. Adjust it accordingly by sliding it backward or forward.
Now, the whole project is completed, and this warm and lovely magnetic levitation lamp is completed!
The code used in the project can be downloaded from the project file library:
https://make.quwj.com/project/427
via instructables.com/Magnetic-Levitating-Lamp/