Introduction: Computational Sculpture Visualization Project

A computational sculpture which shows the deteriorating state of the ocean within the last century through pollution with lights. This page details the programming and electrical areas much more than the sculpture part.

Supplies

Tools:

  • Sautering iron
  • Wire cutters
  • Wire strippers
  • Hot glue gun w/ hot glue sticks
  • Box cutters if needed

Materials:

  • Two or three meters total of wire
  • Particle Argon/Arduino
  • Neopixel LEDs
  • Stepper motor

Step 1: API

The API used for this project is from this website

The specific API is from this page

You can configure and filter this API's return data, and for me, I collected how many times data was collected on the ocean's pollution about every decade to five years.

Step 2: Code Logic

The sculpture changes based on a daily cycle which varies the brightness and color of the lights inside the box based on how polluted the ocean is during a certain time period. The more pollutants in that time period, the less bright and less blue the lights become. Every hour corresponds to a number of years, either 10 years or 5 years, from 1950 to now.


The code's logic basically goes as follows:

  • Has the hour changed?
  • If yes, change the webhook, return the new data
  • Based on the new data, change the sculpture's lights.
  • If no, continue using the same webhook and data

Also, there is a stepper motor in the middle which has a plate representing the Great Pacific Garbage patch spinning on it.

Step 3: The Entire Code

#include <Stepper.h>

#define IN1 2
#define IN2 3
#define IN3 4
#define IN4 5

const int steps = 10;

Stepper myStepper(steps, IN1, IN2, IN3, IN4);

#include <neopixel.h>

#define PIXEL_PIN D6
#define PIXEL_COUNT 6
#define PIXEL_TYPE WS2812B

#define PIXEL_PIN2 D7
#define PIXEL_COUNT2 12
#define PIXEL_TYPE2 WS2812B


Adafruit_NeoPixel strip(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);
Adafruit_NeoPixel strip2(PIXEL_COUNT2, PIXEL_PIN2, PIXEL_TYPE2);

int totalOfYr = 0;      // The number which changes based on webhook

bool changed = true;        // Boolean which says whether or not the hour has changed
int timeTrack = Time.hour();      // Tracks the hour to check if the hour has changed

String strStartTime;        // Initialize the string which tracks the start date by hour
String strEndTime;      // Initialize the string which tracks the end date by hour


void setup()
{
    Serial.begin(9600);

    Serial.println("Start");      // For reference on monitor

    myStepper.setSpeed(1);

    Time.beginDST();        // Account for Daylight Savings

    Time.zone(-6);       // Account for time zone

    Serial.println(Time.hour());        // Print current time

    strip.begin();
    strip2.begin();

    strip.setBrightness(5);
    strip2.setBrightness(5);

    strip.show();               // Initialize all pixels to 'off'
    strip2.show();

    Particle.subscribe("hook-response/mLitGenB", theHandler);       // Webhook subscription

}

void loop()
{

    myStepper.step(steps);

    if(timeTrack != Time.hour()){
        changed = true;
        timeTrack = Time.hour();
    }

    if(changed){

        if(Time.hour() <= 7){
            strStartTime = "1950";
            strEndTime = "1960";
            Serial.println("Hour 7");
        }

        if(Time.hour() == 8){
            strStartTime = "1960";
            strEndTime = "1970";
            Serial.println("Hour 8");
        }

        if(Time.hour() == 9){
            strStartTime = "1970";
            strEndTime = "1980";
            Serial.println("Hour 9");
        }

        if(Time.hour() == 10){
            strStartTime = "1980";
            strEndTime = "1990";
            Serial.println("Hour 10");
        }

        if(Time.hour() == 11){
            strStartTime = "1990";
            strEndTime = "2000";
            Serial.println("Hour 11");
        }

        if(Time.hour() == 12){
            strStartTime = "2000";
            strEndTime = "2010";
            Serial.println("Hour 12");
        }

        if(Time.hour() == 13){
            strStartTime = "2010";
            strEndTime = "2020";
            Serial.println("Hour 13");
        }

        if(Time.hour() >= 14){
            strStartTime = "2020";
            strEndTime = "2025";
            Serial.println("Hour 14");
        }

        String data = "{\"minDate\":\"" + strStartTime + "\"";
        data += ", \"maxDate\":\"" + strEndTime + "\"}";

        Particle.publish("mLitGenB", data);

        changed = false;

    }


    if(totalOfYr <= 100){

        strip.Color(0, 0, 255);
        strip2.Color(255, 255, 255);
        Serial.println("Under 100");

    }

    else if(totalOfYr <= 200){

        strip.Color(0, 0, 215);    
        strip2.Color(225, 225, 225);
        Serial.println("Under 200");

    }    

    else if(totalOfYr <= 300){

        strip.Color(0, 0, 175);    
        strip2.Color(195, 195, 195);
        Serial.println("Under 300");

    }

    else if(totalOfYr <= 400){

        strip.Color(0, 0, 135);    
        strip2.Color(165, 165, 165);
        Serial.println("Under 400");

    }

    else if(totalOfYr <= 500){

        strip.Color(0, 0, 95);    
        strip2.Color(135, 135, 135);
        Serial.println("Under 500");

    }

    else if(totalOfYr <= 750){

        strip.Color(0, 0, 55);    
        strip2.Color(105, 105, 105);
        Serial.println("Under 750");

    }

    else if(totalOfYr <= 1000){

        strip.Color(0, 0, 15);    
        strip2.Color(75, 75, 75);
        Serial.println("Under 1000");

    }

    else{

        strip.Color(0, 0, 15);    
        strip2.Color(255, 255, 255);
        Serial.println("Over 1000");
    }

        strip.show();
        strip2.show();   

}

void theHandler(const char *event, const char *data) {

    Serial.println("Handler Start");

    totalOfYr = atoi(data);
    Serial.println(totalOfYr);

    Serial.println("Handler End");

}

Step 4: Product

This is how the project ended up.

Important:

Part of the project is not working. This is likely due to my personal micro-controller being unable to connect to the internet and update its code from an unknown issue