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.

  • 1,296 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

DIY Universal CNC Machine

Project tutorial by Arduino “having11” Guy

  • 19,310 views
  • 5 comments
  • 76 respects

DIY Smart Cane Using Arduino

Project tutorial by suhail jr

  • 9,871 views
  • 1 comment
  • 12 respects

DIY Voltmeter with Arduino and a Nokia 5110 Display

Project tutorial by Nick Koumaris

  • 9,487 views
  • 6 comments
  • 20 respects

DIY Solar Tracker Arduino Project ITA

Project tutorial by Ingeimaks Ingeimaks

  • 1,958 views
  • 1 comment
  • 18 respects

Arduino DIY Light Meter With BH1750 Sensor

Project tutorial by Nick Koumaris

  • 1,343 views
  • 1 comment
  • 2 respects

DIY Distance Meter with Arduino and a Nokia 5110 Display

Project tutorial by Nick Koumaris

  • 6,368 views
  • 0 comments
  • 16 respects
Add projectSign up / Login