ARDUINO EDGE LIT LAMP
About This Project:
In this project I will go over how to code a Arduino Micro Pro for an Edge Lit Acrylic Lamp. The lamp will have 16 LEDs and is controlled by a Potentiometer to change colors (RGB), and set different random lighting effects. To cut the acrylic and the wood for the base I used a Sainsmart PROVer 3018. For feeds and speeds on the bits, please see down below. I used a Spring Loaded Drag Bit to do the detail work, such as the Text and the outline of DS9. Which is most likely one of the Best Star Treks. Lets see how much heat I take for that comment. To cut the acrylic and wood out of its blank, I used a 3mm End Mill. For the detail work on the Base I used a 30 degree 0.1mm V-Bit. All the parts I used I got off of Amazon. For coding you will need Arduino IDE software. I traced this out in Illustrator then saved it as an SVG. Then loaded the SVG into Carbide Create Pro to generate my g-code. Total cutting time was around 5-6 hours. I will be working on a 3D printed part to house and hold the Arduino Micro Pro. If you have any questions you can message me on my YouTube Channel page, or any of my social media pages, or you can shot me an email.
Video Guide:
MATERIALS:
These are affiliate links and add no cost to you.
Speeds & Feeds:
DETAIL ACRYLIC:
BIT: 90 Degree Spring Loaded Drag Mill
SPINDLE: Turned Off
DEPTH PER PASS: 0.05 - 0.15mm
FEED RATE: 250mm
PLUNGE: 75-125mm
EXTRA PRESSURE APPLIED TO Z: 0.3 - 0.5mm
DETAIL WOOD:
BIT: 30 Degree 0.1mm V-Bit
SPINDLE: 9,000rpm
DEPTH PER PASS: 0.15mm
FEED RATE: 450mm
PLUNGE RATE: 250mm
CUT ACRYLIC & WOOD:
BIT: 3mm End Mill
SPINDLE: 9,000rpm
DEPTH PER PASS: 0.15mm
FEED RATE WOOD: 450mm
FEED RATE ACRYLIC: 225mm
PLUNGE RATE WOOD: 250mm
PLUNGE RATE ACRYLIC: 75mm
IDE Code:
#include <Adafruit_NeoPixel.h>
#define PIN 7 //WHAT PIN THE LED IS CONNECTED TO
#define NUMPIXELS 16 //NUMBER OF LED LIGHTS
#define POT A9 //WHAT PIN THE POT IS CONNECTED TO
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
int lastr = 100; //SET The Last Red
int lastb = 100; //SET The Last Blue
int lastg = 100; //SET The Last Green
int ranTime = 25; //SET RANDOM TIME - This will change depending on POT Pull
int delayval = 25; // delay for half a second
int fastDelay = 10; //Fast Delay time
int randFactor = 222; //Random Delay
int randPixOn = 1; // Random Chose a LED
int randOnOff = 0; //Random On Off
void setup() {
// initialize serial communication at 9600 bits per second:
pixels.begin();
Serial.begin(9600);
}
// MAIN LOOP
void loop() {
// read the input on analog pin A9:
int potValue = analogRead(POT);
// print out the value you read:
//Serial.println(potValue);
if (potValue == 0){
ledSTOP(); //TURNS OFF ALL LEDS
}
if ((potValue >= 1) && (potValue <= 255)){
lastr = potValue; //SETTING THE LED VALUE FOR RED
lastg = 0;
lastb = 0;
redLED();
}
if ((potValue >= 256) && (potValue <= 510)){
lastr = 0;
lastg = potValue; //SETTING THE LED VALUE FOR GREEN
lastb = 0;
greenLED();
}
if ((potValue >= 511) && (potValue <= 765)){
lastr = 0;
lastg = 0;
lastb = potValue; //SETTING THE LED VALUE FOR BLUE
blueLED();
}
if ((potValue >=766) && (potValue <= 868)){
lastr = 0;
lastg = 0;
lastb = 0;
randLED();
}
if ((potValue >=869) && (potValue <=1032)){
//ledSTOP();
lastr = 0;
lastg = 0;
lastb = 0;
randPIX();
}
delay(fastDelay); // delay in between reads for stability
}
////////////////////SUB LOOPS
////////////////////STOP LEDs
void ledSTOP(){
for(int i = 0; i < NUMPIXELS; i++){
pixels.setPixelColor(i, pixels.Color(0,0,0));
pixels.show();
delay(delayval);
}
}
//////////////////////////// SINGLE COLOR LED
void redLED(){
for(int i = 0; i < NUMPIXELS; i++){
pixels.setPixelColor(i, pixels.Color(lastr,0,0));
pixels.show();
delay(fastDelay);
}
}
void greenLED(){
for (int i = 0; i < NUMPIXELS; i++){
lastg = (lastg-255); //MAKE THE VALUE BETWEEN 1 & 255
pixels.setPixelColor(i, pixels.Color(0,lastg,0));
pixels.show();
delay(fastDelay);
}
}
void blueLED(){
for(int i = 0; i < NUMPIXELS; i++){
lastb = (lastb -510); //MAKE THE VALUE BETWEEN 1 & 255
pixels.setPixelColor(i, pixels.Color(0,0,lastb));
pixels.show();
delay(fastDelay);
}
}
///////////////////////RAND COLOR FOR ALL LEDS
void randLED(){
for(int i = 0; i < NUMPIXELS; i++){
randColorA();
pixels.setPixelColor(i, pixels.Color(lastr,lastg,lastb));
pixels.show();
int potValue = analogRead(POT);
ranTime = (potValue/randFactor);
delay(ranTime);
}
}
void randColorA(){
int potValue = analogRead(POT);
int g = random(7,32);
int r = random(7,32);
int b = random(7,32);
ranTime = random(15,115);
lastr = ((potValue*2)/r);
lastg = ((potValue*2)/g);
lastb = ((potValue*2)/b);
}
//////////////////////////// RAND PIXEL COLOR
void randPIX(){
randPixOn = random(1,16);
ranOF();
if (randOnOff == 0){
lastr = 0;
lastg = 0;
lastb = 0;
pixels.setPixelColor(randPixOn, pixels.Color(lastr,lastg,lastb));
pixels.show();
ranTime = random(20,225);
}
if (randOnOff == 1){
ranColorB();
pixels.setPixelColor(randPixOn, pixels.Color(lastr,lastg,lastb));
pixels.show();
}
delay(ranTime);
}
void ranOF(){
randOnOff = random(0,2);
Serial.println(randOnOff);
}
void ranColorB(){
int potValue = analogRead(POT);
int g = random(9,80);
int r = random(9,80);
int b = random(9,80);
ranTime = random(15,70);
ranTime = (potValue/randFactor);
lastr = ((potValue*2)/r);
lastg = ((potValue*2)/g);
lastb = ((potValue*2)/b);
}