Urban Sensing Networks using Arduino

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


– Arduino Uno
– 6′ USB A to B cable
– Miniature breadboard
– Male to Male jumper wires
– Photocell
– Humidity and Temperature Sensor
– 330 Ohm Resistors
– 10k Ohm Resistors


1- Processing
2- Arduino

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


void setup() {

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(t); //temperature

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);
// 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
//  and add and tag a datastream
//  and add and tag a datastream
//  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];


– Pachube Account

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:


Arduino :

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:


Sensing Networks Schematic


Read more: Urban Sensing Networks using Arduino

Leave a Comment

Your email address will not be published. Required fields are marked *