I spent 2 months reading trends by tinkerers on the Internet - and aligning these to projects I envisaged at home, before I selected what I used to speed up my prototyping. You might not end up to use the same products I did, as you might have different goals, and have different experiences. But, I will save you 2 months of product selection if you follow what I have done, and your reasoning follows similar patterns....

1) My skills starting point. I think my previous skills and exposure to tinkerer technologies (or the lack there-of) played an important role in the products I selected. Here is my journey. I have played with Linux O/S's for many years, can help myself on the command line, if Google is near.... I have never touched Arduino's or RaspberryPi's before. I can help myself in a database, table design, and building queries to extract data from databases.

2) I wanted to do it cheaply - dirt cheaply.  I live in South Africa, in a time where the exchange rate took a 25% drop end of 2015, at 15:1 USD to ZAR. When I started investigating the components I needed early 2016, I looked into Arduino, which I only heard of vaguely before. I started investigating the wireless communication options to let Arduinos talk to one another. I found that the whole commercial home automation market is built on competing standards NRF24L01, Z-Wave and Zigbee. But in pricing an Arduino and a Zigbee wireless 'hat' - the total price for one device combo was R1650 !!! this was not going to work, if I wanted to switch on and off many things in my home, this was too steep. And this price is excluding a hub and controller that is able to work on the frequency (868 MHz - 2.4GHz). Another R1600! This kicked me into a cycle to find alternatives, I was not going to give up on my new hobby.

3) My list of projects to learn from. I drew up a list of projects I wanted to do, aligned with what I wanted to learn, and jotted down what I wanted each to do, without thinking about what technology would achieve that. For instance: "measure outside temperature, and temperature of geyser water, and how much warm water is consumed, plus the kilo joules required to warm-up the water, and the costs there-of. Then, run analytics on collected info over months, and try to determine smart patterns to switch the geyser on and off, to save money. Lastly, find a fun-way to present live information to the family to encourage them to save money on electricity, water, etc.". I also added other project ideas, or 'use cases' over time.

Components I am currently using, and are on my short list.

After many weeks of reading, I ended up with the products in the schematic at the start of this blog entry.

1) The micro-controller, measuring data from sensors, and actuating relays. Arduino was too expensive, it needed a separate hat to enable wireless comms. I got to learn of a magic micro-controller and a great communities making it work, of a chip the Chinese published complete 'left-field' at the end of 2014, and blew away the Arduino an micro controller community. Enter theESP8266 chip. A micro-controller, running at 80MHz - 160MHz, with flashable RAM from 512k to 4 MB, with a standard 802.11 x wireless interface, that will connect to your standard wireless network at home! Not as robust as the Zigbee and Z-Wave tech, with abilities to do mesh networking, and as it can operate on lower frequencies - can penetrate walls better, but AT A PRICE of 2-7 USD !!! (If you buy locally, x 3 ... 8-( Shown below is an ESP-01, and an ESP-12E.

2) Sensors. I was amazed to see what sensors you get, and how cheap they are. From alcohol breath analysers, to RFID tags, and for cheap. I ordered some on eBay, most I got from robotics.org.za, with very capable engineers that are tinkerers themselves, and able to help. I bought a tipping bucket rain sensor, assortments of temp an humidity sensors, water flow, relays, sonic distance meters, and hall-effect Amp meters, that can feed the micro-controller ESP8266 mostly with digital data, I2C, and able to receive analog data, for the odd sensor requiring this still.

3) Bread boards, wiring, soldering iron, resistors, capacitors, etc. Bought an assortment of these over time, an amp / volt meter, and BUY a GOOD SOLDERING IRON the first time! It will save you many nights of frustration, and watch youtube for how to solder properly !!!!

4) Micro-controller code ? Now I needed to make the micro-controller read the different sensors, and send the data somewhere? But how? the ESP8266 can run C, micro-Python (none of which I new), and a promising scripting language called Lua, A 'fast, light weight, scripting language' created in Rio as far back as 1993. I downloaded it, and loved it. It comes with open source software that you can upload the scripts on the micro-controller, and lots of sample code to for instance make the temperature and humidity sensors work, and send the data to for instance a 'socket'. I got it to work, but I needed something faster, where I do not have to so much get involved coding the micro-controller. I then found www.PlatformIO.org, MySensor.org, and ESPEasy. I fell in love with the community on ESPEasy, how fast they were moving, and the fact that their solution puts a small web server on the ESP8266, with small web pages to configure the attached sensors, have rules, and where the collected data is sent.

5) What about the Messages? The micro-controllers reads the sensors, and send them somewhere for storage, analysis, and action. But where, and how ??? After weeks of reading, I settled on a home controller, that can run on a RasperryPi, called Openhab. They have a very active community, making quick changes, and support many many protocols etc. One way they can work with messages between devices - are with MQTT.  A 'machine-to-machine (M2M) / "Internet of Things" connectivity protocol', originally named Message Queueing for Telemetry Transport. Built in IBM, of which the specs were given to the open source community. IBM has it built into most of their products, but the open source community built several servers, I picked mosquitto.org  on the RaspberryPi, that is a broker to the messages, much like a post office, that receives messages, and dispatches them to those 'subscribing' to the topics of the messages, on a 'store-and forward' way.

6) Where does the data then go, and what do I want to do with it? The first thing that comes to mind - draw graphs. I found many tinkerers uses Thingspeak, I use this, and are busy investigating others, like Freeboard. I do some nice graphs, but soon realised I need more control over the data. The nice thing about Thingspeak, is it has an analytics engine, using the language "R" - I will still use it. I soon afterwards added a MySQL database server to my RaspberryPi, and now have lots of data available to work with. See a live graph of my outside temperature, the last 60 measurements, from Thingspeak.

7) Node-Red. I still had the plan to use OpenHab controller, but the more I read up about MQTT, the more I bumped into Node-Red, built by the same IBM developers that built MQTT, and also gave a copy to the open source community to tinker with, and also able to run on RaspberryPi. I installed it, this sped up my scripting of rules etc I wanted, so many capabilities on it, downloadable "nodes", that one visually link-up, and add bits of Javascript code in each node to manipulate the in-flight data. I am having so much fun with Node-Red, that I cannot see when I will get to OpenHab! Below a screen-shot of my Node-Red visual config for receiving the MQTT messages  from ESP8266 devices, via the Mosquitto broker, then posting the data to Thinspeak, and storing it in MySQL, and out to phones as mini-web pages for the family.

8) The 'hub' - running on a RaspberryPi 2. The heart of the home is a RasPi, I installed it "headless", no screen, I access it with  the command line through SSH. What an amazing team, delivering world-wide education to all corners of the earth, a small group of motivated people with the vision to teach computers to kids. I listen to podcasts of this community, the marketing director did not take salary for the first 3 years of her career with them. They planned on selling 10,000 products 4 years ago, in total, and are now selling 55,000 units per week!!!! I love my RasPi. I bought the Raspberry Pi 2 Model B on a Friday. It does not have wireless on board, I hooked it up with Ethernet to my hub, and on the following Monday, for the same price the Pi 3 was released, faster, and with wireless and bluetooth on board...... (Shopping is going to have to be done soon....)

Next post - what I have achieved so far. As sneak-peak, see the mobile screen on temperature, how much hot water were consumed, and the ability to override the geyser on/off switch. I will tell you how the family received this, and what I learnt, and envisage out future to look like. (And the construction of this mobile page took me 10min on Node-Red, after the 2-3 days to find out how to do it.....)

`

(Originally posted on 7 May 2016 on Blogspot)