Chicago Zip Code Map

by emchale in Circuits > Microcontrollers

204 Views, 0 Favorites, 0 Comments

Chicago Zip Code Map

IMG-0826.jpg

This project lights up different regions of a Chicago map based on inputed zip codes. I made this map as part of a home automation challenge in a physical computing class. I was motivated by my lack of directional awareness. While I can navigate with a GPS, I often don't understand where within Chicago I am traveling too and struggle to visualize the layout of the city.

Supplies

1376-00.jpg
download.jpeg
71MDEpTJSbL._SX522_.jpg

For this project we will use:

9 NeoPixel LED Lights

Particle Argon

Breadboard

2 Buttons

2 Resistors

2 LED Lights


Tools:

Soldering Iron

Hot Glue Gun

Breadboard Button Set Up

unnamed.jpg
  • Connect ground on the argon to the negative power rail on the breadboard
  • Connect both buttons and resistors to ground
  • Connect the LED lights to ground
  • Connect the buttons to the argon pins D5 and D3, respectively
  • Connect the LED lights to the argon pins D7 and D4 respectively
  • Connect the Neopixel GND wire to ground, the +5V wire to VUSB, and Din wire to the argon pin D6

Categorizing Zip Codes Into Neighborhoods

chicago-zipcode-map.jpg
Chicago_neighborhoods_map.png

The Chicago zip codes were sorted into the nine different neighborhoods pictured above.

Here is a list of the zip codes in each region:

Central: 60610, 60654, 60661, 60606, 60605, 60604, 60603, 60602, 60601, 60611

Far North: 60631, 60656, 60630, 60646, 60625, 60659, 60645, 60626, 60660, 60640, 60666

Far Southeast: 60827, 60633, 60628, 60617, 60619 

Far Southwest: 60652, 60620, 60643, 60655

North: 60613, 60657, 60647, 60614

Northwest: 60634, 60641, 60618, 60707, 60739, 60639

South: 60616, 60653, 60615, 60637, 60649

Southwest: 60638, 60632, 60609, 60629, 60636, 60621

West: 60651, 60644, 60624, 60623, 60612, 60622, 60608, 60607, 60642

Each neighborhood was assigned a different NeoPixel light. For example any zip code on the far north side would turn on the first NeoPixel Light.

Code

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


#define PIXEL_COUNT 9 // 24 Pixels on our ring
#define PIXEL_PIN D6 // Ring uses D6 as default pin
#define PIXEL_TYPE WS2812B // Ring uses WS2812 Pixels

Adafruit_NeoPixel light(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE); // Create out “ring” object

int led1 = 7;
int button1 = 5;

int led2 = 4;
int button2 = 3;

int which_digit = 3;

int digit3 = 0;
int digit4 = 0;
int digit5 = 0;


//int digit
int digit1_2 = 60; 
int d1_3 = 0; 
int d1_4 = 0; 
int zipcode = 0; 


int myConcat(int a, int b)
{
 
    // Convert both the integers to string
    String s1 = String(a);
    String s2 = String(b);
 
    // Concatenate both strings
    String s = s1 + s2;
 
    // return the String as an int
    return s.toInt();
}


void setup()
{
pinMode(button1, INPUT_PULLUP);
pinMode(button2, INPUT_PULLUP);


pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);

//Start the NeoPixel object
    light.begin();       
    light.setBrightness(5);


}

void loop()
{
// Reads the state of the button
int btnState1 = digitalRead(button1);
int btnState2 = digitalRead(button2);

if (which_digit == 6)

    //central
        if (zipcode == 60610)
        {
            light.setPixelColor(3, 109, 239, 12);  
        }
        if (zipcode == 60654)
        {
            light.setPixelColor(3, 109, 239, 12);  
        }
        if (zipcode == 60661)
        {
            light.setPixelColor(3, 109, 239, 12);  
        }
        if (zipcode == 60606)
        {
            light.setPixelColor(3, 109, 239, 12);  
        }
        if (zipcode == 60605)
        {
            light.setPixelColor(3, 109, 239, 12);  
        }
        if (zipcode == 60604)
        {
            light.setPixelColor(3, 109, 239, 12);  
        }
        if (zipcode == 60603)
        {
            light.setPixelColor(3, 109, 239, 12);  
        }
        if (zipcode == 60602)
        {
            light.setPixelColor(3, 109, 239, 12);  
        }
        if (zipcode == 60601)
        {
            light.setPixelColor(3, 109, 239, 12);  
        }
        if (zipcode == 60611)
        {
            light.setPixelColor(3, 109, 239, 12);  
        }


        //farsoutheast region
        if (zipcode == 60827)
        {
            light.setPixelColor(8, 109, 239, 12);  
        }
        if (zipcode == 60633)
        {
            light.setPixelColor(8, 109, 239, 12);  
        }
        if (zipcode == 60628)
        {
            light.setPixelColor(8, 109, 239, 12);  
        }
        if (zipcode == 60617)
        {
            light.setPixelColor(8, 109, 239, 12);  
        }
        if (zipcode == 60619)
        {   
            light.setPixelColor(8, 109, 239, 12);  
        }
        //far north region
        if (zipcode == 60631)
        {
            light.setPixelColor(0, 109, 239, 12);  
        }
        if (zipcode == 60656)
        {
            light.setPixelColor(0, 109, 239, 12);  
        }
        if (zipcode == 60630)
        {
            light.setPixelColor(0, 109, 239, 12);  
        }
        if (zipcode == 60646)
        {
            light.setPixelColor(0, 109, 239, 12);  
        }
        if (zipcode == 60625)
        {
            light.setPixelColor(0, 109, 239, 12);  
        }
        if (zipcode == 60659)
        {
            light.setPixelColor(0, 109, 239, 12);  
        }
        if (zipcode == 60645)
        {
            light.setPixelColor(0, 109, 239, 12);  
        }
        if (zipcode == 60626)
        {
            light.setPixelColor(0, 109, 239, 12);  
        }
        if (zipcode == 60660)
        {
            light.setPixelColor(0, 109, 239, 12);  
        }
        if (zipcode == 60640)
        {
            light.setPixelColor(0, 109, 239, 12);  
        }
        if (zipcode == 60666)
        {
            light.setPixelColor(0, 109, 239, 12);  
        }
    
        //farsouthwest region
        if (zipcode == 60652)
        {
            light.setPixelColor(7, 109, 239, 12);  
        }
        if (zipcode == 60620)
        {
            light.setPixelColor(7, 109, 239, 12);  
        }
        if (zipcode == 60643)
        {
            light.setPixelColor(7, 109, 239, 12);  
        }
        if (zipcode == 60655)
        {
            light.setPixelColor(7, 109, 239, 12);  
        }
        //north region
        if (zipcode == 60613)
        {
            light.setPixelColor(2, 109, 239, 12);  
        }
        if (zipcode == 60657)
        {
            light.setPixelColor(2, 109, 239, 12);  
        }
        if (zipcode == 60647)
        {
            light.setPixelColor(2, 109, 239, 12);  
        }
        if (zipcode == 60614)
        {
            light.setPixelColor(2, 109, 239, 12);  
        }


        // northwest region
        if (zipcode == 60634)
        {
            light.setPixelColor(1, 109, 239, 12);  
        }
        if (zipcode == 60641)
        {
            light.setPixelColor(1, 109, 239, 12);  
        }
        if (zipcode == 60618)
        {
            light.setPixelColor(1, 109, 239, 12);  
        }
        if (zipcode == 60707)
        {
            light.setPixelColor(1, 109, 239, 12);  
        }
        if (zipcode == 60739)
        {
            light.setPixelColor(1, 109, 239, 12);  
        }
        if (zipcode == 60639)
        {
            light.setPixelColor(1, 109, 239, 12);  
        }


        //south region
        if (zipcode == 60616)
        {
            light.setPixelColor(6, 109, 239, 12);  
        }
        if (zipcode == 60653)
        {
            light.setPixelColor(6, 109, 239, 12);  
        }
        if (zipcode == 60615)
        {
            light.setPixelColor(6, 109, 239, 12);  
        }
        if (zipcode == 60637)
        {
            light.setPixelColor(6, 109, 239, 12);  
        }
        if (zipcode == 60649)
        {
            light.setPixelColor(6, 109, 239, 12);  
        }
        //southwest region
        if (zipcode == 60638)
        {
            light.setPixelColor(5, 109, 239, 12);  
        }
        if (zipcode == 60632)
        {
            light.setPixelColor(5, 109, 239, 12);  
        }
        if (zipcode == 60609)
        {
            light.setPixelColor(5, 109, 239, 12);  
        }
        if (zipcode == 60629)
        {
            light.setPixelColor(5, 109, 239, 12);  
        }
        if (zipcode == 60636)
        {
            light.setPixelColor(5, 109, 239, 12);  
        }
        if (zipcode == 60621)
        {
            light.setPixelColor(5, 109, 239, 12);  
        }


        //west region
        if (zipcode == 60651)
        {
            light.setPixelColor(4, 109, 239, 12);  
        }
        if (zipcode == 60644)
        {
            light.setPixelColor(4, 109, 239, 12);  
        }
        if (zipcode == 60624)
        {
            light.setPixelColor(4, 109, 239, 12);  
        }
        if (zipcode == 60623)
        {
            light.setPixelColor(4, 109, 239, 12);  
        }
        if (zipcode == 60612)
        {
            light.setPixelColor(4, 109, 239, 12);  
        }
        if (zipcode == 60622)
        {
            light.setPixelColor(4, 109, 239, 12);  
        }
        if (zipcode == 60608)
        {
            light.setPixelColor(4, 109, 239, 12);  
        }
        if (zipcode == 60607)
        {
            light.setPixelColor(4, 109, 239, 12);  
        }
        if (zipcode == 60642)
        {
            light.setPixelColor(4, 109, 239, 12);  
        }
 
        light.show();
       
    }
    
    if (which_digit == 5)
{
    if (btnState1 == LOW)
    {
        digit5 = digit5 + 1;
        digitalWrite(led1, HIGH);
        delay(200);
        digitalWrite(led1, LOW);
    }
    else 
    {   
        digitalWrite(led1, LOW);
    }


    if (btnState2 == LOW)
    {
        digitalWrite(led2, HIGH);
    delay(200);
    digitalWrite(led2, LOW);
    zipcode = zipcode + myConcat(d1_4, digit5);


        which_digit = which_digit + 1;
    }
    else 
    {   
        digitalWrite(led2, LOW);
    }


}

if (which_digit == 4)
{
    if (btnState1==LOW)
    {
        digit4 = digit4 + 1;
        digitalWrite(led1, HIGH);
        delay(200);
        digitalWrite(led1, LOW);
    }
    else 
    {   
        digitalWrite(led1, LOW);
    }


    if (btnState2 == LOW)
    {
        digitalWrite(led2, HIGH);
    delay(200);
    digitalWrite(led2, LOW);
    d1_4 = d1_4 + myConcat(d1_3, digit4);
    
        which_digit = which_digit + 1;
    }
    else 
    {   
        digitalWrite(led2, LOW);
    }
}
    
if (which_digit == 3)
{
    if (btnState1 == LOW)
    {
        digit3 = digit3 + 1;
        digitalWrite(led1, HIGH);
    delay(200);
    digitalWrite(led1, LOW);
    }
    else 
    {
        digitalWrite(led1, LOW);
    }


    if (btnState2 == LOW)
    {
        digitalWrite(led2, HIGH);
    delay(200);
    digitalWrite(led2, LOW);
    d1_3 = d1_3 + myConcat(digit1_2, digit3);
        which_digit = which_digit + 1;
    }
    else 
    {   
        digitalWrite(led2, LOW);
    }


}


}



The above code was run in a Particle Web IDE and flashed to the argon.


Button System

The two buttons were utilized to input zip codes into the project. All Chicago zip codes start with '60' so those digits were automatically set to be the first two digits of the zip code. Pressing the first button (the one closer to the argon) adds 1 to the value of the zip code's third digit. This process repeats until the second button is pressed. Pressing the second button then switches the digit that is being incremented so that the third, fourth, and fifth digits can all be input.

For example you would input the zip code 60625 by pressing the:

1st button 6 times

2nd button once

1st button 2 times

2nd button once

1st button 5 times

2nd button once

Once the zip code was complete it was compared to all of the recognized zip codes. The light corresponding to that zip code / neighborhood would subsequently turn green.

Map Set Up

unnamed (1).jpg
unnamed (1).jpg

The Chicago neighborhood map was printed, cut, and glued onto a 24 x 22 cm box. 1 x 1 cm holes were cut in each neighborhood to fit a NeoPixel light. A hole was cut out of the side of the box to allow the NeoPixel lights to connect to the argon.

NeoPixel Set Up

unnamed (3).jpg
unnamed (2).jpg

9 NeoPixel lights were soldered together with sufficient connecting wire to ensure they reached the cut out in each neighborhood. Superglue was added on top of the soldered connections to reduce the chance of breakage. The NeoPixel lights were then taped into the map cut outs.

Finished!

You should now be able to input any Chicago zip code and have the corresponding neighborhood light up. Click this video to see the complete project functioning.