当前位置:网站首页>Magnetic levitation 3D lamp
Magnetic levitation 3D lamp
2022-06-30 10:02:00 【acktomas】
Magnetic levitation lamp

brief introduction : Magnetic levitation lamp
About : I'm a designer , be known as TomoDesigns. I'm a designer , Like to make interesting and interesting 3dprintable object . Check out my social networking site for more content and Design More about TomoDesigns »
magical Arduino Magnetic levitation lamp driven . Perfect for beginners 3DPrintalble project .
goods

material :
3D Model :Cults3D
LED (WS2812 60led/m):
Magnet diameter :12.7 Mm height :5 mm x2
Little magnet :( Neodymium magnet 5mm x 3mm)
Magnetic switch ( Or reed switch ):https /wiki.seeedstudio.com/Grove-Magnetic_Switch/
Arduino Nano One
5v The plug
5V Do not plug
Silicon wire
The first 1 Step :3D Print all parts


For this lamp , You need to print 7/8 Parts . You can find these parts here .
General print settings :
- fill 20-100%
- No support
LED Lamp holder setting :
- fill 100%
Why 100%? Because you want to diffuse the light well !
Add tips to ask questions and comments to download
The first 2 Step : Make LED Diffused lamp holder






You will need 3 Wires from LED Connect to the base of the lamp . This is the hardest part of the whole build .
Get ready / material :
- Cut it off 3 The root length is 130 Mm wire ( You have some room for trial and error )
- Cut a piece suitable for the diffuser LED Lamp with .
- Get your soldering iron
- Get the diffuser , Diffusion top and LED clip .
Pace :
- First, connect all wires ** Weld to LED On the light bar .** I use only white lines for the look of ecstasy . Make sure to mark the wire at the end , So when you connect them to Arduino when , You won't be confused .
- Pull the wire all the way Through a small hole in the diffuser .
- stay LED Stick some glue on the inside of the light bar , And then Its ( Use tweezers ) Put it inside the diffuser . If your LED Don't want to stay on a small piece inside the diffuser , Please put LED The clamp is connected to LED middle .
- weaving Wires for a beautiful look .
- Place the magnet on top of the diffuser .
Add tips to ask questions and comments to download
The first 3 Step : Prepare the power input

You can also choose to use the battery 、 Move the power supply or something else to do this . This is what I found best for me .
Get ready / material :
- hot glue / seccotine
- Female power socket connector
- Lamp bottom surface
- Red and black cables
Pace :
- Stick the power socket connector to the opening on the bottom of the lamp .
- We need to be in Arduino Cables used in the welding procedure .
Add tips to ask questions and comments to download
The first 4 Step : Making magnetic switches


This is optional . This is the function that turns off when you connect it to the lamp holder . You can also choose to just unplug it , Just put a magnet on the base . Depending on the availability of the part ;)
Get ready / material :
- Magnetic switch
- Little magnet
- 3 Line
- Magnets / Switch base
- Soldering iron
- clamp
Pace :
- Remove the white part from the magnetic switch with pliers .
- stay SIG、VCC and GND Upper welding 3 A wire .
- In the magnet / The round side of the switch base is glued with a strong adhesive , Then slide the switch into place . Please note that , We need to test whether the switch is not triggered by a small magnet . Because if it is triggered , The system will not work ! We will be in Programming steps Test this in .
- Put the magnet / Place the switch base at the desired position on the bottom surface of the lamp , When placed on the lamp holder , You want to turn off the light . By putting what you have already made LED Put the piece and the magnet in Lampholder Test on the other side of the .
The first 5 Step : stay Arduino Upper welding


Get ready / material :
- Soldering iron ( And accessories )
- Part of the previous steps
- Aduno
Pace :
- take 2 A cable is connected from the power jack to VIN and GND.
- take Ledstrip Wire welded to GND、V5 And digital ports (D1-D12).
- Weld the magnetic switch wire to GND、V5 And digital ports .
Add tips to ask questions and comments to download
The first 6 Step : Yes Arduino Programming
This is an easy step . Do you use the same components as me ?
Get ready / material :
- Computer
- Aduno
- miniature USB Line
Pace :
- download arduino IDE
- install FastLed library ( It depends on what you use LED)(Fastled)
- Magnetic switch Code Overview
- take Fastled Code combined with magnetic switch code
- See if your magnetic switch is triggered . Adjust him accordingly by sliding backwards or forwards .
Sample code
#include "FastLED.h"
#define DATA_PIN 3
#define LED_TYPE WS2812B
#define COLOR_ORDER GRB
#define NUM_LEDS 4
#define BRIGHTNESS 255
#define BRIGHTLOW 3
#define BRIGHTHIGH 255
#define INTERFADE 100
#define MAGNECTIC_SWITCH 5
volatile byte state = 0;
// byte state = LOW;
CRGB leds[NUM_LEDS];
void setup() {
delay(1500); // initial delay of a few seconds is recommended
pinMode(DATA_PIN, OUTPUT);
pinMode(LED_BUILTIN, OUTPUT);
pinMode(MAGNECTIC_SWITCH, INPUT);
FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip); // initializes LED strip
FastLED.setBrightness(BRIGHTNESS);// global brightness
showProgramCleanUp(2500); // clean up
// digitalWrite(LED_BUILTIN, HIGH);
}
/*If the magnetic switch is near the magnet, it will return true, */
/*otherwise it will return false */
boolean isNearMagnet()
{
int sensorValue = digitalRead(MAGNECTIC_SWITCH);
if (sensorValue == HIGH) //if the sensor value is HIGH?
{
digitalWrite(LED_BUILTIN, HIGH);
CleanUp();
return true;//yes,return true
}
else
{
digitalWrite(LED_BUILTIN, LOW);
return false;//no,return false
}
}
// switches off all LEDs for "delaytime" time
void showProgramCleanUp(long delayTime) {
for (int i = 0; i < NUM_LEDS; ++i) {
leds[i] = CRGB::Black;
}
FastLED.show();
delay(delayTime);
}
// switches off all LEDs for reset
void CleanUp() {
for (int i = 0; i < NUM_LEDS; ++i) {
leds[i] = CRGB::Black;
}
FastLED.show();
}
void showProgramAllWhite(long delayTime) {
for (int i = 0; i < NUM_LEDS; ++i) {
// leds[i] = CRGB::White;
// CRGB newPixel = CHSV(120, 120, 120);
leds[i].setRGB(125, 255, 255);
}
FastLED.show();
delay(delayTime);
}
void showProgramAllRed(long delayTime) {
for (int i = 0; i < NUM_LEDS; ++i) {
// leds[i] = CRGB::White;
// CRGB newPixel = CHSV(120, 120, 120);
leds[i].setRGB(255, 0, 0);
}
FastLED.show();
delay(delayTime);
}
void showProgramAllBlue(long delayTime) {
for (int i = 0; i < NUM_LEDS; ++i) {
// leds[i] = CRGB::White;
// CRGB newPixel = CHSV(120, 120, 120);
leds[i].setRGB(0, 0, 255);
}
FastLED.show();
delay(delayTime);
}
// main program
void loop() {
// Départ blanc - fadeout
for (int i = BRIGHTHIGH; i > BRIGHTLOW; i = --i) {
if (!isNearMagnet()) {
if (i == BRIGHTHIGH) {
showProgramAllWhite(500);
}
else {
showProgramAllWhite(3);
}
FastLED.setBrightness(i);
delay(INTERFADE);
} else {
return;
}
}
// fadein vers le Bleue
for (int i = BRIGHTLOW; i < BRIGHTHIGH; i = ++i) {
if (!isNearMagnet()) {
showProgramAllBlue(3);
FastLED.setBrightness(i);
delay(INTERFADE);
}
else {
return;
}
}
// Fadeout du bleue
for (int i = BRIGHTHIGH; i > BRIGHTLOW; i = --i) {
if (!isNearMagnet()) {
if (i == BRIGHTHIGH) {
showProgramAllBlue(500);
}
else {
showProgramAllBlue(3);
}
FastLED.setBrightness(i);
delay(INTERFADE);
} else {
return;
}
}
// FadeIN vers le blanc
for (int i = BRIGHTLOW; i < BRIGHTHIGH; i = ++i) {
if (!isNearMagnet()) {
showProgramAllWhite(3);
FastLED.setBrightness(i);
delay(INTERFADE);
} else {
return;
}
}
// Fadeout du blanc
for (int i = BRIGHTHIGH; i > BRIGHTLOW; i = --i) {
if (!isNearMagnet()) {
if (i == BRIGHTHIGH) {
showProgramAllWhite(500);
}
else {
showProgramAllWhite(3);
}
FastLED.setBrightness(i);
delay(INTERFADE);
} else {
return;
}
}
// FadeIN vers le Rouge
for (int i = BRIGHTLOW; i < BRIGHTHIGH; i = ++i) {
if (!isNearMagnet()) {
showProgramAllRed(3);
FastLED.setBrightness(i);
delay(INTERFADE);
} else {
return;
}
}
// Fadeout du rouge
for (int i = BRIGHTHIGH; i > BRIGHTLOW; i = --i) {
if (!isNearMagnet()) {
if (i == BRIGHTHIGH) {
showProgramAllRed(500);
}
else {
showProgramAllRed(3);
}
FastLED.setBrightness(i);
delay(INTERFADE);
} else {
return;
}
}
// fadein vers le Blanc
for (int i = BRIGHTLOW; i < BRIGHTHIGH; i = ++i) {
if (!isNearMagnet()) {
showProgramAllWhite(3);
FastLED.setBrightness(i);
delay(INTERFADE);
} else {
return;
}
}
}
边栏推荐
- 7.手机登陆功能开发
- G 代码解释|最重要的 G 代码命令列表
- Xlnet (generalized autorefressive trainingfor language understanding) paper notes
- Redis + MySQL implements the like function
- Installing Oracle database process in windows2007 on VM
- UAV project tracking record 83 -- PCB diagram completion
- IDC released the report on China's software defined storage and hyper convergence market in the fourth quarter of 2020, and smartx hyper convergence software ranked first in the financial industry
- Oracle cross database replication data table dblink
- 磁悬浮3D灯
- 11.自定义hooks
猜你喜欢
随机推荐
Shell script functions
2021-07-26
The present situation and challenge of the infrastructure of Yiwen parsing database
NTP of Prometheus monitoring_ exporter
log4j
Based on svelte3 X desktop UI component library svelte UI
Pytorch graduate warm LR installation
1. Basic configuration
C语言实现扫雷游戏,附详解及完整代码
Redis + MySQL implements the like function
Redis docker master-slave mode and sentinel
Brève description du collecteur d'ordures G1
UAV project tracking record 83 -- PCB diagram completion
Redis docker master-slave mode and sentinel
【JVM】G1垃圾回收器简述
Plan the IT technology route for the new year? Let's learn about Gartner infrastructure hype cycle
Installation and use
近期学习遇到的比较问题
Thrift easy to use
utils session&rpc








![[JVM] brief introduction to CMS](/img/4e/df4a193eed39438f808059f67f19a1.png)
