Michelle
Published

LED Snake Plant

A potted snake plant with twinkling leaves of yarn.

BeginnerShowcase (no instructions)1,455
LED Snake Plant

Things used in this project

Hardware components

ESP32 development board
×1
Rocker switch
×1
3 pin wire connectors
×10
Mount screw terminal block connectors
×2
3A output USB adapter
×1
Any 3-foot USB cable
×1
1/8” threaded rod
I bought 15x 36” rods (3 rods per leaf)
×15
5V 300 pixel LED strip
×1
Yarn
×1
10 in. round foam block
for holding the leaves in place
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Welder
3/4” diamond hole saw bit
for drilling a hole in a rock!
Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Schematic

Note: I had to disconnect the VIN pin while uploading code to the board. When the board is powered by microUSB, the VIN pin outputs 5V, and since the VIN pin is wired to the same bundle as the LED power input, my computer kept disabling the USB port because it was “using too much power” to power all 300 LEDs! But this is what’s so beautiful about these mount screw terminal block connectors! (See parts list.) You just unscrew the pin instead of having to un-solder and re-solder.

Code

How I allocate multiple LED strips with different lengths to a single array

Arduino
CRGB *leds;

// number of LEDs on each side of each leaf
int NUM_LEDS[] = {21, 25, 30, 35, 40};
int NUM_LEDS_TOTAL = 2 * sum(NUM_LEDS, NUM_LEAVES);

void setup() {

  leds = new CRGB[NUM_LEDS_TOTAL];

  int offset = 0;

  // add LEDs leaf 1 side 1
  FastLED.addLeds<NEOPIXEL, PIN_1A>(leds, offset, NUM_LEDS[0]);
  offset += NUM_LEDS[0];

  // add LEDs leaf 1 side 2
  FastLED.addLeds<NEOPIXEL, PIN_1B>(leds, offset, NUM_LEDS[0]);
  offset += NUM_LEDS[0];

  // leaf 2, 3, etc...
}

Leaf struct

Arduino
Each leaf has pointers marking the beginning of its left and right side
struct Leaf {
  int leafIndex;
  int numLEDs;
  CRGB *ledsLeft;
  CRGB *ledsRight;

  void setLED(int index, CRGB color) {
    ledsLeft[index] = color;
    ledsRight[index] = color;
  }
};

Looping over all the leaves looks like this

Arduino
for (int l = 0; l < NUM_LEAVES; l++) {
  for (int i = 0; i < leaves[l].numLEDs; i++) {
    leaves[l].setLED(i, CRGB::Green);
  }
}

Github

Credits

Michelle
4 projects • 13 followers
I like learning about programming LEDs for art installations, and creative coding in general. I also love drawing diagrams and soldering.
Contact

Comments

Please log in or sign up to comment.