Sunday, December 29, 2019

Ghost switching can be a bitch if your switch is your main circuit breaker

On my way to eat my own dog food, I learned the hard way that ghost switching is kind of the default problem most people will stumble upon when setting up their MQTT switch for the first time.This is not a big deal when you are configuring a single light switch or some other not so critical appliance. But when your switch is in series with your main circuit breaker, ghost switching suddenly gains a whole different level of importance.

Sunday, December 22, 2019

ZMAi-90 (or SMTONOFF WDS688) DIN rail meter/switch - more details on GPIOs and configuration

As an update to the previous post where I have shared the details on how to "Tasmotize" this device, I am adding more detail on what is the physical assignement of GPIO pins from the ESP8266, to other components in this device.

Given the pins from the ESP8266 microcontroller that are exposed in its breakout board (which in turn is SMD soldered to the main PCB):

Saturday, December 14, 2019

Intrusion / motion / door opening detector using a NodeMCU, some sensors, and Tasmota

The Espressif Systems chip manufacturer kind of created a revolution by opening the door to the creation of dirt cheap chips for building IoT devices. Its low cost led to introduction in the market, of many types of home automation devices, such as switches, light dimmers, smart bulbs, HVAC systems and what not.

On par with that, the open source community quickly became an interested party as well, and this led to the introduction of tools for quickly allowing developers to write interesting applications for practically anything based on these chips. It is the case of the Arduino core for the ESP8266 chip - This allowed for Arduino IDE accustomed developers, to write their own code, and either replace the original firmware on commercial devices featuring the ESP8266, or use open-source board designs such as NodeMCU and build their own custom devices.

Saturday, December 7, 2019

Reverse engineering the ZMAi-90 DIN rail meter/switch and integrating with using Tasmota - Part 2

I finished the first post with  a tone of optimism, in spite of not being quite there yet. But this time I'm bringing the complete story, with something which hopefully can be a useful takeaway for most users.

Initial analysis of the MCU communication

After figuring out what kind of communication was going on between the ESP8266 and the Vangotech V9821 chip (the specialized MCU which does all the metering functions - and a bit more which I will go in detail afterwards), I got a bit puzzled with the output and its consistency. I first connected a known AC current source through the shunt mounted in the relay's output rail, and in the middle of a stream of garbage, some values seemed consistent with the current I was putting and  being shown in the device's display.

I still cracked my mind at trying to figure out a pattern (I felt as if I was trying to incarnate John Nash while looking for patterns in seemingly chaotic data), and trying to prove assumptions such as the last byte being a checksum. But nothing fruitful came out of that first iteration.

Friday, November 22, 2019

Attempting to reverse engineer a home automation oriented smart-meter - Part 1

In my quest to make my house smarter, but still looking forward to keep having control over it, I have been doing some additions which I plan to further document here, in the short term.

In the meantime I thought it would be more relevant to share my findings in regard to a device a bit more "exhotic" than the Sonoff boxes we are all used to. This device is a sort of a miniature smartmeter that fits in a DIN rail next to the circuit breakers.

Just like the Sonoff modules, it also pairs with your WLAN, and connects to a cloud service. Instead of the eWeLink cloud to which Sonoff devices connect to, in this case it connects to another relatively popular cloud service called Tuya.

Wednesday, October 30, 2019

Waking up devices in (Home Assistant)

This is a quick post on a challenge I had to overcome while integrating my SmartTV (an LG TV 55UJ620V) with

I wanted to be able to turn on the TV (as such allowing automations to be built on top of it, or for example turning it on through a voice command via Google Assistant). As such I first resorted to using the Home Assistant Wake on LAN built in integration ( It kind of worked, but was not very reliable (perhaps 2 out of 5 times it would work).

I knew that by definition, the way that (Wake-up On LAN) WOL is implemented is inherently unreliable: essentially the target (dormant) device is expecting a frame with a specific pattern of bytes. If it receives that frame, it wakes up the host, otherwise nothing happens. The device will normally scan for that pattern of bytes in the frame regardless of the type of transport level protocol it may be on top of. In the case of WiFi in particular, there is the probability (high or low, depending on the network conditions) of that single frame not reaching the destination. This probability increases with the more hops we have in between.

With this implementation I was requiring the magic packet to be sent from a host (the Raspberry Pi where I keep running) that is in a separate router vlan, from where the TV is (these are connected via Ethernet and WiFi respectively):

Monday, October 28, 2019

Building a kick-ass home automation by reflashing the Sonoff devices with Tasmota and getting it all working with

For some time I have been gradually bringing more devices to my house, which are either designed or having features allowing these to be integrated to a home automation system.

In spite of all the concerns that can arise from bringing smart/connected devices to the place where you expect personal privacy to exist, the convenience of having these ends up speaking louder overall..

It all started with having a set of unrelated devices in the house, each featuring connectivity and some cloud-based features provided by the vendor. This is the case for the Xiaomi Rockrobo vacuum cleaner, the Sonoff switches, the multimedia devices such as the TV set (an LG smartTV), and also the Google Chromecast and Assistant devices.

Sunday, October 20, 2019

Consumer grade WiFi gear - when fixing the root cause is not at reach

Some time ago, I had to improve the performance and coverage of my home network, so as to be able to use the several devices around the house flawlessly, regardless of the location. Some of these devices have a certain demand for consistent bandwidth, as is the case of the SmartTV for watching IPTV and Netflix, and others such as the smartphones and tablets.

As always I tend to be frugal with spending money in hardware, trying to go with what performs well and is just about enough for the job.

This led me to aim for WiFi gear that would both be somewhat popular and low cost, while at the same time having some hope of being hackable and reflashed to OpenWRT in the future. This was the reasoning when I decided to buy a couple of TP-LINK TL-WR841N routers (with v9 hardware at the time).

At first I set these up and played with the stock firmware, configuring one to play the roles of  NAT, DHCP, DNS, firewall and so on, and the other to act solely as a WDS repeater, allowing WiFi coverage to be extended to the rest of the house.

Friday, August 9, 2019

The hurdles of fixing a puncture in a Xiaomi M365 scooter

I can say that I am pretty seasoned at fixing bicycle tires. It dates back to my childhood, where numerous times I had to fix the punctures by patching the inner tubes. I still remember the patching kits featuring an assortment of patches of different sizes and shapes, sanding paper, and the rubber cement.

Never had much trouble in separating the tire from the rim, and putting it back together, after having fixed the puncture. The same applies for fixing the tires of more recent MTBs, where upon following the usual technique no major obstacle arises in accomplishing these tasks.

But now, just after a bit over 100 Km into using my Xiaomi M365 scooter, I found a rattling noise in the front tire while riding it. Went on to take a look, and found a thumb tack, fully buried in the tire. As I started removing it, I could hear the air escaping. Decided to leave it there just so that I could ride the scooter back home.

Saturday, July 13, 2019

EDF Propelled Hovercraft project - first outdoor test

Following the post regarding the construction of this project, here is finally the first real test:

Performance and handling are very good, as expected.

Monday, July 8, 2019

The most inneficient (and probably the coolest) EV in the world - the electric hovercraft!

This project may well model what an electric hovercraft could feel like to drive. At least from a noise perspective, trust me, it is a pretty solid preview in spite of its small scale!

Sunday, June 23, 2019

DSLR Intervalometer - Source code made available in GitHub

For those who remember my work back in the days with implementing an intervalometer for Nikon cameras (yes, in spite of it being rather simple to implement in the camera firmware itself, these larger brands prefer to classify such a feature as premium and make it available only in more expensive DSLRs), I have detailed in the following post, the solution that I have put together:

Saturday, June 15, 2019

Yet another product safety issue - a self-balancing electric scooter, a.k.a. "Hoverboard"

Considering all the fuss about this particular type of personal transportation gadget having been responsible for numerous fire incidents, given that it is already part of a distant past (by modern perception), I took the chance of buying one of these units, going for a cheap one. My expectation was that this industry had some time to mature and learn with all the beating they received from the press and these incidents:

Sunday, May 12, 2019

Dealing with dishwasher failures

Albeit 10 years of flawless operation can be considered quite good for a home appliance, still when it finally fails, there is the brief criticizing thought of "why didn't it last longer? Bloody programmed obsolescence in modern industry!" ..and so on and so forth.

Well, the truth be said, 10 years of operation without a single glitch is either a product of sheer luck (i.e. one golden batch in the production line), or the brand really went serious with quality and the strategy at the time didn't include the need for recovering the same consumer soon in the product life cycle.

I can say this from the Whirlpool dishwasher model ADP 6837/1 that I have been using since 2009. During 10 years it never complained, while we threw dirty dishes at it on a daily basis.

Wednesday, April 17, 2019

Once again bumping into questionable product safety standards

About 6 months ago, I replaced the manual plastic pump I used to have for dispensing water from 5+ litre jugs, with what would in principle be a more sophisticated and convenient approach: looked for an electric water dispenser, and without much searching, found several options. Most, if not all were unfortunately designed to fit into the 19 litre office water bottles. Without any alternative, ordered one of these, considering that I would have to come up with some custom adaptation if I wanted to use it with the 5 litre bottles. Ended up ordering the one below, for its minimally elegant design and compact dimensions:

Wednesday, January 30, 2019

Car DVR replacement and related shenanigans - part 2

Moving along with more details, like I mentioned in the previous post, the rear camera was reused from the previous installation. This CCD based camera happens to be superior to the basic CMOS camera bundled with the kit. Both in terms of the quality of the sensor itself and its low light sensitivity, but also regarding the lens, featuring a wider viewing angle (important given its role as a backup camera).

The only change however was a substantial improvement in the mounting design, by having added an U-shaped plate in the rear of the camera, with a 4-screw mount instead of the original 2 screws attached to the sides of the camera. This provides a more solid attachment to the L-shaped aluminium parts that in turn stick to the door through an adhesive:

Sunday, January 27, 2019

Car DVR replacement and related shenanigans


With the vulgarisation of miniature cameras and computing devices of all sorts, technologies that fundamentally serve the mobile industry become cheap enough and available to the point of being useful for other purposes. That is the case of DVR devices for automotive use.

Saturday, January 5, 2019

Adding metalurgical capability to a biological microscope - part 2

Like I had previously explained, I was able to obtain from eBay (for a minimally decent cost), just the bare vertical illuminator, which didn't include any accessories. The light house was not an exception. The vertical illuminator consists the main body:

and the light house, which in the original device would be based on a halogen bulb of at least 15-20 Watts: