当前位置:网站首页>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;
}
}
}
边栏推荐
- [Ubuntu redis installation]
- Abstract classes and interfaces
- utils 协程
- Read the difference and connection between hyperfusion and private cloud
- MySQL index and data storage structure foundation
- 浏览器复制的网址粘贴到文档是超链接
- oracle跨数据库复制数据表-dblink
- Plan the IT technology route for the new year? Let's learn about Gartner infrastructure hype cycle
- 正则表达式基础
- 文章内容无法复制复制不了
猜你喜欢

二极管如何工作?

MySQL explain

抽象类和接口

Shenhe thermomagnetic: Super fusion dual active cluster solution for MES system
![[JVM] G1 garbage collector](/img/fc/ea1f8cee0f207e4a5c804f88f2871c.png)
[JVM] G1 garbage collector

GPT (improving language understanding generative pre training) paper notes

布隆过滤器

文章内容无法复制复制不了

【JVM】G1垃圾回收器簡述

Read the difference and connection between hyperfusion and private cloud
随机推荐
[JVM] G1 garbage collector
【JVM】CMS简述
Golang magic code
utlis 内存池 对象池
utils session&rpc
二极管如何工作?
G 代码解释|最重要的 G 代码命令列表
Critical applications and hyper converged infrastructure: the time has come
11. customize hooks
布隆过滤器
LVS load balancing
NTP of Prometheus monitoring_ exporter
Pytorch graduate warm LR installation
Datatabletomodellist entity class
Flume learning 1
Slf4j: failed to load class "org.slf4j.impl.staticloggerbinder"
机器学习笔记 九:预测模型优化(防止欠拟合和过拟合问题发生)
Configuring MySQL for error reporting
Plan the IT technology route for the new year? Let's learn about Gartner infrastructure hype cycle
11.自定义hooks