the idea:

Fractal Flowers is an interactive piece of installation art, which displays changing fractal trees based on ambient light and touch. When going into this project, I really liked the idea of a piece that could kind of show the passage of time/was affected by the environment. I struggled initially with a project that “necessitates wirelessness,” but I liked how this project could in theory just be left alone and change based on the environment. Then the display could be shown anywhere and you’d be aware in part of what the environment it lives in looks like. And in line with interacting with the environment, I knew I wanted the subject of the piece to also be nature-themed, and thus, fractal flowers was born.

the hardware

This project involves a single ESP32, a photo-resistor, and a wire. It reads in data from the sensors, transmits it via wifi, and then creates a visual display in Processing. The photo-resistor senses ambient lighting and the DIY sensor is a wire that can be touched or pinched, using the touch receptors on the ESP32.

the code

Going into this project, I knew I wanted to have a visual output. I’ve used Processing for the past two modules, so I was excited to use it again for this project. Plus, thanks to Darwin & Richard, I knew that it was possible to send data over wifi to Processing (thank you for walking me through that). For the fractals, I found an example on the Processing website which was hugely helpful in realizing different fractals on the screen (thank you Daniel Shiffman, love the Coding Train).

What happens is this: I have a photo-resistor that reads in ambient light data from the environment and a touch sensor. The photo-resistor data is sent to Processing, where I translate it from a number out of 4095 to degrees in radians. This is because I use that changing angle data to determine the angle at which the branches are rotated when calculating the fractal trees. The reason I wanted ambient light to affect the angle is because changing the angles drastically changes the look of fractals! So in an environment where light is changing, the flower will also look different. And because the environment light is always slightly changing, the flower looks almost like it’s breathing or like it’s alive.

here’s an example of a fractal branching function:

void branch4(float h) {
  // branch is 2/3 length of prev in pixels
  h *= 0.66;
  
  // if length of the branch > 2 pixels
  if (h > 2) {
    pushMatrix();    
    rotate(theta / 4);   
    line(0, 0, 0, -h);  
    translate(0, -h); 
    branch4(h);       
    popMatrix();   
    
    // branch left
    pushMatrix();
    rotate(-theta * 5);
    line(0, 0, 0, -h);
    translate(0, -h);
    branch4(h);
    popMatrix();
  }
}

I also changed the photo-resistor data into an alpha value, which I used to adjust the tinting of the background image (which I drew :D), so that as the environment light darkens, the light inside the program also darkens accordingly.

Here’s the background image - I drew a sky in Procreate because I wanted the ambient lighting to be reflected in the program as well and be slightly more interesting than just a solid color.

fullbg.PNG

The touch sensor is a boolean value, which essentially increments a counter from 0→3, where each number means a different fractal is displayed. If you touch/pinch the sensor, it will change to the next fractal, and so on.

Something exciting about the output is that it kind of shows the passage of time through ghostly after-images. If the light changes really drastically really fast, you can see after-images of previous fractals for a second afterwards.

the enclosure

At the CEID, I constructed a cardboard enclosure for my project. Although I did a black, sleek design for the last project, I wanted this one to look more rustic, to be in line with the nature theme. With this in mind, I covered it in some thick outdoors fabric. The touch sensor is pretty obvious, while the photo-resistor kind of blends in, which is what I wanted. Behold:

IMG_6589.jpeg

IMG_6588.jpeg