Monday, September 19, 2016

ESP8266 IoT project

LED State Control IoT Case Study

Aim

IoT project to control sensors via Internet. Project included development of User Interface/ Server Scripting and Electronics control. ESP8266 WiFi Micro controller was used to interact with sensors and connect to internet. User Interface was developed in AngularJS , Server side and API was developed in PHP with MYSQL.






Project Overview

User can control the state of the LED ( on and off) and RBG LED Color Control from the Website. Color selector is used to pass RGB values. ESP8266 is reading values from API, parsing it and then controller the LEDs.



Development Environment

       Arduino       AngularJS       Atom            


  1. User Interface - AngularJS provides easy data binding while performing API call backs, this reactive feature was very useful in passing user inputs to server while keeping the page responsive. Bootstrap was used for page design and formatting.
  2. Server Scripting - PHP provides an awesome environment to test out and deploy code. Wamp stack was used for development and GIT was used to deploy code to production environment. PHP was used to store values in MYSQL passed by AngularJS and create API which is consumed by ESP8266.
  3. Development IDE- Atom is an tool, its power to look simple yet provide rich features makes it an ideal lightweight development environment. Arduino is used for microcontroller programming.


Programming 
Architecture

User Interface consist of two input controls 
  1. Button to control LED switch state on and off
  2. Color selector to choose color. 
Change of state is send as a POST request to PHP which stores these values in MYSQL database. 

API - API is developed which when invoked will pass integer values , 10 Digit 1st digit a 0 or 1 for LED State on and off. Rest 9 Digits are RGB values , which can be parsed to pass to the sensor. 

Arduino sketch - connects to the internet then calls the API every 10 seconds ( this lag will take into account DB/ Network Lags) a smaller lag might make it hard to see the result if data is changed continuously. Upon successful receipt of the values, sensor state are switched. 



Electronics


      

ESP8266 - This is a WiFi chip with full TCP/IP stack and has microcontroller capability built in , so this does not require an additional microcontroller to control sensor. From the same board we can access internet and control ( read and write) sensors. This makes it ideal for IoT projects, voltage requirement is around 3.3V. nodeMCU ( lua programing) or Arduino firmware can be flahsed onto it. My experience with Arduino is good so I choose Arduino firmware. Program is simple its connecting to the internet to read API output and change Sensor state.


Lesson Learnt
  1. Code was also implemented to do a callback to read back database stored value( same api could be use for same purpose), this was rejected as multiple users could change LED state and hence page will never show the exact state of the values. This code was removed from the production version.
  2. A lot of time went into controller color of the RGB LED. I had an anode LED and I was not aware of it so programming it using cathode circuit consumed a lot of time. Always ensure the specs of hardware at hand.

Tuesday, December 29, 2015

Lamy Pen Modelling

3d model of one of the finest fountain pen out there Lamy




Friday, December 18, 2015

Managers and Developers

Small cartoon on IT :) Enjoy !!




Monday, October 19, 2015

Firing up digital painting

Starting with the new tablet and digital painting. 


Thursday, September 24, 2015

Plums

3d Plums...

Scculptris + Blender


Practice Session

A cigar smoking bust :)

Model , Texture and Render in Blender.

Test Renders


Final Render