Divinefavour Osuji
Published

Gun Violence Awareness Sculpture Project - Lane Tech PCL

A project that brings awareness to families leaving their Chicago neighborhoods to flee gun violence via a sculpture with electronics.

IntermediateFull instructions provided80
Gun Violence Awareness Sculpture Project - Lane Tech PCL

Things used in this project

Hardware components

Photon
Particle Photon
×1
A small protoboard
×1
DC POWER JACK 2.1MM BARREL-TYPE PCB MOUNT
TaydaElectronics DC POWER JACK 2.1MM BARREL-TYPE PCB MOUNT
×1
Female Header 8 Position 1 Row (0.1")
Female Header 8 Position 1 Row (0.1")
×1
Adafruit NeoPixel Digital RGB LED Strip 144 LED, 1m White
Adafruit NeoPixel Digital RGB LED Strip 144 LED, 1m White
×1
Stepper Motor
Digilent Stepper Motor
×1
28byj-48 Stepper Motor Driver
×1
Breadboard (generic)
Breadboard (generic)
×1
USB A to Micro-B Cable
Digilent USB A to Micro-B Cable
×1
ELEGOO 120pcs Multicolored Dupont Wire
ELEGOO 120pcs Multicolored Dupont Wire
×1
Timing Belt and Pully
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE
Chicago Crime Data Portal

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free
PCB Holder, Soldering Iron
PCB Holder, Soldering Iron
3D Printer (generic)
3D Printer (generic)
PLA filament

Story

Read more

Custom parts and enclosures

Stepper Motor Mount

My Custom Mount

Sketchfab still processing.

Schematics

Wiring

The wiring for this project was relatively basic. The 24 strip NeoPixel lights were wired to ground, 5v power, and the D15pin. The 2 strip NeoPixel lights were wired to ground, 5v power, and the D2 pin. The motor driver was wired to IN1 to D3; IN2 to D1; IN3 to D14; and IN4 to D4, then ground and 5v power were wired respectively.

Code

sculpture.ino

C/C++
Program for the sculpture project
// This #include statement was automatically added by the Particle IDE.
#include <Stepper.h>

// 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"
#if (PLATFORM_ID == 32)
#define PIXEL_PIN SPI
#define PIXEL_PIN2 SPI1

#else // #if (PLATFORM_ID == 32)
#define PIXEL_PIN D15
#define PIXEL_PIN2 D2
#endif
#define PIXEL_COUNT1 24
#define PIXEL_COUNT2 2

#define PIXEL_TYPE WS2812B
Adafruit_NeoPixel strip(PIXEL_COUNT1, PIXEL_PIN, PIXEL_TYPE);  
Adafruit_NeoPixel strip2(PIXEL_COUNT2, PIXEL_PIN2, PIXEL_TYPE); 

#define OUTPUT1   3                
#define OUTPUT2   1              
#define OUTPUT3   14               
#define OUTPUT4   4 
// Define the number of steps per rotation
const int stepsPerRotation = 2048;  // 28BYJ-48 has 2048 steps per rotation in full step mode as given in data sheet

// Initialize the stepper motor with the sequence of control pins OUTPUT1, OUTPUT3, OUTPUT2, IN4
// OUTPUT1 and OUTPUT3 are connected to one coil and OUTPUT2 and OUTPUT4 are connected to one Coil
Stepper myStepper(stepsPerRotation, OUTPUT1, OUTPUT3, OUTPUT2, OUTPUT4);  
// Let Device OS manage the connection to the Particle Cloud
SYSTEM_MODE(AUTOMATIC);

// Show system, cloud connectivity, and application logs over USB
// View logs with CLI using 'particle serial monitor --follow'
//SerialLogHandler logHandler(LOG_LEVEL_INFO);
int startDay;
String jsonText = "";
int count = 0;
// setup() runs once, when the device is first turned on
void setup()
{
    int startDay = Time.day();
    Time.zone(-6);
    myStepper.setSpeed(15);
    strip.begin();
    strip2.begin();
        for (int i = 0; i < 24; i++){
                strip.setPixelColor(i, 255, 90, 0); //(yellow) light yellow (244,186,11) (250, 174, 11) (250,200,5) (255,165,5)
                strip2.setPixelColor(i, 255, 255, 255);
            }
    strip.show();
    strip2.show();
    Serial.begin(9600);

}

// loop() runs over and over again, as quickly as it can execute.
void loop() {
    if(startDay != Time.day()){
        for (int i = 0; i < 24; i++){
                strip.setPixelColor(i, 255, 90, 0); //(yellow) light yellow (244,186,11) (250, 174, 11) (250,200,5) (255,165,5)
            }
        strip.show();
        delay(2500);
        sendHelp();
        startDay=Time.day();
    }
    if (count !=0){
        triggerLight();
    }
}

     
void sendHelp()
{
    
    time_t startTime = Time.now() - 777600;   
    time_t endTime = startTime + 86400;       
    
    // setup the time zone
    Time.zone(-6);  
    
    // Format the time in the same format as what the database uses
    String strEndTime = Time.format(endTime, TIME_FORMAT_ISO8601_FULL);
    
    // Remove some characters from the end. ISO8601 has two variations.
    // Particle doesn't use the same variation so we need to chop off the end of it
    strEndTime = strEndTime.substring(0, strEndTime.length()-6);
    
    // Do the same for min
    String strStartTime = Time.format(startTime, TIME_FORMAT_ISO8601_FULL);
    strStartTime = strStartTime.substring(0, strStartTime.length()-6);
    
    // Format the JSON string properly. It should look like:
    // {"minDate":"2023-03-13T14:11:11", "maxDate":"2023-03-14T14:11:11"}
    String data = "{\"minDate\":\"" + strStartTime + "\"";
    data += ", \"maxDate\":\"" + strEndTime + "\"}";
    
    // Print to confirm the dates
    Serial.println(data);
    Serial.print("The amount of homicide victims from " + strStartTime + " to " + strEndTime + ": ");
    //delay(1000);
    
    Particle.subscribe("hook-response/Chicago_victims", handleEventResponse);
    Particle.publish("Chicago_victims", data);
            
}

void handleEventResponse(const char *event, const char *data)
{
    
    jsonText += String(data);
    //Serial.println(jsonText);
    count = atoi(jsonText);
    Serial.println(count);
    jsonText="";
}

void triggerLight(){
    if (count> 0 && count <5) {
            for (int i= 0; i<2; i++){
                strip.setPixelColor(i,0,0,0);
            }
            
        }
        if (count>4 && count < 10){
            for (int i =2; i <6;i++){ 
                strip.setPixelColor(i, 0,0,0);
            }
            for (int i=22; i<24; i++){
                strip.setPixelColor(i,0,0,0);
            }
        }
        if (count>9){
            for (int i =0; i < 6;i++){
                strip.setPixelColor(i,0,0,0);
            }
            for (int i=18; i < 24; i++){
                strip.setPixelColor(i,0,0,0);
            }
        }
            strip.show();
            for (int i=0; i<4; i++){
            myStepper.step(2048);
            delay(3000);
            }
            delay(5000);
           for (int i=0; i<4; i++){
          myStepper.step(-2048);
          delay(3000);
          }
            count = 0;
        
}

Credits

Divinefavour Osuji
1 project • 0 followers
Thanks to Bushra Qazi.

Comments