Friday, May 6, 2016

Final Notes

It's going to be my last notes for this course and to Professor Paul Schragger too :)

From the bottom of my heart, I would like to thank two persons. One, Professor Paul Schragger, for building a perfect experience of a complete self-learned practical curriculum to 'Internet Of Things' course and made me think, research, exhibit and expose my hidden strengths to the world out there with this blog writing. Two, my friend, Prashanth who helped me right from the selection of this course till the end of the final project and its great experience working with him.

It's like I started this course 'Internet Of Things' just a few days ago. But to reality, it completed Century of days by now. Finally, Hurray! I have successfully completed my Course work after a great effort leaving behind with mixed feeling. This feeling right now I have is unexpressed. At this late hour of the night, I just felt like putting my feelings towards IoT on this blog. It's immaterial for me the grades but the more important is I had a complete set of varied experience in this course which helped me to increase my overall personality both at technical and management skills that need to be present in a person to fight with the world out there.

I would like to recall all the things starting from the selection of course till the end.

It's the start of the second half of my first semester, I need to register to the courses for Spring 2016. I just checked all the available courses and this Course 'Internet Of Things' catches my eye as it included some electronic stuff. I love Electronics and fun playing with IC's, Resistors, Diodes, Circuits. Missed them. It's almost 3 years I even thought of those.
As it's my first time to hear about a course like this, gone through some basic research, collected information from friends regarding the course structure and professor. I would like to thanks Prashanth for encouraging me to take the subject. Initially, I hesitate to take as its hard to balance 3 tough courses. But I took a step and decided I should face it and the battle started with the course registration :)

Then comes the first day of the class. Don't even  know what's will happen in this course. But I was full of excitement that I am going to play with the circuits again :) . The professor named Paul Schragger, really a cool person gave a perfect kickstart of the IoT. It's excited to hear about the kits we are going to use in the coursework. One the Raspberry Pi, and the other Arduino NodeMCU with ESP8266. And the rest of the story you can figure out from my Blog.

This course was really awesome. It's not something the same boring examination patterned course. It's something different, more practical, more self-learning with the Prof. guidance. There are hundreds of things I have learned in this course and its hard to point out all.

I have never thought I would write a blog, never think of my strength in self-learning, research, or in documentation and more. This course helped me in realizing my strengths and weakness, helped me to shape myself both technical and management skills.

Apart from the course work,

1.Attended few sessions on Arduino conducted by Engineering department at Villanova.

2.Participated in Arduino Hackthon dated 4/1,  where we build a project, inspired from an experiment conducted in china. It's about the automatic control of the car which can prevent the car accidents. In this hackathon, we formed a group of 5 persons - me, Prashanth, Sandeep, Jorge, Charan and worked with the Arduino UNO. We built a working Rover which worked based on the control of the accelerometer and predicted the obstacles using the ultrasonic sensor. Also, worked on the MQTT communications of the commands to operate the rover. Plan of the Hackathon:
https://drive.google.com/drive/folders/0B-7OVLV2uzmLMVlnbmlpaWFyZlU
We divided the project into 3 modules, me and charan worked on Rover operation from Arduino:  https://www.sparkfun.com/datasheets/Robotics/Rover%205%20Introduction.pdf 
and then controlling the movement based on the Ultrasonic sensor.


3.Volunteered for the Arduino workshop dated 4/23, but this time playing the role of Teaching Assistant for the 23 Indian students who had attended the Arduino workshop conducted by the Villanova Engineering department. It's really a wonderful experience of playing the role of teacher. In this, I helped the students to understand the Arduino and showed the example programs like LED blink, servo motor operation, LCD display of the Arduino SparkFun kit:  https://www.sparkfun.com/products/12060

And here comes the final Phase of the Course, the Poster Presentation of the final projects. It's really great to see different ideas. Here is the last day Picture captured for memories :)


Finally, the overall experience with IoT was ExtraOrdinary. Signing off - Jyothi.

Wednesday, May 4, 2016

Complete Final Project Report- Smart Blinds

Smart Blinds - A Home Automation Project

Here comes the final documentation of my IoT Project, 'Smart Blinds' - a home automation project.

Introduction:

Internet of Things has been labeled as “the next Industrial Revolution” because of the way it changes the way people live, work, and businesses interact with the world. With the advancement in Technology, we can build our own secure and safe environment. This project ‘Smart Blinds’ that comes with the inspiration of the concept of ‘Green House’ which helps the plants to have a safe environment.


Abstract:
                 The project is about 'Smart Blinds'. The key point here is the opening and closing of the blinds made automatic and which depends on the intensity of the outside light. Also, can analyse the duration of opening and closing of blinds.In this project, I have built my own Home Automation Project for the safety of kids and pets at home when we are away from home. For this, I chose to automate the blinds operation based on the time of the day, temperature and intensity of light.

1.Project Report:

For my project 'Smart Blinds' which is like any other IoT project, I would like to provide a complete detail of the project with explaining all the specifications starting from the high-level overview which gives a picture of what's the project is all about and then down to low-level overview which gives all the minute details of the project so that anyone who will come across the post can do the project all on their own from the data and references I'm going to share about this project.

HighLevel Project Flow Representation


The above diagram shows a High-level idea of the project which is generic to all the 3 modules I have done in this project. Here, the user can manually control the blinds based on the temperature displayed on the Blynk application and then sends the message to the control Signal Processor, in my application Arduino acts as controller which sends signals to the servo motor to rotate the blinds either to open or close them based on the instructions it received and then the position of the blinds is again passed back to the control circuitry for future reference. This is a complete high-level design of the basic functionality in my project.

Project Requirements:

Hardware:

  1. Arduino esp8266
  2. Raspberry Pi 2
  3. BreadBoard
  4. Jumper wired
  5. Photo Resistor
  6. DHT11 sensor
  7. Servo motor
Software:
  1. Blynk app( auth token)
  2. Arduino IDE 
  3. Mosquitto installed in Pi
  4. Mosquitto configuration 
  5. NOde-Red
  6. External URL to connect to Wearther API
  7. Python working on platform 
Arduino Libraries:
  • SPI.h
  • BlynkSimpleEsp8266.h
  • Servo.h
  • ESP8266WiFi.h
  • PubSubClient.h
  • DHT.h
Python Libraries:
All code of my project will be available at this link:

IoT design methodology:

The complete design methodology is defined in a total of eight Specifications.
  1. Purpose and Requirements Specification
  2. Process Specification
  3. Domain Model Specification
  4. IoT Level Specification
Please follow the below link for these specifications of the project:
http://myiotblog.blogspot.com/2016/04/fundemental-parts-of-project.html

       5. Service Specification
       6. Functional View Specification
       7. Operational View Specification
       8. Device and Component Integration

Please follow the below link for these specifications of the project:
http://myiotblog.blogspot.com/2016/04/project-report.html

NOTE : Updated the links with more data than the one previously submitted as part of Assignments.

Architecture:

Blynk Service Integration:
Blynk Service

In this service operation, the user controls the operation of blinds using the Blynk App. Based on the commands from the Blynk application the NodeMCU controls the direction,speed and rotation of the servo motor which will either open or close the blinds. Once done, then this change in the blinds position is recorded and published to the topic 'BlindsPosition' through MQTT protocol to the MQTT server where the Pi acts as the MQTT broker. Simultaneously, a python program is running on Pi which subscribes to the 'BlindsPosition' topic and continuously checks for messages. If any message published to the topic it subscribes and streamed the data to the 'InitialState' Cloud Storage.
There in dashboards are created to constantly monitor the blinds position.



 Weather API Service Integration:
Weather API Service 

In this service operation, the controls of the operation of blinds made automatic which was based on the external climatic conditions. It's based on two factors. one the time of the day and other the temperature. The use case diagram for this as below.

First checks whether its day or night and then checks if the temperature is greater than the threshold.
Based on these conditions the operation of blinds made automatic. The external data is extracted from the open weather API which is secured as it required the authentication key. A python program is coded which is running on Raspberry Pi extracts data from weather API for every 1 minute. It streamed the data to the 'InitialState' Cloud Storage. Also, continuously checks the conditions and if the temperature exceeds the threshold then published to the topic the command 'close' to the topic through MQTT protocol to the MQTT server where the Pi acts as the MQTT broker. Simultaneously, a program is running on NodeMCU which subscribes to the topic and continuously checks for messages. Based on the message it sends the control signals to the motor and then publishes to topic 'BlindsPosition' through MQTT protocol the position of blinds.
There are dashboards also created to constantly monitor the external conditions.


External Climate Parameters Storage Data

2. Project Poster:


Smart Blinds - Final Poster

Results:

Output Results in the InitialState Streaming DashBoard for all the information

This dashboard above will show the line graph details of each of the measurements stored in the cloud. Also, it adds new tiles with the information of the last value of the blind(like 'Open' or 'Close') , Histogram results of blinds position and lastly the pie chart results of the blinds position.
Line Graphs for all the measurements saved in the cloud


Blinds Position data Saved in the cloud and can be extracted as CSV file format

External and Internal Temperature, Humidity readings stored in cloud



The above diagram depicts the UI in the BLYNK app from which the user is able to control the blinds operation. It has new features like a big closet. A User can even set the timer based on which the particular operation is performed. The user will have an option to view the current position, temperature and heatsink of device.

3. Demonstration:







4.Link to Software:

Blynk Software: It is used to interact and communicate with the Arduino to perform control actions so that user can remotely operate the blinds. It provides an interface as a mobile application where the user can give the inputs and can provide commands for the actions to be done. This one is secure as it provides a secure Auth Key for each and every project we created and with this access key only we can communicate securely.
1. We can track the position of the blinds using the display widget- 'Labeled Value'
2. Also, can continuously view the room temperature and the heat sink values which are displayed on the 'LCD display'.
3. Used the 'Menu' Widget to select the actions to either open or close of the blinds.
4. Provided the user with the option to preset the control of blinds at a particular time using the 'Timer' widget.


  1. Blynk Docs : http://docs.blynk.cc/
  2. Blynk Start Guide : http://docs.blynk.cc/#getting-started-getting-started-with-the-blynk-app
  3. Blynk Hardware Setup: http://docs.blynk.cc/#hardware-set-ups
  4. Labeled Value Display: http://docs.blynk.cc/#widgets-displays-labeled-value
  5. LCD Display Widget: http://docs.blynk.cc/#widgets-displays-lcd
  6. Menu Widget: http://docs.blynk.cc/#widgets-other-menu
  7. Timer Widget: http://docs.blynk.cc/#widgets-controllers-timer
Initial State:
http://blog.initialstate.com/category/arduino-2/


Raspberry Pi2:

NodeRed:


Arduino:

ServoMotor:

DHT11 Sensor:

Weather API:

5. Project Sites used in creating the project:
http://www.instructables.com/id/Arduino-controlled-automated-blinds-with-Web-UI/
https://www.hackster.io/cyborg-gibson-11/automated-blinds-by-cortana-7bfaff

6. Future Work and Project Enhancements:
  1. I would like to extend this further by providing SMS or EMAIL notification to the user which would be more helpful for continuous update and notification.
  2. I would like to further extend this work to the predict persons wish of blinds position based on the various factors (temperature, time of day).  
  3. Need to apply linear regression, decision tree using R programming for the predictions.
  4. Also, I would like to the monitor and analyze the health of the crops based on the different climate conditions like the wind, humidity, temperature and varied parameters which affect the plants growth.
  5. I would like to further extend it by handling all the blinds in the home by Integration.
  6. Monitoring the health of plants based on different climate conditions.