The Spanner
Published © MIT

DIY 3D-Printed Spiral Lamp

A 3D-printed spiral lamp that uses smooth rotation and RGB LEDs to create a dynamic optical illusion through motion and light.

BeginnerFull instructions provided1 hour138
DIY 3D-Printed Spiral Lamp

Things used in this project

Hardware components

FireBeetle 2 ESP32 C6 IoT Development Board
DFRobot FireBeetle 2 ESP32 C6 IoT Development Board
×1
N20 Gear Motor (6V)
×1
MAX1508 Motor Driver
×1
WS2812B Digital RGB LED Flexi-Strip 144 LED - 1 Meter
Seeed Studio WS2812B Digital RGB LED Flexi-Strip 144 LED - 1 Meter
×1
DC 5525 Female Jack
×1

Software apps and online services

Fusion
Autodesk Fusion
Arduino IDE
Arduino IDE
JLCPCB 3D Printing

Hand tools and fabrication machines

Soldring Iron
Extraction Tool, 6 Piece Screw Extractor & Screwdriver Set
Extraction Tool, 6 Piece Screw Extractor & Screwdriver Set

Story

Read more

Custom parts and enclosures

3D Parts 01

Sketchfab still processing.

3D Parts 02

Sketchfab still processing.

3D Parts 03

Sketchfab still processing.

3D Parts 04

Sketchfab still processing.

3D Parts 05

Sketchfab still processing.

Schematics

Connection

Code

Code

C/C++
#include <Adafruit_NeoPixel.h>

// Pin definitions based on your connections
#define MOTOR_IN1 7  // GPIO7 (D11/LP_SCL/MTDO)
#define MOTOR_IN2 6  // GPIO6 (D12/ADC1_6/MTCK)
#define LED_PIN   8  // GPIO8 (D2)

// Motor speed settings (0-255)
#define MOTOR_SPEED 130  // Normal speed

// LED strip configuration
#define NUM_LEDS 30  // Adjust based on your LED strip
Adafruit_NeoPixel strip(NUM_LEDS, LED_PIN, NEO_GRB + NEO_KHZ800);

// Color sequence for the LED strip
uint32_t colors[] = {
  strip.Color(255, 0, 0),     // Red
  strip.Color(0, 255, 0),     // Green
  strip.Color(0, 0, 255),     // Blue
  strip.Color(255, 255, 0),   // Yellow
  strip.Color(255, 0, 255),   // Magenta
  strip.Color(0, 255, 255),   // Cyan
  strip.Color(255, 255, 255), // White
  strip.Color(255, 165, 0)    // Orange
};

int colorIndex = 0;
unsigned long previousMillis = 0;
const long interval = 5000;  // 5 seconds

void setup() {
  Serial.begin(115200);
  Serial.println("Motor and LED Strip Control");
  
  // Initialize motor pins
  pinMode(MOTOR_IN1, OUTPUT);
  pinMode(MOTOR_IN2, OUTPUT);
  
  // Initialize LED strip
  strip.begin();
  strip.show();  // Initialize all pixels to 'off'
  strip.setBrightness(250);  // Set brightness (0-255)
  
  // Start the motor
  startMotor();
  
  // Show first color
  setAllLEDs(colors[colorIndex]);
}

void loop() {
  unsigned long currentMillis = millis();
  
  // Check if 5 seconds have passed
  if (currentMillis - previousMillis >= interval) {
    previousMillis = currentMillis;
    
    // Move to next color
    colorIndex = (colorIndex + 1) % (sizeof(colors) / sizeof(colors[0]));
    
    // Update LED strip with new color
    setAllLEDs(colors[colorIndex]);
    
    Serial.print("Changed to color index: ");
    Serial.println(colorIndex);
  }
}

void startMotor() {
  // Set motor to spin forward at normal speed
  analogWrite(MOTOR_IN1, MOTOR_SPEED);
  analogWrite(MOTOR_IN2, 0);
  Serial.println("Motor started at normal speed");
}

void stopMotor() {
  // Stop the motor
  analogWrite(MOTOR_IN1, 0);
  analogWrite(MOTOR_IN2, 0);
  Serial.println("Motor stopped");
}

void setAllLEDs(uint32_t color) {
  for (int i = 0; i < NUM_LEDS; i++) {
    strip.setPixelColor(i, color);
  }
  strip.show();
}

Credits

The Spanner
1 project • 3 followers
B-Tech Student at University of California, Los Angeles (UCLA)

Comments