Project tutorial
3D-Printed Nanoleaf ATtiny85

3D-Printed Nanoleaf ATtiny85 © GPL3+

A cheap DIY version of Nanoleaf RGB LIGHT with ATtiny85 and WS2812 RGB strip.

  • 2,663 views
  • 0 comments
  • 10 respects

Components and supplies

Necessary tools and machines

3drag
3D Printer (generic)

Apps and online services

About this project

watch the video for tutorial, like share and subscribe to my Youtube channel. thanks!

\\peace out fellas

Code

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

#define BUTTON_PIN   1 
#define PIXEL_PIN    0   // Digital IO pin connected to the NeoPixels.

#define PIXEL_COUNT 12 //change this number to whatever rgb you are using

Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, NEO_GRB + NEO_KHZ800);

bool oldState = HIGH;
int showType = 0;

void setup() {
  pinMode(BUTTON_PIN, INPUT_PULLUP);
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}

void loop() {
  // Get current button state.
  bool newState = digitalRead(BUTTON_PIN);

  // Check if state changed from high to low (button press).
  if (newState == LOW && oldState == HIGH) {
    // Short delay to debounce button.
    delay(20);
    // Check if button is still low after debounce.
    newState = digitalRead(BUTTON_PIN);
    if (newState == LOW) {
      showType++;
      if (showType > 14)
        showType=0;
      startShow(showType);
    }
  }

  // Set the last button state to the old state.
  oldState = newState;
}


void startShow(int i) {
  switch(i){
    case 0: colorWipe(strip.Color(0, 0, 0), 50);    // Black/off
            break;
    case 1: colorWipe(strip.Color(255, 0, 0), 50);  // Red
            break;
    case 2: colorWipe(strip.Color(0, 255, 0), 50);  // Green
            break;
    case 3: colorWipe(strip.Color(0, 0, 255), 50);  // Blue
            break;
    case 4: colorWipe(strip.Color(100, 0, 255), 50);  // purp 
            break;            
    case 5: colorWipe(strip.Color(200, 0, 255), 50);  // lite purp
            break;             
    case 6: colorWipe(strip.Color(255, 0, 100), 50);  // pink
            break;  
    case 7: colorWipe(strip.Color(255, 255, 0), 50);  // yellown
            break;
    case 8: colorWipe(strip.Color(255, 110, 20), 50);  // orange
            break;
    case 9: colorWipe(strip.Color(255, 100, 100), 50);  // Rorange
            break;
    case 10: colorWipe(strip.Color(255, 180, 40), 50);  // lite orange 
            break; 
    case 11: colorWipe(strip.Color(0, 255, 255), 50);  // LIGHT Blue
            break;                                                   
    case 12: colorWipe(strip.Color(0, 255, 100), 50); //greenish blue 
            break;
    case 13: colorWipe(strip.Color(150, 255, 0), 50);  //greenish red 
            break;
    case 14: colorWipe(strip.Color(255, 255, 255), 50);  // white
            break; 
  }
}


void colorWipe(uint32_t c, uint8_t wait) {
  for(uint16_t i=0; i<strip.numPixels(); i++) {
    strip.setPixelColor(i, c);
    strip.show();
    delay(wait);
  }
}



// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  WheelPos = 255 - WheelPos;
  if(WheelPos < 85) {
    return strip.Color(255 - WheelPos * 1, 0, WheelPos * 1);
  }
  if(WheelPos < 170) {
    WheelPos -= 85;
    return strip.Color(0, WheelPos * 1, 255 - WheelPos * 1);
  }
  WheelPos -= 170;
  return strip.Color(WheelPos * 1, 255 - WheelPos * 1, 0);
}

Custom parts and enclosures

stl files
nanoleaf_body_RRYBolgZhQ.stl

Schematics

Comments

Similar projects you might like

3D-Printed Arduino Obstacle Avoiding Robot

Project tutorial by Arnov Sharma

  • 2,673 views
  • 0 comments
  • 3 respects

3D-Printed Jet Turbine

Project tutorial by Arnov Sharma

  • 8,692 views
  • 15 comments
  • 43 respects

ATtiny85 Mini Arcade: Snake

Project tutorial by Arduino “having11” Guy

  • 2,267 views
  • 7 comments
  • 19 respects

Hacking Qualcomm (Quick Charge) QC 2.0/3.0 With ATtiny85

Project tutorial by Shahariar

  • 12,290 views
  • 15 comments
  • 46 respects

Simple 3D-Printed WS2812-Based RGB Lamp

Project in progress by Arnov Sharma

  • 936 views
  • 0 comments
  • 4 respects

Tito - Arduino UNO 3D-printed robot

Project tutorial by Camilo Parra Palacio

  • 16,689 views
  • 15 comments
  • 47 respects
Add projectSign up / Login