To learn embedded systems, follow @I want to learn embedded systems,the station for embedded enthusiasts.
01
This is a 3D printing project suitable for beginners.
02
2.1 Materials
-
3D model (see attachment at the end) -
PLA material -
LED light (WS2812 60led/m) -
Magnet diameter (12.7mm) height (5mm) x 2 -
Small magnet (5mm x 3mm) -
Magnetic switch (or reed switch) -
Arduino Nano -
5v plug and power adapter -
Silicone wire (the softer, the better)
2.2 Tools
-
Soldering iron -
Glue -
3D printer -
Screwdriver
03
Step 1: Prepare 3D Printed Parts
The 3D printing files for the lamp can be found at the end.
General printing settings:
-
Fill 20-100% -
No support needed
LED bracket settings:
-
Fill 100%
Why 100%? Because it allows the light to diffuse better!
Step 2: Make the LED Light
We need 3 wires from the LED to the lamp base.
This step is the most difficult part of the entire process.
Preparation/Materials
-
Cut 3 wires, each 130mm long (leave some extra for trial and error) -
Cut an appropriately sized LED strip.
Steps
First, solder all wires to the LED strip.
It’s best to mark the ends of the wires so that we won’t confuse them when connecting to the Arduino.
Feed all wires through the small hole in the lamp casing.
Apply some glue to the LED strip and place it (with tweezers) inside the lamp casing (Diffusion body).
Braid the wires together for a more aesthetic look.
Place a magnet on the printed part “Diffusion Top”.
It should look like this when finished.
Step 3: Prepare the Power Supply
You can also choose to use batteries or a power bank.
Preparation/Materials
-
Hot melt glue -
Power socket connector (female) -
3D printed part (Lamp Underside) -
Red and black wires
Steps
1. Glue the power socket connector to the opening of the lamp base;
2. Connect the red and black wires to the connector, which we will solder to the Arduino later.
Step 4: Make the Magnetic Switch
This step is optional. You can also choose to simply unplug the connector and place a magnet on the base, depending on the availability of the parts.
Preparation/Materials
-
Magnetic switch -
Small magnet -
3 wires -
Magnet/switch base -
Soldering iron -
Pliers
Steps
-
Use pliers to remove the white part from the magnetic switch. -
Solder 3 wires to SIG, VCC, and GND. -
Glue the magnet to the round side of the magnet/switch base and slide the switch into place. (Note, 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 in the programming step.)
Place the magnet/switch base in a suitable position on the bottom of the lamp, so that when we place the lamp on the base, we want the lamp to turn off. Test this by placing the LED lamp strip with the magnet on the other side of the base.
Step 5: Solder the Arduino
Preparation/Materials
-
Soldering iron -
Parts from the previous steps -
Arduino Nano
Steps
1. Connect 2 wires to our VIN and GND of the power socket;
2. Solder the LED strip wires to GND, V5, and a digital port (D1-D12);
3. Solder the magnetic switch wires to GND, V5, and a digital port.
Step 6: Programming
This step is very simple. If you are using the same components as mentioned in the article, you can refer to the code below.
Preparation/Materials
-
Computer -
Arduino -
Micro USB cable
Steps
1. Download Arduino IDE;
2. Install FastLed[1] library (depending on the LED you are using);
3. Magnetic switch code[2];
4. Run the code;
5. Check if our magnetic switch is triggered. Adjust accordingly by sliding it back or forth.
Alright, the project is complete! A magnetic levitating lamp full of artistic sense is done!
▼ View the video demonstration
04
The relevant 3D printing files mentioned in the article can be downloaded from the following site:
https://www.instructables.com/Magnetic-Levitating-Lamp/
You can also directly click to read the original text to jump
References
FastLed: https://www.arduino.cc/reference/en/libraries/fastled/
[2]
Code: https://wiki.seeedstudio.com/Grove-Magnetic_Switch/
-END-
Linux commands, is it useless to learn? Yes!
Garbage, do I still need to write assembly for microcontroller programming?
There are actually universities that teach C language in the first year?
At 30 years old, should I still go for a master’s degree?
I am Zhang Qiaolong, a university teacher teaching electronics, welcome to follow!
Leave a Comment
Your email address will not be published. Required fields are marked *