Instructables

Urban Sensing Networks

Picture of Urban Sensing Networks
           

Often government data sets available to us online are taken from major nearby metropolitan areas or infrastructural centers. With an easy to follow introduction to new softwares and technologies the "urban sensor kit" allows anyone to obtain location specific information and share that information with a growing community of designers, researchers, and many others. This urban sensor kit is designed to create a user controlled community that, together will be able to form a large global network towards the future sustainable urban and architectural design.This Instructable is aimed to help you create your own "urban sensor kit" that will be able to collect, record, and share accurate and up-to-date locational information, creating the most precise and site specific data sets available.
  

 This project will allow you to hook up your own humidity, temperature and photocell sensor at home to host a webpage shared between the rest of the network. The webpage contains stored data collected from each user and displays information on sensor's history and activity in graph forms in a Pachube feed. Now you too can contribute towards our urban network!!
 
Remove these adsRemove these ads by Signing Up

Step 1:

Picture of
Hardware:

- Arduino Uno
http://www.sparkfun.com/products/10356
- 6' USB A to B cable
http://www.sparkfun.com/products/512
- Miniature breadboard
http://www.sparkfun.com/products/137
- Male to Male jumper wires
http://www.sparkfun.com/products/9387
- Photocell
http://www.sparkfun.com/products/9088
- Humidity and Temperature Sensor
http://www.sparkfun.com/products/10167
- 330 Ohm Resistors
http://www.sparkfun.com/products/10465
- 10k Ohm Resistors
http://www.sparkfun.com/products/10466



Software:

1- Processing
http://(http://processing.org/)
2- Arduino
http://(http://www.arduino.cc/)


Third Part Libraries:

3- DHT(Arduino)
http://www.ladyada.net/learn/sensors/dht.html
4- EEML(Processing)
5-Urban Sensing Code (Copy Paste into IDE)

Arduino Code:

// Sensor sketch based on ladyada DHT (http://www.ladyada.net/learn/sensors/dht.html) and Photocell (http://www.ladyada.net/learn/sensors/cds.html) code samples
// DHT library Written by ladyada (https://github.com/adafruit/DHT-sensor-library)

#include "DHT.h"

#define DHTPIN 2     // what pin we're connected to

#define DHTTYPE DHT22   // DHT 22  (AM2302)

int photocellPin = 0;
int photocellReading;

// Connect pin 1 (on the left) of the sensor to +5V
// Connect pin 2 of the sensor to whatever your DHTPIN is
// Connect pin 4 (on the right) of the sensor to GROUND
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor

DHT dht(DHTPIN, DHTTYPE);

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

void loop() {
  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  float h = dht.readHumidity();
  float t = dht.readTemperature();
 
  photocellReading = analogRead(photocellPin);

  // check if returns are valid, if they are NaN (not a number) then something went wrong!
  if (isnan(t) || isnan(h)) {
    Serial.println("Failed to read from DHT");
  } else {
    Serial.print(h); //humidity
    Serial.print(",");
    Serial.print(t); //temperature
    Serial.print(",");
    Serial.println(photocellReading);//photocell
  }
}


Processing Code:

import processing.serial.*;
import eeml.*;

Serial myPort;
String inString;
String inString0;
String inString1;
String inString2;
String list;
int lf=10;

DataOut dOut;
float lastUpdate;

void setup(){
  myPort = new Serial(this, Serial.list()[0],9600); 
  myPort.bufferUntil(lf);
  // set up DataOut object; requires URL of the EEML you are updating, and your Pachube API key  
    dOut = new DataOut(this, "YOUR SENSOR FEED HERE e.g (https://api.pachube.com/v2/feeds/39533.xml)", "YOUR API KEY HERE");  

    //  and add and tag a datastream   
    dOut.addData(0,"humidity");
    //  and add and tag a datastream   
    dOut.addData(1,"temperature");
     //  and add and tag a datastream   
    dOut.addData(2,"photocell");
     //  and add and tag a datastream   
}

void draw()
{
    // update once every 5 seconds (could also be e.g. every mouseClick)
    if ((millis() - lastUpdate) > 5000){
        println("ready to POST: ");
        dOut.update(0, inString0); // update the datastream
        dOut.update(1, inString1); // update the datastream
        dOut.update(2, inString2); // update the datastream
        int response = dOut.updatePachube(); // updatePachube() updates by an authenticated PUT HTTP request
        println(response); // should be 200 if successful; 401 if unauthorized; 404 if feed doesn't exist
        lastUpdate = millis();
    }  
}

void serialEvent(Serial p){
  inString = (myPort.readString());
  String[] list = split(inString, ',');
  inString0 = list[0];
  inString1 = list[1];
  inString2 = list[2];
}


Services:

- Pachube Account
http://(http://www.pachube.com/)
Well done. urban sensing network is still just a weather station to me.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!