Smart City Project Using Arduino

air quality sensor network platform

Open source air quality sensor network platform.air quality sensor network platform

Things used in this project

Hardware components

Arduino MKR1000
Arduino MKR1000
× 1
PMS5003 dust sensor
× 1
Breadboard (generic)
Breadboard (generic)
× 1
Male Header 40 Position 1 Row (0.1")
Male Header 40 Position 1 Row (0.1″)
× 1
SparkFun Snappable Protoboard
SparkFun Snappable Protoboard
× 1

Software apps and online services

Snappy Ubuntu Core
Snappy Ubuntu Core
Arduino IDE
Arduino IDE
Digital Ocean
It’s a hosting service that provides online space for website
Arduino Web Editor
Arduino Web Editor

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)



Arduino MKR1000 Air Quality Sensor

This is connection from Arduino MKR1000 to PMS5003 sensor. It the connector that represents the PMS5003 sensor. Once you connect your Arduino MKR1000 board to the connector(the connector can be made by your-self) and then you just need to connect your PMS5003 sensor to the connector.arduino mkr1000 smart city project

Arduino MKR1000 with PMS5003

This is prototyping of Smart City Project SetSmart City Project Set

Arduino MKR1000 + PMS5003 + proto board PCB

When you want to do DIY your device to join Smart City Project.
img 1033


#include <ArduinoHttpClient.h>
#include <WiFi101.h>
#include <PMS5003.h>
// MKR1000 Pins setup
const int SLEEP_PIN = 6; // this pin is for setting the sensor to sleep while it is not taking the data.
const String uuid = ""; // This is the place where you should put your UUID 

// method setup
const String content_type = "application/x-www-form-urlencoded";// this is for POST method

// Your WiFi setup
String postData ="";
char serverAddress[] = "";// This is the website of Smart City Project
int port = 8080;// port number of the website

// WiFi Login Data
String ssid = "Name of Your Wifi";
String password ="Password of Your Wifi";

// initialize your variable value
PMS5003 pms5003;
String PM1 = "N/A";
String PM2_5 = "N/A";
String PM10 = "N/A";
String temperature = "N/A";
String humadity = "N/A";

// HTTP Connection
WiFiClient wifi;
HttpClient client = HttpClient(wifi, serverAddress, port);
int status = WL_IDLE_STATUS;
String response;
int statusCode = 0;

void setup() 
  Serial.begin(9600); // Serial for serial monitor. If the sensor is successfully sending data to website, this can be comment out
  Serial1.begin(9600);// Serial1 port for PMS5006
  pinMode(SLEEP_PIN,OUTPUT); // Setup Pin 6 as output pin
  digitalWrite(SLEEP_PIN,HIGH); // Let the sensor start working as default
  while(status != WL_CONNECTED) { // start connection
    Serial.print("Attempting to connect to your wifi: " + ssid + "\n");
    // Connect to WPA/WPA2 network
    status = WiFi.begin(ssid, password);
  // print the SSID of the your WiFi
  Serial.print("SSID: ");
  // print your WiFi Module's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");Serial.println(ip);

void loop() {
  Serial.println("PMS5003 Data on Process");
    PM1 = String(pms5003.getPM1(),DEC);
    PM2_5 = String(pms5003.getPM25(),DEC);
    PM10 = String(pms5003.getPM10(),DEC);
    if (PM1 !="-1" && PM2_5 !="-1" && PM10 != "-1"){
  postData ="uuid=" + uuid + "&PM1=" + PM1 + "&PM2_5=" + PM2_5 + "&PM10=" + PM10 + "&Temperature=" + temperature + "&Humadity=" + humadity;
  Serial.println("making POST request");"/",content_type,postData);// the conntent in content_type is for doing POST method.

  statusCode = client.responseStatusCode(); // response code from server
  response = client.responseBody(); // messages that is responed by server

  // Serial Monitor output.(can be comment out when the data is sending to server correctly)
  Serial.print("Status Code: ");Serial.println(statusCode);
  Serial.print("Response: ");Serial.println(response);

Smart City Project

This is the files of PMS5003 library and Sketch of Arduino MKR1000

Leave a Comment

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