Sunday, November 1, 2015

Maker's IoT Kit for ESP8266 (ESP-01)

Maker's IoT Kit for ESP8266 (ESP-01)

the real McCoy PCB milled on LPKF103


Background
Ah, the beloved ESP8266, so many variants, so many choices, so many different pricing points, the one true chip (read: cheap) that offers internet connectivity to the unplugged. but which one is suitable for me? Since ESP8266's inception, with the debut of the ESP-01, a myriad of ESP8266s'have been released. Starting form ESP-01 to the latest addition that sports ESP12E , and finally the WROOM. The debut started with ESP-01 URL http://shin-ajaran.blogspot.co.id/2014/12/noobs-guide-to-esp8266-with-arduino.html, an U$4 (yours truly got it for S$9 from a local vendor back in 2014) full featured ESP8266 but only 2 I/O the GPIO0 and GPIO2 are break out in the form of the DIP pin package. Along the way, ESP7, ESP12, ESP12E, came by. These ESPes' lack of one thing in common to facilitate a maker to rapid prototype an IoT idea: a daughter board that breaks out the I/O (breadboard friendly or otherwise) to control stuff over the internet URL http://shin-ajaran.blogspot.co.id/2015/01/internet-controlled-ac-appliances-with.html , and at the minimum comes with a 3V3 voltage regulator. Finally the holy grail of all ESP, the NodeMCU URL http://shin-ajaran.blogspot.co.id/2015/09/stream-iot-sensor-data-esp8266-nodemcu.html, a full featured ESP8266 ESP12E with 10 I/Os break out conveniently and just need to be plugged on a breakboard to be usable. A standalone NodeMCU is easily USD9 per pop. One might argue the entry pricing point is cheap, but one has to remember the price excludes the accessories. The "shield" for nodeMCU can be as costly as the nodeMCU itself.


Intro
For a maker that wants to bring the prototype built with ESP8266 out of the breadboard environment, into a deployment environment, the said prototype has to be fully robust, and survive a few hard knocks in the "real world". An ESP8266 planted on a breadboard with loads of interconnected wire as if it is a prop straight out of a Hollywood sci-fi bomb is not going to cut it. A (poor) maker is left with not much of a choice but have to solder it on a stripboard, and hopefully the VC will fancy it. IoT enabled devices are on the rage when this come to the economies of scale; A prototype demo during an elevator pitch with a gazillion IoT devices definitely going to pack a heavy punch as compared to a demo with a lone IoT device. oh wait, solder a gazillion prototypes to test out the economics of scale for IoT?!



The Maker's IoT Kit for ESP8266 (ESP-01) has a unique standpoint point in the landscape of ESP8266 enabled IoT devices. It has a very low entry barrier on the technical department. It addresses the total cost of ownership pricing issue with the choice of ESP8266 ESP-01, and the need for a minimum of 1 input and 1 output to be interfaced with sensor & actuator, just to be useful enough to control things over the Internet. Essentially, Maker's IoT Kit is a break out board (BoB) for ESP8266 ESP-01 that fully embrace the design "philosophy" behind ESP-01: Low cost, testing of IoT ideas by rapid prototyping with ESP-01, and deployable en masse. The beauty of Maker's IoT Kit: it address the choice to remain free from obligations & restrictions; there is no tie in to a specific set of I/O board manufacturers. Approx U$2 for ESP-01, U$0.5 for The Maker's IoT Kit, total cost of an IoT device that supports 1 input and 1 output can be as low as U$2.5. Surely any research grant handed to yours truly will enable many many IoT devices to be deployed.

Prior to the release of ArduinoIDE-for-ESP8266, an Arduino Uno or Arduino Mega is needed to piggy back the ESP8266. To the layman, an Arduino IDE is definitely much "friendlier" compared to Writing a custom firmware using espresif SDK on Eclipse. The technical barrier to get started with the SDK is somewhat complex to the naked untrained eye. Ah, and not forgetting the constant swapping the ESP-01 boards between programming mode and prototype testing mode; compiling, and downloading the compiled code to ESP8266 with CP2102, and then transplant IO board to interface with the sensors. In hindsight, the Maker's IoT Kit for ESP8266 (ESP-01) was born out of regenerative iterating prototypes to quickly test out IoT ideas.

Methodology
The design principles of The Maker's IoT Kit for ESP8266 (ESP-01) are listed in the following.

The Maker's IoT Kit is both a programmer board with the use of CP2102 as the USB serial, and also a prototyping board. To change between the programming mode and the prototyping mode is done With the help of a jumper. The PCB is designed as a single layer PCB on purpose, lowering the entry barrier for it to be easily reproduced by any PCB milling machine available in workshops, FabLabs or maker spaces. It coveniently breaks out GPIO0 and GPIO2 for the ESP8266 ESP-01. GPIO2 is used for 3V3 input device, and GPIO0 is used for 3v3 output device. By design, a 5V output is available on GPIO0, and this is done with additional NPN transistor.  Assuming the prototype and source code behaves according to specifications, then the ESP8266 ESP-01 can be left as it is on the Maker's IoT Kit to be deployed in the field and to collect data of interest. Power supply to the prototypes built with ESP8266 has been a constant headache, especially deployed outdoors. This Maker's IoT Kit sports 3 possible inputs for power supply. first the 5V from the CP2102. this mode is only recommended for programming the ESP8266, but not for deployment due to the current required by ESP8266. Next, a 2pin molex pin for power supply from DC adapter. The voltage from DC adapter varies from 5v to 12v, as long as it is within the specs of the LM317 voltage regulator. Lastly, power supply via USB B port, this opens a much wider selection ranging from power banks to mobile phone charger. A diode is added to the USB B port, due to an experience of magic smoke stemming from a bad USB cables powering my precious. no brownie points for guessing where the cables orginated from.

Learning from collective wisdom of ESP8266 enthusiasts, the peculiarity of ESP8266 GPIO0 turning high during bootup is addressed by the NPN transistor.

first iteration

fifth iteration

powered via laptop USB port to CP2102 to down load the program into ESP-01

powered via USB B port connected to powerbank

powered by 4x AA battery connected to 2pin molex pin


use this URL to download the gerber file https://www.dropbox.com/s/hww0v930wmmmrzy/gerber.rar?dl=0

operations
First, download the gerber and mill the Maker's IoT Kit for ESP8266 (ESP-01). Solder the necessary electronic components on the milled PCB w.r.t the schematic posted here. plug in a CP2102, and the ESP-01 on the daughter board, take special precautions on the polarity and orientation of the pin out. Set the jumper "p-mode" to programming mode (short the left and middle pin). Plug the CP2102 end to a computer equipped with Arduino-ESP8266. The steps are quite similar to this guide http://shin-ajaran.blogspot.sg/2015/09/stream-iot-sensor-data-esp8266-nodemcu.html, just take note in the board to be selected is "ESP8266 Generic". compile and download source code to ESP-01.
Once download is completed, unplug from computer; then unplug CP2102 from daughter board. Set the jumper "p-mode" to operation mode (short the right and middle pin), plug in a power supply of choice, and you are good to IoT your way to the cloud.


Observation
So, what to make with it?

for starters yours truly have tested the The Maker's IoT Kit with ESP8266 (ESP-01) with a DS18B20 temperature probe as input, LED as output. The temperature data is sent wirelessly to thingspeak, and the LED simulates the turning on/off of a load in-place of a Solid State Relay (SSR). Yes, as of what you have guessed, yours truly is going to up the ante to build a sous vide that is controllable over the internet via wireless network. In short, the cooking temperature can be changed, monitored and recorded over the Internet during sousvide cooking. Think along the line of you browsing popular sous vide cooking website, and there is a "cook" button next to your favourite dish. Magically, your sous vide meal will be prepared when you are back from work. of course, some devine intervention of acquiring the edibles, packing it into a vacuum bag, and lowering it into a sous vide water bath equipped with ESP01 is required.  An earlier iteration URL http://shin-ajaran.blogspot.co.id/2015/01/iot-streaming-temperature-data-acquired.html 


conclusion
in this post, we only address the hardware part of a ESP8266 enabled IoT devices, and this is hardly half of the entire story told. The parts missing are communication stacks with MQTT, a cloud computing solution to act as the collector and aggregator of data, and of course, the holy grail of all this IoT craze: Predictive analytics from the data collected. An earlier iteration with thingspeak http://shin-ajaran.blogspot.co.id/2015/02/setting-up-iot-server-with-thingspeak.html


nodered on Ubuntu to be used with ESP8266 






code here:



special thanks to my padawans jia yi, william tan, bryan, and etc for strip board, manning the PCB milling machine, sourcing for milling bits and cheap copper boards, and testing.