Smart Air Conditioning with Machine Learning & IoT – Preview – Technology

It took just 2 weeks to design and develop the system, and, commission it – from idea to reality – wow! such has become the pace at which technology can deliver if chosen correctly. Around 35+ technologies blend together to produce the stacks needed to implement the idea (which I wrote about a few weeks ago), as shown in the following map

collage

The system is still learning since it has been up for 2 days at the time this article is being written, but, it looks promising so far. I will share more about the performance, evaluation and criteria for judgement in a follow up article, however, in this article I’ll just talk about the technologies used and how they map to the original idea, as given below.

Untitled Diagram (3)

Services Layer

lt-services-stack.png

The Services Stack (given above) is divided into 4 docker containers

  1. Nodered
  2. MQTT
  3. MongoDB
  4. Machine Learning

Containers 1 to 3 are linked and form part of the same network, container 4 is run independently to leverage the computational capabilities of native architectures where available. Because of containerization the services can be run on BlueMix, Azure, Amazon or anywhere else in a matter of minutes.

The crux of the application logic is contained in the NodeRed container and with exception to a few dozen lines of JavaScript I hardly programmed anything there. The graph processing power of NodeRed is unmatched which comes with the possibility of extension and dynamic re-configuration, a preview of such a graph made as part of the implementation is given below, I’ll be following up with another article explaining the graphs later.

node-red-preview-graph

Mobile Control App

composite.png

User control app was made using Ionic V2 which is a cross platform mobile app development framework and utilizes Cordova, AngularJS, Sass and other libraries.

The app has just the following functions,

  • Switch on
  • Switch off
  • Temperature up
  • Temperature Down

and, specification of the rest api end-point on a settings page (not shown above). The user must use the app in order to control the air conditioner to let the system record user’s preference and learn from it later on. As a by-product, this allows the user to control the air conditioning unit from any where in the world.

Hardware Layer

On the hardware end, all sensors were built using ESP8266 platform as the base, again, I’ll follow up with an article on each of these – a preview of each is given below.

20171223_104417

From left to right, IR Blaster (for relaying mobile app commands to A/C), PIR sensor & DHT sensor.

Finally, the accumulation of sensor data as plotted on a graph with 2 days of ML.

SENSORS-WITH-AI

Stay tuned. Detailed articles on each topic to follow.

Project Management with JIRA Tip 4 – Extended Issue Statistics

A tricky aspect of using JIRA is determining instantly how much work from the assigned list of tasks to someone has been completed, or, what state is it presently in.

The “Extended Issue Statistics gadget” simplifies this by

  1. Listing assignee for the issues
  2. Dividing work to be done into, Incomplete, Completed, Overdue & Risk Overdue
  3. Displaying number of tasks in each category (incomplete, completed…)
  4. Showing the percentage of work in each category (incomplete, completed…)

This way you can instantly know who is doing what in your team and get early indicators on any tasks that are in the risk of being overdue allowing you to take necessary actions for rectification and resolution.

extended_issue_statistics

Project Management with JIRA Tip 3 – Components with least amount of work done

Have a hard time figuring out what components require most attention? Using this gadget you can find out in an instant.

component_unfinished_tasks

For each component of the project, the number of unfinished tasks are listed alongside what percentage they contribute towards the total unfinished tasks (rounded up) for the project lead to make important decisions such as effort allocation on areas that require most attention.

The key to getting updated and correct information is to ensure your team logs their work religiously.

The source code to the plugins (tested working with JIRA 6.3.1) is available at the following github repository under Apache2 License for anyone to use

https://github.com/faisalthaheem/cs-jira-gadgets

Project Management with JIRA – Tip 2 – Efficiently Managing Resources

In my earlier post on created vs resolved charts in JIRA I talked about the significance of those graphs to determine the pace of work being delivered and how to keep your teams busy.

What that graph doesn’t tell you is how busy someone is in the team. While Farhan (fictitious character) may be overloaded with work, Awais (fictitious character) may be enjoying a sunny day.

JIRA has a built in pie-chart you can use to display a lot of information, for instance, the following chart showing how much tasks are assigned to whom

jira-pie-chart-assignees

What these charts do not show you is how much time each resource has planned over all of these tasks, and certainly not across all the assigned tasks across all the projects.

This is where the gadet “Resource Utilization Matrix” comes in handy. Take a look at the information presented by the gadget below

resource_utilization_matrix

The user column lists users which were earlier selected as part of configuring the gadet and the next column “Asiggend / (w/o) Estimates” list the number of tasks each user has assigned to them and how many from those assigned tasks the user has yet to update an estimate about.

(Whether the users (developers, quality assures, project managers etc) should be empowered to update the estimates of the task themselves or the project manager does it for them is lengthy debate and depends on the type of culture in your organization, however, I prefer to encourage my team to come up with estimates (agile or not) and then validate those with them individually whenever required.)

Back to the gadget.. the second column showing number of tasks and those without estimates is important as it lets the project lead to pursue the team to fill in their estimates against the assigned tasks without which there would be no visibility over who’s busy to what extent.

Once there is sufficiently adequate data available, the results begin to show in form of resource engagement over the next few days allowing the decision makers to evenly distribute work to the resources.

resource_utilization_matrix_3

Hovering the mouse over shown hours displays a tooltip listing all the tasks over which the hours were calculated. Similarly, to find which tasks have undefined estimates, a simple mouse hover displays the list, as shown below

resource_utilization_matrix_2

The source code to the plugins (tested working with JIRA 6.3.1) is available at the following github repository under Apache2 License for anyone to use

https://github.com/faisalthaheem/cs-jira-gadgets

Project Management with JIRA Tip 1 – Created vs Resolved Charts

Keep your team occupied, don’t let them get bored. Said easier than done? if you have ever managed a large team you would know what I mean.

Beyond a certain number of people in your team it becomes a difficult task to track activities, particularly to know how much work is coming in and how much work is getting done.

The situation is further complicated if you are managing multiple projects. A good and efficient way to keep an eye on what’s going on is through the “Created vs Resolved” charts in JIRA dashboards.

keeping_the_team_busy

There are two graphs in the above image, an average showing the activity volume represented by the smaller blue line at the bottom and a detailed showing created and (with red and green lines respectively) resolved at the top.

Between January and Nov the team kept up with the assigned tasks, meeting the deadlines and delivering work. This was due to the nature of work assigned, mostly automation of functional test cases using Selenium.

However as soon as the next release came up, the tasks got bigger and complex, and the team started lagging behind in deliveries as can be seen between Nov and Jan 2017.

These charts can provide invaluable in-depth information on the work done if used correctly.

Machine Learning & IoT Smart & Green Living – system to adapt to air conditioning requirements with Artificial Intelligence – Initial Thoughts.

A standard nest thermostat device can cost around $250, I am going to create a cheaper version that can be run on a mini computer such as a pi variant or a regular laptop/desktop computer.

Overall the system will consist of sensors which will gather data on ambient light, temperature, humidity, human presence (via PIR) and finally an IR emitter diode that will relay commands issued from the mobile app to the Air Conditioner.

In addition to the hardware based sensors, geo-fencing information from the mobile app will be used to determine whether the user(s) is home, or about to get home. All of this data will provide our machine learning with hints on when and how to control the A/C.

ESP8266-01 is the sensor of choice which will provide connectivity to the mqtt broker and host/control other attached sensors, it’s small, it’s powerful and it’s unbeatable when it comes to price. I’ll be listing the parts used once the project starts to take shape, in case you would want to build one for yourself. Ideas, feature requests are welcome.

Stay tuned. There’s much more to come 🙂

Obtaining a Pet Import License in Qatar

A Pet import license is required if you want to import your pet into Qatar. It’s free of cost; if you’re in Qatar, you do not need to pay any money to “agents”. Simply go to the Ministry of Municipality & Environment and apply for the permit. It takes 15 minutes, be there early around 7 am and take along the following documents

  1. Copy of your Qatar Id
  2. Copy of Valid Health Certificate for each pet issued by a government licensed vet in your country
  3. Copies of immunization/vaccination cards mentioning tracking id and administered vaccines for each pet.

#IoT – $10 – Realtime monitoring of power consumption with ESP8266 (ESP-01)

Instead of wondering you’d be surprised to know how much power is being consumed in your house by different devices. This project was aimed exactly at that while keeping the budget under $10 and using an ESP-01 module to accomplish the same internet is littered with about doing with an Arduino.

 

Testing Theory with Arduino

Initial testing was conducted using an Arduino and the popularly available emonlib however instead of creating the recommended circuit to work with Arduino comprising of voltage divider feeding into the 10 bit built in Arduino ADC an external 16 bit ADC (ADS 1115) was used.

ADS 1115 16-bit Analog to Digital Converter

A

Using the ADS 1115 mean being able to observe more changes in the voltage. With 3.3 V as the reference and 16 bit resolution of the converted, the minimal voltage that could be observed is 0.1 mV which translates into around 300 mA of current in the primary winding of the CT transformer.

100A Clamp Sensor

Since there are not many projects based on ESP 01 for energy monitoring indexed by google at the moment emonlib was of little help and as such calculations targeting the used hardware were derived and used in the project.

The end result is having the ESP 01 sampling 1500 peak to peak cycles of the AC waveform and transmitting the instantaneous power to the Brain (an open source IoT platform for home automation) which also hosts mosquitto MQTT broker and is consumed by the IoT Remote mobile app for presentation. Work is in progress on storing the instantaneous power (in watts) and using it to estimate the electricity charges on demand basis.

IoT Remote Mobile App

Orange PI Lite – the $12 quad core PC

Running strong and steady after 7 days this little piece of hardware is impressive for the price tag of just $12!

orangepi_lite_detail1

Here’s the output from the console upon logging via SSH after 7 days. The board is running armbian and hosting the IoT Home project which focuses on home automation by facilitating with scheduling jobs among other things.

orange_pi_lite

Compared to Raspberry PI this board is certainly worth the money, although heat sinks are required which do not ship with the board.

So far I have had no performance or stability issues with the board although it did take some effort to get the wifi working – it does not follow the standard practice of adding the wifi details to your network file.

The board did get hot in the beginning while it was being setup raising the temperatures to above 50C however after installing a heat sink it started to behave well. If you intend to use it for computationally complex programs I would recommend installing a cooler fan to keep the heat low.

How to use ESP-01 (esp8266) programmer from China

If you’ve bought one of the following you’ll discover it doesn’t do the job it was made for right out of the box (unless you have the one with a jumper near the female header)

These programmers are cheap and handy, you can buy one at

 http://s.aliexpress.com/aU3euu67 

The solution is easy. Just short the gnd and dio0 pins. Plug in the programmer with ESP 01 mounted and you are ready to flash.