Urban Sensing Networks using Arduino




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.
Sensing Networks




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!!

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/)

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/)

Step 2:

Getting Started:
Links below include Step-by-step instructions for setting up and connecting the Arduino and Processing software as well as imported third- party libraries. For installation click on the relevent platform:

Processing:
http://processing.org/download/

Arduino :
http://arduino.cc/en/Guide/HomePage

Third Party Libraries:
Download libraries and place within the “libraries” folder of your processing and Arduino sketch book.
https://github.com/adafruit/DHT-sensor-library (DHT)
http://www.eeml.org/library/ (EEML)

Step 3:

Diagram:

Sensing Networks Schematic

– The generated diagram guides you through circuit building to include DHT sensor and photocell.

Major Components in Project

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)

For more detail: Urban Sensing Networks using Arduino




Clip to Evernote

Leave a Comment

(Spamcheck Enabled)

Read previous post:
FINAL Touch sensor with arduino
FINAL Touch sensor with arduino

The tutorials we used. http://www.instructables.com/id/Touche-for-Arduino-Advanced-touch-sensing/?ALLSTEPS http://www.instructables.com/id/Calm-Relaxed-Interaction-Plant-Plus-1/?ALLSTEPS Download arduino software and the processing software. From their respective websites. Processing.org arduino.cc  ...

Close
Scroll to top