Introduction: Smart City Plugin (Intel IoT)
Smart City plugin is a small, cost effective and easily installable plugin to make city infrastructure IoT enabled.
Infrastructure capable of monitoring and finding bottleneck information in its surroundings supports “SMART CITY” vision of Government of India.
Digitally stored information about city infrastructure to support “DIGITAL INDIA” initiative of Government of India.
Smart City Plugin has a small form factor and can be attached to any container/surface without major changes making it easy plugin solution.
Smart City Plugin will help in monitoring following infrastructure in cities:
1. Garbage collection issues in cities
2. Sewage Management in cities
3. Warehouse management
1. Water management in societies
1. Smart groceries management
This plugin uses sensing and inbuilt wi-fi capabilities of the Edison board to connect to cloud.
Smart City plugin is cloud enabled solution which helps in remote monitoring, alerting and decision making. Smart City Plugin android app helps in mobile monitoring and alerting on-the-go.
Step 1: Board Setup
This is a simple DIY project that can help anyone with kick starting learning with Intel Edison board.
You need an Intel Edison chip along with Arduino expansion board for sensor interface and cloud connectivity.
For details on how to setup your Edison board check out this blog
After physical setup, flashing and software installations are done you are ready for hands on with your Edison.
Next step for Smart City Plugin is to connect sensors and configure Edison for data publishing to cloud.
Check step 3 for details on sensor integration and network connectivity....
Step 2: Hardware and Softwares Used
Hardware and sensor's used:
1. Intel Edison board.
2. Ultrasonic sensor (HC-SR04)
1. Node.js (Intel XDK IDE) for Cloud connectivity
2. Arduino IDE for sensor detection
3. Eclipse IDE for Android application development
4. IBM Bluemix PaaS cloud
5. MQTT protocol for communication
6. Express, jQuery, Rickshaw for visualization
Step 3: Sensor Integration
Smart City Plugin uses Ultrasonic sensor (HC-SR04) for level detection.
This sensor can be used on variety of materials for sensing the levels such as water, solid waste, grains, etc.
You can buy this sensor at Amazon
This sensor has a Trigger pin and Echo pin along with VCC and Ground pins.
You need to make Trigger pin high which generates a sound wave and check Echo pin for the sound wave echoed back from surface. The time between Trigger pin High and Eco Pin high is used for calculating the distance.
We've used Arduino library function pulseIn() for getting the level details.
You need to flash the sensor integration code using Arduino IDE.
Code snippet for Sensor integration:
//Trigger the ultrasonic sensor to send pulse
delayMicroseconds(10); digitalWrite(box->trig, LOW);
//after getting echo record the time for which echo pin was high
duration = pulseIn(box->echo, HIGH);
// convert the time into a distance cm = microsecondsToCentimeters(duration);
Github link for Sensor integration code:
Edison sensor+MQTT client: https://github.com/samelamit/SmartCity_EdisonCode
Step 4: Cloud Connectivity
Smart City Plugin uses MQTT protocol to connect Intel Edison board to the cloud based MQTT broker.
We have used node.js code for MQTT connectivity.
We had to include code for sending Arduino sensor data to node.js module for Publishing it to MQTT broker.
GPIO pin 6 and 7 were used for indicating mode.js about sensor data availability.
Node.js module then reads the data from a file and publishes it to MQTT broker.
We've IBM Bluemix cloud as MQTT broker for which we need to register the device on IBM Bluemix and get the Organization Id, Device ID and Topic information for the Intel Edison board.
Complete code for Cloud connectivity an be found here (Refer EdisonBlueMixNode.xdk)
We used Intel XDK for flashing node.js code to Intel Edison.
Thus we have used both Arduino IDE (for Sensor integration) and Intel XDK IDE (for Cloud connectivity).
Both the binary files reside on Edison board in different folders and thus work without issue.
Step 5: Android Application
Smart City Plugin has an Android based application for viewing the sensor data remotely.
Android application was developed using IBMBluemix cloud api's.
This application connects to IBMBlueMix MQTT broker as a MQTT subscriber.
Similar to Edison code, we need to provide Org Id, and Topic for Mobile app.
This application can be customized for various scenarios, such as for garbage management we can show heat map of city 's garbage cleaning.
For grocery management we can show grocery levels at home and connect to e-commerce sites for ordder placement.
Complete code for Android application can be downloaded from:
Step 6: Smart City Plugin Home Use Case : Smart Grocery Manager
1. Attache the Smart City plugin inside the grocery box.
2. Configure and connect Smart City Plugin to your wi-fi network.
3. Plugin will start collecting the quantity details of the item to be monitored.
4. Plugin will publish measurements to cloud based broker.
5. Smart City Mobile application will be used to track the levels.
6. Mobile application will also send push alerts for depleting groceries.
7. You can replenish the groceries by placing the order online through application.
kulkris made it!