Introduction: Digital Tree

For school, we needed to create an interactive product. I chose to make a kind of digital tree.

Part of this is because I wanted to have something that is not a dying plant, yet still lives. Partly because I also feel like it serves as a friendly everyday reminder to care for things.

Step 1: Step 1: What You Will Need

- 1 Ikea Bittergurka hanging plant pot

- 1 Ikea Socker metal plant pot 10,5 cm

- 4x 1,5cm thick planks of basic pinewood, 100x25cm

- 6mm thick multiplex plank of 2x1m

- 1x PVC tube, 30cm long and 2cm wide

- A water tap, the kind you usually see in big mason jar drink dispensers (which is where I got mine from)

- A disc of Plexiglas, 7,5cm in diameter

- Solder

- Hotglue

- about 2 metres of single core wire (probably less, but let's go with more)

- Arduino Uno

- About 30 Adafruit Neopixels, up to your preference (this code will assume 26 pixels)

- A hygrometer

Step 2: Step 2: the Code

#define PIN 13 #define N_LEDS 26 #define waterGrens 175 static unsigned long lWaitMillis; const int waterSensor = A0; const int digitalOutPin = 8; const long waitTime = 10000; Adafruit_NeoPixel strip = Adafruit_NeoPixel(N_LEDS, PIN, NEO_GRB + NEO_KHZ800);

enum ledStatus { green, red, off };

bool DEATH = false; int sensorValue; int ledCounter;

ledStatus myleds[N_LEDS];

void setup() { strip.setBrightness(100); strip.begin(); strip.clear(); intialise(); }

void loop() {
sensorValue = analogRead(waterSensor); if (sensorValue<=waterGrens && !DEATH){ intialise(); } if( (long)( millis() - lWaitMillis ) >= 0) { // millis is now later than my 'next' time if(!DEATH){ Serial.println(waitTime); advance(); } if(ledCounter == N_LEDS){ ledCounter = 0; }

lWaitMillis += waitTime; // do it again 1 second later } else { // millis is still 'before' my 'next' time // so I continue waiting

delay(5); // one possible thing you can do }

}

void intialise() { digitalWrite(digitalOutPin,HIGH); for(int i=0; i myleds[i] = green;

strip.setPixelColor(i, strip.Color(5,255,20)); } strip.show(); lWaitMillis = millis()+2000; // initial setup ledCounter = 0; sensorValue = 0; }

void advance() { switch (myleds[ledCounter]){ case off: myleds[ledCounter] = green; //strip.setPixelColor(ledCounter, strip.Color(0,255,0)); //strip.show(); gradient(20,255,255); ledCounter = ledCounter+1; break;

case green: myleds[ledCounter] = red; //strip.setPixelColor(ledCounter, strip.Color(255,0,0)); //strip.show(); gradient(255,30,15); ledCounter = ledCounter+1; break;

case red:
myleds[ledCounter] = off; //strip.setPixelColor(ledCounter, strip.Color(0,0,0)); //strip.show(); gradient(0,0,0); ledCounter = ledCounter+1; if (ledCounter >= N_LEDS){ DEATH = true; } break; } }

void gradient(int R2 , int G2, int B2) { int R=(strip.getPixelColor(ledCounter) >> 16) & 0x7f; int G=(strip.getPixelColor(ledCounter) >> 8) & 0x7f; int B=(strip.getPixelColor(ledCounter) ) & 0x7f; for (int i = 0; i<255; i++) { if (RR2) { R--; } if (GG2) { G--; } if (BB2) { B--; } strip.setPixelColor(ledCounter, strip.Color(R, G, B)); strip.show(); } }

Step 3: Step 3: the Tree Itself

First of all, I want to make two notes on the previous step:

  • When you work with Neopixels, make sure to install the library and begin your code with #include <Adafruit_NeoPixel.h>
  • in the beginning of the code there's a #define N_LEDS. This one is set at 26 because I used 26 pixels. Adjust it to the amount of pixels you have!

Now, for creating the tree.

In my case, I used several old planks of hardwood which used to be a bookshelf. I shaved them down so the woodstain was taken off and recycled them for this project.

Being an art student, I also freeformed the shape of the tree, though in the image you can see I did draw out a topdown view of the tree. You want your layers to have slight similarities in its blobbiness, so it looks like it’s actually flowing a bit more into one design. For the branches, make sure to start a few layers before the branch with a blob that will support said branch. The best you can do it cut out your designs in paper and layer them, seeing how things will approximately end up and going from there.

Do make sure that, no matter how your tree goes, the middle of it will align in some way, because you will be inserting the PVC pipe into this for the wiring.

Besides the layers, we also need a base. Measure out the circumference of the Bittergurka on the multiplex and add a few cm. Make sure to have the original circumference measured out as well, you will need it in a bit. Measure out the center as well! The center should align with part that sticks out inside the Bittergurka, which would usually be used to attach the hanging mechanism to.

Saw out this covering plate and make a hole in the middle. The hole should be big enough to fit the PVC-pipe snugly through it. Since the PVC-pipe is about 2cm thick, I recommend making the hole slightly larger. Next, create an indent in the wood along the earlier-measured-out original circumference so it can fit on the Bittergurka base like a lid.

Lastly, the base needs a hole for the Socker metal plant pot. Measure out a 10cm circle removed about 1,2 cm (in my case) from the edge of the lid. Please make sure to align and measure out these things before going at it, since your circumference of the lid might be different from mine! The Socker pot should be a little bit in touch with the side of the Bittergurka, because both will have the water tap pass through them.

Saw out the hole to fit the Socker and it should fit snugly.

Next up, making some adjustments to the Bittergurka. 1,6cm from the underside, drill a hole in the Bittergurka. This will be for the tap. Align this with the Socker and draw out where that hole for the tap should be as well, drill that too. Back to the Bittergurka. In the middle part, where there’s two natural holes for a screw, cut one of them open. This will be for the wiring. Finally, in the side edge of the Bittergurka, cut a hole and fold the metal inwards. This will leave room for the powersupply cord.

The reason for the tap is that the Socker will hold the water and it needs to be let out every now and then. Besides this hole, also make a 0,5cm hole net to where you will place your hygrometer. This is for the wiring.

For in the Socker, you will need a piece of Plexiglas with 7,5 as size. Shave off one side of the plastic. Inside the Socker, place four dots of glue to rest the Plexiglas on. Also hotglue the hygrometer to the inside. See imeages for context. This is to make sure the water will drip down the hygrometer’s side when you water your tree.

The basics of your base is now done.

sidenote: in the images it may seem like several of the "leaves" will contain leds, this is because this was my original plan. After many struggles with neopixels not functioning and attaching powersources and troubleshooting back and forth, I've only decided to wire the top layer.

Make sure that the few branches where the PVC pipe isn't sticking through will have a hole, as well as de leaf having a hole for the wiring.

The leaves
They can be any shape, though I made them oval to resemble a bonsai. Take your neopixels and place them TOP, COVERING LAYER of wood, deciding how you want them to be placed (maybe already cutting some off of the strip to make corners, as I’ve done). Mark out the middles of the neopixels so you know where you will be drilling the holes. Next up, when you are going to drill the holes in the top layers to let the pixels shine, make sure to take the bottom layer with you!! Drill through the top layer and make sure to leave a small indent of this hole in the bottom layer. This will serve as your marker for knowing where your pixels will go on the bottom layer.

On the bottom layer, widen these round indents using a drill of 2 cm in diameter, and drill about 2mm deep. It will fit a neopixel nicely. Finally, attach all these indents using another indent for the wiring.

Sand down the edges of all the wood you have. Make sure it’s nice and smooth and all the wood is finished up. Check if all your wiring holes and indents are nicely aligned. You are now done with the wood.

Now comes the wiring.

Step 4: The Wiring

Huzzah! You've made it this far!

Now it's time for the wiring, which is actually really easy. You only have to attach one side of the neopixelstrip to make things work. A crude graph can be seen in the images.

Please keep in mind

Your neopixels can be powered by the Arduino. However, if you attach more than 30 with plenty of wire between them, I think they will cause problems. Watch out for this and use a powersupply when neccessary!

Either way, solder the neopixels together and make sure to test your strip.

Now you can start pulling the wiring through the tree. Stack your layers of wood, preferably glueing them together, and lastly pull through the wires of the Neopixels. Also make sure to have the wires of the hygrometer present. Once you have all this, you can attach them to your Arduino and run your code. It should work now!

Step 5: Step 5: Finishing Touches

Check your wiring, run your code... Glue your wood together.

It should be done now!

Enjoy!