Itead Studio has been releasing interesting gadgets for the Home Automation community based on a low price tag and extreme hackability. You can google “sonoff” (the main brand for Itead Studio home automation devices) to get more than a million hits, including official pages, reviews and lots of hacks. The ubiquitous ESP8266 (or its sibling ESP8285) is the core of all those devices, using WiFi instead of the traditional RF messages, replacing a remote with mobile apps or voice commands. But also, using custom firmwares like ESPurna, technologies and solutions like MQTT, Node-RED or Home Assistant. But one of the latests devices from the chinese firm tries to bridge the gap between those two technologies: the Sonoff RF Bridge 433.
A few months ago I wrote about the Sonoff SC sensor hub by Itead Studio. It’s a device with a Sharp GP2Y1010AU0F [Aliexpress] dust sensor, a DHT11 humidity and temperature sensor, an LDR as light sensor and a mic. The sensors are driven by an ATMega328P microcontroller but there is also an ESP8266 on board for WiFi communication, a pretty standard set up when you have several sensors and the ESP8266 GPIOs are just not enough.
On the first post I already did a small mod to replace the DHT11 humidity and temperature sensor with a more accurate and pin compatible DHT22. Since then, several readers have contributed with code and ideas. My progress implementing and testing them is slow, so I though about writing a first post about some modifications I (and others) have done to the device.
So this is a work in progress post. At the moment, all the code for these modifications is in the dev branch of the repository.
This custom Sonoff SC firmware is released as free open software and can be checked out at my SonoffSC repository on Github.
One might think that one of the typical uses for a smart wireless switch (like Sonoff devices) is to be embedded behind a normal wall switch so it becomes a “smart” wall switch. It may seem obvious but it’s not that straight forward. There are several things that get in the middle.
- Most (all?) the boards have momentary push buttons while wall switches are (normally) toggle switches
- Most of the available boards in the market are SPST, even those with SPDT relays often only provide terminals for COM and NO, not NC. I only have one one-throw switch at home, all the others are one-way-two-throw and are being used as part of a multi-way switch.
First problem can be easily solved in code. Instead of detecting one edge of the button signal (usually the rising edge since most push buttons are configured with pull-ups) you can detect both edges.
Second problem is harder since it depends on the hard-ware (ehem). But there are a few boards out there with SPDT relays like the Itead 1CH board I recently covered, the e_Goto Wifi Relay Switch Module [Aliexpress] or the Your Cee ESP8266 5V WiFi Relay Module [Aliexpress]. There are also two-relay boards you can use for a multiway switch by syncing the relays in opposition mode using ESPurna firmware for instance (one and only one relay on). The Electrodragon ESP Relay board is one such boards. Another one is the Sonoff Dual.
Sometimes Chinese manufacturers throw a mysterious, unlabelled, IC into their designs so we can spend a few hours trying to figure out what they are and what they do. It’s such fun! I’ve been playing with one of those this afternoon, trying to answer those questions but also trying to understand why! Why is that chip there? Why did someone decided she needed that chip there?
Some weeks ago a user of ESPurna asked me if the firmware supported Itead’s 1CH self-lock/inching board. My answer was “why not” since all Itead’s products are very much alike. Wrong. This one is different. Let me summarise why:
- There is no entry in the Itead’s wiki for the device
- There are no schematics, drawings, in the store
- It uses (and brings out) a Songle SRD-05VDC-SL-C SPDT relay (there is only one other product using this relay in Itead Studio store)
- It uses Itead Studio PSA-B module
- It does not have an AC/DC transformer
- My module supports 12VDC connection
- It features a second button exclusively for the pulsing feature
- There is no header to program the PSA-B module
All these things together kept me wondering… is this an Itead’s product?
Lately I’ve been quite busy with the ESPurna firmware. It’s growing bigger and gaining some momentum. It’s really fulfilling to see other people using it and reporting back. But at the same time it’s very time consuming. Last Saturday I released version 1.5.0 with some new functionalities and bug fixes and I decided to use some of my free time over the weekend to work on a project that’s been waiting for a month in the shelf.
A few weeks ago I was playing with the Sonoff TH and I wrote a post about its sensor interface and the possibility of using lots of different digital sensors, including I2C sensors since the board can be easily hacked to export 2 digital pins over that interface.
And having I2C not only increases the number of potentially usable sensors but also opens the possibility of using I2C Analog to Digital converters to overpass the lack of analog inputs in the device. Here it comes the Texas Instruments ADC121 (datasheet), an 12-bit precision ADC with I2C support priced 2.74€ in quantities of 1.