Nate
Published

Data Visualization Project

An art/computing hybrid project with a functioning garage door.

IntermediateFull instructions provided10 hours35
Data Visualization Project

Things used in this project

Hardware components

Caster Wheels
×1
Argon
Particle Argon
×1
INJS022-360 Servo
×1
LED Stick, NeoPixel Stick
LED Stick, NeoPixel Stick
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Hot glue gun (generic)
Hot glue gun (generic)

Story

Read more

Schematics

Schematics

Code

presentationCode

C/C++
// This #include statement was automatically added by the Particle IDE.
#include <ArduinoJson.h>

// This #include statement was automatically added by the Particle IDE.
#include <neopixel.h>

// Include Particle Device OS APIs
#include "Particle.h"
#include <random>
SYSTEM_MODE(AUTOMATIC);
SerialLogHandler logHandler(LOG_LEVEL_INFO);

#define PIXEL_COUNT 1
#define PIXEL_PIN A5
#define PIXEL_TYPE WS2812B
Adafruit_NeoPixel strip(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);

bool up = false;

Servo myServo;
int arrests = 0;

//presentation code executes @ setup
void setup()
{
  strip.begin();

  Particle.subscribe("hook-response/narcoticsArrests", myHandler, MY_DEVICES);
  myServo.attach(3);
  strip.setPixelColor(0, 255, 200, 0);
  strip.show();
  
  void moveDoor();
}

void myHandler(const char *event, const char *data)
{
    arrests = atoi(data);
    Serial.println(arrests);
    delay(1000);
} 

int getArrests()
{
        //gathers data 14 days in the past
        time_t startTime = Time.now() - 1209600;   // 14 DAYS
        time_t endTime = startTime + 86400;
        Time.zone(-6);
        String strEndTime = Time.format(endTime, TIME_FORMAT_ISO8601_FULL);
        strEndTime = strEndTime.substring(0, strEndTime.length()-6);
        String strStartTime = Time.format(startTime, TIME_FORMAT_ISO8601_FULL);
        strStartTime = strStartTime.substring(0, strStartTime.length()-6);
        String data = "{\"minDate\":\"" + strStartTime + "\"";
        data += ", \"maxDate\":\"" + strEndTime + "\"}";
        Particle.publish("narcoticsArrests", data);
        
}

void moveDoor(){
    int arrests = getArrests();
    if(arrests>25){
        myServo.write(180);
        delay(2000);
        myServo.write(90);
    }
    else{
        myServo.write(180);
        delay(3500);
        myServo.write(90);
    }
      bool up = true;

}

void loop() 
    {
        
    }

Credits

Nate
2 projects • 0 followers

Comments