Skip to main content

Posts

Showing posts from August, 2017

WIFI switch

Lately, I have been experimenting on how to DIY a simple WIFI switch which can switch on/off a remote device. I can use OpenHAB to design a screen and use it on my mobile phone to do the job but I wanted a physical switch. I have put together the switch using a Wemos D1 mini and a capacitive touch switch. The capacitive touch switch has a nice blue glow when it is turned on. A NPN transistor is used as a switch to pull the D1 mini GPIO to the ground when activated.




Tasmota has a configuration for Switch mode. When a switch is toggled, it will send out a MQTT message. I have made both the Sonoff RF Switch and DIY switch listened to the same queue. When the switch is touched, it will turn on/off the Sonoff RF Switch. Cool !!!


UPDATE 1: DIY Sonoff RF Bridge with Sonoff RF

The Sonoff RF I have ordered arrived. It is similar to Sonoff Basic in term of the layout. Flashing the device with Tasmota firmware is easy. In Tasmota website, the instruction recommended soldering a jumper at R21. I discovered that this is not necessary. To start up the ESP in programming mode, I only need to short the inner pin of R21 to ground when powering up the ESP.



After I have flashed the device, I was trying to pair with my RF433 with pre-defined code but it does not go into pairing mode and I also noticed the ESP01 randomly throws errors. I suspected that the FTDI serial adapter may not have enough current to power both the ESP and the RF board. I put back the casing, powered the device using AC and cleared the existing code. I paired the Sonoff RF with my fixed code RF433 transmitter and using the DIY Sonoff bridge Web UI to trigger. Presto! The bridge is able to switch on/off the Sonoff RF.
That is a promising start for the DIY bridge. More exciting integrations with oth…

DIY Sonoff RF Bridge

Tasmota recently supported the RF bridge by iTead which allowed for RF 433 remote devices to be controlled/controlling using Sonoff products. e.g A handphone can be used to control a remote RF device or an RF remote control can use to control a WIFI enabled device.

By using Tasmota, I can control the device using MQTT. This idea fits exactly to my smart home plan. Here is the schematic:



I cheated a bit by having ESP01 mounted on a breakout board. This breakout board converts all the external pins to 5v which simplified the wiring and I do not need to use a voltage level shifter. Moreover, the Arduino 3.3v power does not have enough current to power the ESP reliably and I have to power it via the 5V from Arduino Uno. Next, I used an Arduino Uno prototype shield with a tiny breadboard to hold all the components together. For the RF 433 transmitter/receiver, I am using the development kits when I purchased the all-in-one Arduino development kits. An antenna is added for more sensitivity.



The Edge Devices - Sonoff, ESP8266 and Tasmota

Sonoff, ESP8266 and Tasmota, how are these 3 components related? This can be viewed as a computer where Sonoff is the computer, ESP8266 is the CPU and Tasmota is the Operating System.

Sonoff is one of many companies in China which manufactures smart home WIFI connected devices such as switches, plugs and lights. Their devices are very popular among DIY smart home builders because they make it convenient to flash custom firmware. I have bought a few of such devices, Basic SwitchRF-Wifi SwitchWall socket and Light Switch. This can be easily found on Aliexpress, Taobao and Banggood, Videos and articles on how to modify to custom firmware can be found on Youtube.

ESP8266 is one of the amazing makers modules that come out after Arduino. Espressif has make the ESP Microcontroller programmable using the Arduino IDE. The library has the entire TCP stack built in making it possible to be programmed as a mini web server, tcp/udp server/client. There a complete library available which make th…

Smart Home Components

Next, I need a Micro Processing Unit (MPU), Micro-controller (MCU) and the software.

After some design considerations, I have decided the brain of my system shall be a Raspberry PI.
Raspberry is easily available. I have purchased mine at Taobao for less than S$70. It comes with a casing, power supply, 3xheat sinks, fan and a 16GB micro SD. This is the cheapest I can find.There are so many documentations, videos and websites on Raspberry Pi. I watched a youtube clip showing Google Home assistant can be easily installed on a Pi. That sealed my decision to choose Raspberry Pi.  The next piece shall be the automation software, Currently, the most popular Home Automation control software are Openhab and HomeAssistant. I do not have time to evaluate both and settled for Openhab as I am more of a Java programmer. In case anything that needs debugging, it will be easier for me (but it turned out that I do not really need to look at the code).
I like the Arduino development platform. Simple to …

Online Shopping (AliExpress, Taobao and Banggood)

For this article, I am writing about the 3 sites where I have purchased most of the Home Automation project parts.

Online shopping for China goods in Singapore is a wonderful experience. The parcel delivery services here are reliable and reasonably fast. So far I have not encountered a single package lost. My main consideration for online shopping is the ability to pay with maximum convenience, minimum fee and delivery to your doorstep.

Taobao
Taobao is the de facto shopping for those people in living China. In the early days, for those staying outside China, the only way to buy from Taobao was to go through agents who ordered the products on your behalf and charge a fee. Taobao recently announced a tie-up with Lazada (an online shopping portal bought over by Alibaba). Most of the fanfare is Lazada provides a Taobao link in Lazada portal. Actually, the main benefit is that I can order from Taobao main site and send over to Singapore via Lazada. Although in Taobao, there are many other …