Home Automation and the Internet of Things – The (re)Start

IoT_Icon

In Part 1 of this series I optimistically expected that the hardware selected was going to be “reasonable pace to start” experimenting and implementing a basic Home Automation system. When I actually started implementing the system one shortcoming became obvious.

What I failed to consider was that the Yunshan ESP8266 WiFi Relays needed a DC power supply, meaning that the control hardware package was going end up altogether too large. This was not going to be useful as the solution for turning things on and off around the home

So back to the drawing board looking for ‘hackable’ hardware to implement my system. I wanted to keep using the ESP Easy firmware, so I started from their web pages to work out what would be a cost effective solution. The site lists a lot of devices, but there was a series of controllers by ITEAD that really looked professional and were ‘ESP Easy’ hackable.

Sonoff Hardware

ITEAD designs and manufactures a large range of electronic hardware, including a family of Smart Home Solutions. The Sonoff smart home series are based on ESP8266 WiFi and can be connected to most major IoT platforms through their own eWeLink application.

Different version of Sonoff hardware different features, but all have the same basic features and all allow remote switching of devices (I assume the product family name is derived from Switch ON OFF) and track devices status.

ITEAD has also published circuit diagrams for all their products (link here), which makes working out what’s what a lot easier.  They also have a really good build quality which gives confidence that these devices are well engineered. However, depending on your  licensing requirements, these may not be approved for use in AC systems in your country, so please find out what applies.

Sonoff devices are readily available on eBay. To continue building my system, I acquired a few Sonoff S20, a Sonoff Basic and a Sonoff Slampher.

The Sonoff S20

The S20 fits into a ‘Smart Socket’ and sits between the outlet and the device being controlled. The version in the photo below is for Australian sockets but versions exists in all variants.

Product information can be found at the ITEAD Wiki site. The socket is held together with one screw under the button and plastic clips on the side of the plastic shell. Prising it open is easy.

Sonoff_S20

The S20 has a header that allows reflashing of the device using a process similar to that described in Part 1 of this series.

The order of the header pins is shown in the small breakout. Pin 1 (highlighted in the square silk-screen box) is for 3.3V power.  The others are, in sequence, Serial Receive (Rx), Serial Transmit (Tx) and Ground. Rx and Tx are connected to the USB-TTL Tx and Rx pins respectively (ie, swapped).

The Sonoff Basic

The Basic is has terminals to place it inline with a power power cable to switch the AC active line. This looks like it was the original product in this family and acts very much like the Yunshan relays from Part 1, powered directly from the AC supply.

Product information is on the ITEAD Wiki Site. The Basic separates at the boot and is not even held in place using acres – just lever the plastic components apart.

Sonoff_Basic

Note the first 4 header pins are similar to the S20 and in the same order. There is one additional pin in the Basic that seems to be one an extension of one of the GPIO pins.

The Sonoff Slampher

Sonoff_Slampher1

The Slampher (naming inspired by IKEA?)  is a WiFi wireless light holder for light bulbs with a E27 screw base. It sits between the lamp holder and the light bulb.  It is and interesting idea as potentially this could replace a light switch altogether.

Product information is on the ITEAD Wiki Site. The Slampher is held together with 2 screws and comes apart easily once these are removed.

Sonoff_Slampher2

The header pins are similar to the S20 and in the same order.

Re-Flashing the Sonoff Hardware

REALLY IMPORTANT: DO NOT FLASH THESE DEVICES WITH THE AC VOLTAGE CONNECTED. YOU HAVE NO PROTECTION FROM ACCIDENTALLY CONTACTING THE AC VOLTAGE WITH THE DEVICE OPENED. The power from the USB-TTL converter is enough to power the electronics while it is being flashed.

Rather than solder the 4 pin headers for the 1-off flashing, I inserted a header into the holes and pressed it sideways to make a good electrical contact (see photos below) for the few minutes it takes to update the firmware. This makes the process much faster and does away with needing additional tooling and parts.

As mentioned, the flashing process is similar to that described in Part 1. The differences are:

  1. The ESP Easy flash binary is the ‘normal 1024’ version, not the 4096 version.
  2. There are no jumpers to change. Instead, you need to keep the tact switch pressed while powering up the board (eg, inserting the header connector). Then release the switch just before or just after starting the flashing software. The tact switch acts as the reset while it is held down.

The rest is exactly the same.

In the next part we’ll start using these devices to switch on and off.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s