commit 75fcc3a492d66dd45e94a5384e7d451775803d87 Author: Jonas_Jones Date: Thu Nov 7 23:42:54 2024 +0100 added files diff --git a/3d-files/Block Base.stl b/3d-files/Block Base.stl new file mode 100644 index 0000000..3b93e05 Binary files /dev/null and b/3d-files/Block Base.stl differ diff --git a/3d-files/Block Side.stl b/3d-files/Block Side.stl new file mode 100644 index 0000000..d6c89aa Binary files /dev/null and b/3d-files/Block Side.stl differ diff --git a/3d-files/Block Top.stl b/3d-files/Block Top.stl new file mode 100644 index 0000000..401facd Binary files /dev/null and b/3d-files/Block Top.stl differ diff --git a/3d-files/Handle Base Bottom.stl b/3d-files/Handle Base Bottom.stl new file mode 100644 index 0000000..1dbf087 Binary files /dev/null and b/3d-files/Handle Base Bottom.stl differ diff --git a/3d-files/Handle Base.stl b/3d-files/Handle Base.stl new file mode 100644 index 0000000..9069b20 Binary files /dev/null and b/3d-files/Handle Base.stl differ diff --git a/3d-files/Handle Ring Bottom.stl b/3d-files/Handle Ring Bottom.stl new file mode 100644 index 0000000..6f6ede4 Binary files /dev/null and b/3d-files/Handle Ring Bottom.stl differ diff --git a/3d-files/Handle Ring Top.stl b/3d-files/Handle Ring Top.stl new file mode 100644 index 0000000..c4b5d56 Binary files /dev/null and b/3d-files/Handle Ring Top.stl differ diff --git a/3d-files/Neo_City.stl b/3d-files/Neo_City.stl new file mode 100644 index 0000000..cef7d64 Binary files /dev/null and b/3d-files/Neo_City.stl differ diff --git a/3d-files/Power Button.stl b/3d-files/Power Button.stl new file mode 100644 index 0000000..95b158d Binary files /dev/null and b/3d-files/Power Button.stl differ diff --git a/3d-files/assembly_complete.stl b/3d-files/assembly_complete.stl new file mode 100644 index 0000000..b6b4cfb Binary files /dev/null and b/3d-files/assembly_complete.stl differ diff --git a/3d-files/shiny_c.stl b/3d-files/shiny_c.stl new file mode 100644 index 0000000..9971d49 Binary files /dev/null and b/3d-files/shiny_c.stl differ diff --git a/3d-files/shiny_c_thick.stl b/3d-files/shiny_c_thick.stl new file mode 100644 index 0000000..56b3010 Binary files /dev/null and b/3d-files/shiny_c_thick.stl differ diff --git a/3d-files/shiny_n.stl b/3d-files/shiny_n.stl new file mode 100644 index 0000000..0d41297 Binary files /dev/null and b/3d-files/shiny_n.stl differ diff --git a/3d-files/shiny_n_thick.stl b/3d-files/shiny_n_thick.stl new file mode 100644 index 0000000..59840dc Binary files /dev/null and b/3d-files/shiny_n_thick.stl differ diff --git a/3d-files/shiny_t.stl b/3d-files/shiny_t.stl new file mode 100644 index 0000000..394ae99 Binary files /dev/null and b/3d-files/shiny_t.stl differ diff --git a/3d-files/shiny_t_thick.stl b/3d-files/shiny_t_thick.stl new file mode 100644 index 0000000..dfa34e7 Binary files /dev/null and b/3d-files/shiny_t_thick.stl differ diff --git a/README.md b/README.md new file mode 100644 index 0000000..6ea9339 --- /dev/null +++ b/README.md @@ -0,0 +1,68 @@ +# K-Pop Lightstick +This Repo features the software of an Arduino Lightstick as well as the 3D Files for a custom **NCT DREAM** Lightstick + +![Alt text](/pictures/lightstick_top3d.png) + +## 3D-Print +The Lightstick was printed in 3 different colors. + +The `Block Top.stl` file can be modified to not come with holes for the `Neo_City.stl` cubes rising out of the top to match the official lightstick more accurately. + +*Be aware, that this 3D Build is slightly larger than the Official NCT DREAM Lightstick and you may not be allowed into concerts with it. I had no issues at the NCT DREAM Tour 2024 in Rotterdam but the security checks at the entrance were cursory, lacking the thoroughness you would usually have at different concerts.* + +**WHITE:** +- `Block Base.stl` +- `Block Side.stl` +- `Block Top.stl` +- `Handle Base Bottom.stl` +- `Handle Base.stl` + +**BLACK:** +- `Handle Ring Bottom` +- `Handle Ring Top` +- `Power Button` + +**TRANSPARENT NEON GREEN:** +- `Neo_City.stl` +- `shiny_c_thicker.stl` +- `shiny_c.stl` +- `shiny_n_thicker.stl` +- `shiny_n.stl` +- `shiny_t_thicker.stl` +- `shiny_t.stl` + +## Assembly +The Assembly of the Prints is pretty self-explanatory. Take a look at the pictures in the `/picture` folder of the repo. + +I chose to not glue the `Block Base.stl` and the `Handle Base.stl` pieces together to be able to troubleshoot/replace the electronics inside at any time. + +## Electronics +The `arduino.ino` file contains the Arduino code I used for the lightstick. + +An **Arduino Nano** was used with the following Pin-Out: +```cpp +const int buttonPin = 2; // Pin for the button +const int redPin = 11; // Pin for the red channel of RGB LED +const int greenPin = 10; // Pin for the green channel of RGB LED +const int bluePin = 9; // Pin for the blue channel of RGB LED +const int motorPin = 8; // Pin to control the motor +``` +*Note: These are the Digital Pins on the Arduino Nano* + +### Features of the Program +- The `buttonPin` is for the Power Button on the `Handle Base.stl` and is used for controlling the Light. +- The `redPin`, `greenPin` and `bluePin` are used for controlling the LED. IMPORTANT: These are **ANODE RGB LEDs**. If You plan on using *Kathode LEDs*, simply remove `255 - ` from the `setRGB` function at the bottom of the Program, to invert the values. (This is only a fix based on logic, I have no LEDs to test it) +- The `motorPin` is used for controlling a simple Vibration Motor that runs for 1 second when turning on the Lightstick. This is inspired from the *VIXX Official Lightstick* that has similar behaviour. It is completely irrelevant to the general functionality of the Lightstick which is, well, to have Light. + +### Instructions +1. Connect a Power button to the Arduino `buttonPin` and groud +2. Connect the Vibration Motor (A simple motor with some weight glued of axis to make it vibrate when rotating) to the `motorPin` and ground +3. Connect the RGB LEDs to the 3 color pins and 3.3V +4. Glue together 3 AAA Batteries, solder them together and connect them to the Voltage In` and ground +5. Flash the Arduino Nano with the program and you're done. +6. Insert the electronics into the Arduino and close it up. + +## Usage +Hold the Power Button for approx. 1 second and release it. The Lightstick should vibrate for a second and then the lights turn on, defaulting to a neon green. + +Press the button to cycle between colors and hold it for a second to turn it off again. diff --git a/arduino.ino b/arduino.ino new file mode 100644 index 0000000..4006d3d --- /dev/null +++ b/arduino.ino @@ -0,0 +1,90 @@ +const int buttonPin = 2; // Pin for the button +const int redPin = 11; // Pin for the red channel of RGB LED +const int greenPin = 10; // Pin for the green channel of RGB LED +const int bluePin = 9; // Pin for the blue channel of RGB LED +const int motorPin = 8; // Pin to control the motor + +bool ledState = false; // State of the onboard LED +unsigned long buttonPressStartTime = 0; // Time when the button press starts +bool buttonPressed = false; // Current button pressed state +unsigned long lastButtonPress = 0; // Last time the button was pressed +int colorIndex = 0; // Index for cycling colors + +// Define colors to cycle through (RGB format) +const int colors[][3] = { + {127,255,0}, // Neon Green + {255, 0, 0}, // Red + {0, 255, 0}, // Green + {0, 0, 255}, // Blue + {255, 255, 0}, // Yellow + {0, 255, 255}, // Cyan + {255, 0, 255} // Magenta +}; +const int numColors = sizeof(colors) / sizeof(colors[0]); + +void setup() { + pinMode(buttonPin, INPUT_PULLUP); // Set the button pin as input with pull-up resistor + pinMode(ledPin, OUTPUT); // Set the LED pin as output + pinMode(redPin, OUTPUT); // Set the red pin as output + pinMode(greenPin, OUTPUT); // Set the green pin as output + pinMode(bluePin, OUTPUT); // Set the blue pin as output + pinMode(motorPin, OUTPUT); // Set the motor control pin as output + + // Initialize RGB LED to off and motor off + setRGB(0, 0, 0); + digitalWrite(motorPin, LOW); // Ensure motor is off + + pinMode(LED_BUILTIN, OUTPUT); // Set the onboard LED pin as an output + digitalWrite(LED_BUILTIN, LOW); // Turn the LED off +} + +void loop() { + // Read the button state + bool currentButtonState = digitalRead(buttonPin) == LOW; + + if (currentButtonState && !buttonPressed) { + // Button just pressed + buttonPressed = true; + buttonPressStartTime = millis(); // Record the time of the button press + } else if (!currentButtonState && buttonPressed) { + // Button just released + buttonPressed = false; + + // Check duration of button press + unsigned long pressDuration = millis() - buttonPressStartTime; + + if (pressDuration >= 500) { + // Long press: Toggle onboard LED and motor + ledState = !ledState; + digitalWrite(ledPin, ledState ? HIGH : LOW); + + if (ledState) { + // Turn motor on + digitalWrite(motorPin, HIGH); + delay(1000); // Keep motor on for 1 second + digitalWrite(motorPin, LOW); // Turn motor off + setRGB(0, 255, 0); // Start with green + colorIndex = 0; // Reset color index + } else { + // Turn off RGB LED + setRGB(0, 0, 0); + } + } else { + // Short press: Cycle colors + if (ledState) { + colorIndex = (colorIndex + 1) % numColors; // Cycle through colors + setRGB(colors[colorIndex][0], colors[colorIndex][1], colors[colorIndex][2]); + } + } + + // Wait until the button is released before proceeding + while (digitalRead(buttonPin) == LOW); + } +} + +// Function to set RGB LED color +void setRGB(int red, int green, int blue) { + analogWrite(redPin, 255 - red); + analogWrite(greenPin, 255 - green); + analogWrite(bluePin, 255 - blue); +} \ No newline at end of file diff --git a/pictures/lightstick_bottom.png b/pictures/lightstick_bottom.png new file mode 100644 index 0000000..4063629 Binary files /dev/null and b/pictures/lightstick_bottom.png differ diff --git a/pictures/lightstick_cube.png b/pictures/lightstick_cube.png new file mode 100644 index 0000000..b613a2b Binary files /dev/null and b/pictures/lightstick_cube.png differ diff --git a/pictures/lightstick_diagonal.png b/pictures/lightstick_diagonal.png new file mode 100644 index 0000000..185180c Binary files /dev/null and b/pictures/lightstick_diagonal.png differ diff --git a/pictures/lightstick_top.png b/pictures/lightstick_top.png new file mode 100644 index 0000000..081d1fe Binary files /dev/null and b/pictures/lightstick_top.png differ diff --git a/pictures/lightstick_top3d.png b/pictures/lightstick_top3d.png new file mode 100644 index 0000000..51abf10 Binary files /dev/null and b/pictures/lightstick_top3d.png differ