Sonoff RF Bridge 433 – Tasmota

Sonoff RF Bridges are great to take every day houshold remotes, alarm systems, passive IR seasons etc , and pass the codes they transmit via MQTT messages.

These bridges can also be flashed with the Tasmota open-source firmware used for Home Automation.

Sonoff 433 Mhz Bridge
Serial Port on the 433 Mhz Bridge
Flashing with a Raspberry Pi

Follow the instructues in this post to flash with the Tasmota Firmware (using the TX, RX, VDD, GND configuration pins) above: https://explorationspace.co.za/2020/12/10/flashing-sonoff-devices-with-tasmota/

Flashing Sonoff Devices with TASMOTA

The Sonoff devices are great, but I prefer to use everything within my home and home automation setup to be fully under my control. Tasmota is a great way of doing just that.

I found the easiest way of flashing devices with Tasmota is using a raspberry pi. I’ve done a quick writeup on how to do this.

Installing ESPTool

Start with installing via the installer script

pip install esptool

Clone from the GitHub repository

git clone https://github.com/espressif/esptool.git

Preparing the Raspberry Pi

sudo raspi-config
Choose Interfacing Options
Configure Serial
Disable login shell via serial
Enable serial port hardware
Serial setup complete

Connect the Raspberry Pi to the Sonoff Device

Raspberry Pi Pinouts (Serial)

The TXD (Transmit) and RXD (Receive) pins are marked on the raspberry pi. We can use these to communicate serially with the Sonoff Device to flash it with the Tasmota firmware.

Sonoff POW R2 Device

Each Sonoff device has pins allocated to reflash the device. These boards usually don’t have headers attached. Here I soldered one to the board.

The important pins are VDD, TX, RX and GND.

Flashing the device with a Raspberry Pi

Connect VDD to an external power supply. The Raspberry Pi will not be able to power the device off it’s own pins. I used an external bench power supply. Ensure the voltage is 3.3V.

Connect the GND on the power supply to both the Raspberry Pi Ground Pins and the Sonoff device’s GND pin

Connect the TXD on the Raspberry Pi to the RX Sonoff pin and connect the RXD on the Raspberry Pi to the TX Sonoff pin.

Download the Tasmota Firmware

curl http://ota.tasmota.com/tasmota/ --output tasmota.bin

This terminal command will download the latest firmware from the Tasmota site to the Raspberry Pi.

sudo ./esptool.py --port /dev/ttyS0 erase_flash

Start by erasing the devices Flash memory

The port to use on a Raspberry Pi 3 or 4 is /dev/ttyS0.

sudo ./esptool.py --port /dev/ttyS0 write_flash -fm dout 0x0 tasmota.bin

Flash the device with the dowloaded firmware.

Once flashed, reassemble the device and power it on. It should appear as an access point on the network as Tasmota-xxxx if all went well.

You can also follow the Tasmota getting started guide to continue the setup: https://tasmota.github.io/docs/Getting-Started/

Installing Node-RED in a Container

Node-RED is a programming tool for wiring together hardware devices, APIs and online services in new and interesting ways.

It provides a browser-based editor that makes it easy to wire together flows using the wide range of nodes in the palette that can be deployed to its runtime in a single-click.

Running Node-RED is easiest in a Docker container. This is really easy to set up.

docker pull nodered/node-red

Pull the container from the Docker Repository

sudo docker run -d -p 1880:1880 -v /home/ubuntu/docker-nodered/data:/data --name mynodered nodered/node-red

Start Mosquitto.

The default port for Node-RED is 1880. Also ensure that the volumes are mapped to a local folder on the host to preserve the configuration.

Installing Eclipse Mosquitto in a Container

Eclipse Mosquitto is an open source (EPL/EDL licensed) message broker that implements the MQTT protocol versions 5.0, 3.1.1 and 3.1. Mosquitto is lightweight and is suitable for use on all devices from low power single board computers to full servers.

The MQTT protocol provides a lightweight method of carrying out messaging using a publish/subscribe model. This makes it suitable for Internet of Things messaging such as with low power sensors or mobile devices such as phones, embedded computers or microcontrollers.

Running Mosquitto is easiest in a Docker container. This is really easy to set up.

docker pull eclipse-mosquitto

Pull the container from the Docker Repository

sudo docker run -d -p 1883:1883 -p 9001:9001 -v mosquitto.conf:/home/ubuntu/mosquitto/config/mosquitto.conf -v /mosquitto/data -v /mosquitto/log eclipse-mosquitto

Start Mosquitto.

The default port for Mosquitto is 1883. Also ensure that the volumes are mapped to a local folder on the host to preserve the configuration.

ScaleConf

ScaleConf was an awesome 2 day conference.
https://scaleconf.org/ In is held annually at Kirstenbosch, which is an amazing venue. There were some really interesting talks too!

I was lucky enough to this year be helping out at the Microsoft booth. I’m always in my element to be able to chat to the community about anything developer related.

The plan was an agenda of various Microsoft Demos presented by the booth team:
https://cptscaleconfmsdemos.z6.web.core.windows.net/

It didn’t quite end up like that, and we ended up talking about what was requested, which was great. In my case, not only did I get to chat about Bots and ML .NET, but also got to speak about Xamarin and IoT too, which for me is always just plain awesome!!!

ScaleConf Kicking off
We are ready 🙂

Stickers!!
More Stickers 🙂

Day 2 Kicks Off
Azure IoT was a hot topic

Twitter Verse

Microsoft Ignite the Tour Johannesburg 2019

I had an incredible, but exhausting time at Microsoft Ignite the Tour Johannesburg. It was an amazing experience. I got to speak about Xamarin, AI and IoT, it doesn’t get much better than that. 🙂

The content for the Xamarin and Beyond session can be found here:
https://github.com/apead/Xamarin-Blazor-EnvironmentMonitor

There is demo code for taking Cross Platform reach to the extreme. For one code base you can target, iOS, Android, Android Things, Tizen, Blazor (Web Assembly), GTK (Linux, Windows, MacOS).

What was really cool. The @JHBMSDUG user group was showcased at the event. Lou van der Bijl, Matthew Leibowitz and Dustyn Lightfoot did amazing jobs!

On the big stage 🙂

The Demo booths were amazing. 2 Sessions each of speaking 4 hours about Xamarin, AI and IoT. Happiness. 🙂

The twitter verse

AI Hack for Good

It was a real privilege being a small part of this event. The “AI Hack For Good” event was all about using AI to do something positive for social good.

It was also great fun being a mentor and helping to enable teams to complete their solutions using whichever technology they chose. (.NET, Java, PHP, Python, JavaScript, Swift, Kotlin)

Microsoft the Home of AI
Red Bull was handy
IoT Edge with Cognitive Services
All hard at work
The awesome organization team

I did my part to improve laptops 🙂

Twitter Verse

ZX Spectrum IoT Fun

I started programming when I was 5. The ZX Spectrum started it all, back in the 80s. I recently started collecting ZX Spectrums. I’m also busy with IoT projects on Azure. Anything can really use Azure IoT Hubs, so how better to illustrate this than combine my two passions. 🙂

Cross Platform Iot at CTXUG

Last night was the Cross Platform Iot Session at CTXUG in Cape Town.    The turnout was absolutely amazing!    Thank you to all for coming it was a really fun evening!

 

Roger Weiss from Aliens kicked off with an overview of Windows 10 Iot Core and a few demos.  These demos featured some awesome use of Microsoft Cognitive services and also some nifty voice controlled home automation.

 

It was then my turn.   Unfortunately Chris van Wyk couldn’t make it this evening.  🙁

 

The session featured

 

Visual Micro for Visual Studio

Visual Studio Code with Arduino Extension which is now Open Source.

Xamarin Forms and Xamarin.Android with Android Things 0.41 Preview

The new Xamarin Iot preview for Linux based devices

Azure Iot Hubs

 

Devices wise 

 

Raspberry Pi 3

Intel Edison

Raspberry Pi Zero W

Latte Panda and Arduino Leonardo

MXChip Azure Kit

Devices everywhere! Latte Panda, Pi With Android Things. NexDock

 

The awesome new MXCHIP Azure Iot kit (Arduino)

 

The presentation can be found here:  https://github.com/apead/XUGSA/tree/master/19072017

Android Things Weather Station Sample with Azure Iot Hubs:    https://github.com/apead/Xamarin-AndroidThings-Contrib

Cross Platform Generic Xamarin Forms sample that ran on Phone, Android Things and Windows 10 Iot (I didn’t demo this, but it works too):   https://github.com/apead/XUGSABuildAutomation

 

Xamarin Android Things Nuget:  https://www.nuget.org/packages/Xamarin.Android.Things/0.4.0-devpreview

 

Xamarin Android Things Contrib Drivers:  https://www.nuget.org/packages/Xamarin.AndroidThings.Contrib.RainbowHat/0.40.0-beta

 

Getting Started with Xamarin Iot:   http://explorationspace.co.za/2017/06/21/xamarin-iot-comes-to-visual-studio-2017-on-windows/

 

MXChip Azure Kit:   https://microsoft.github.io/azure-iot-developer-kit/

 

Android Things Starter Kit with Rainbow Hat:   https://shop.pimoroni.com/products/rainbow-hat-for-android-things

 

Rainbow HAT

 

There’s a Xamagon!

 

Interesting VR Stuff happening in Aliens office