Ralph S Bacon

MicroControllers, Electronics and IOT

Sonoff and Alexa are friends!

My 4-channel Sonoff switching unit has arrived and has been “paired” with my Alexa. So now Alexa can switch my workshop heating on and off.

Sonoff 4 channel switch

Sonoff 4-channel Switch

In theory, at least, because I haven’t actually connected this to my heater. This is simply going to provide a signal to my workshop hub microcontroller that the heater should be turned on (if below a preset temperature).

This Sonoff also comes with an easy-to-use and intuitive phone app, that shows the state of the four switches as well as allowing you to change that state (eg. from off to on). We’ll be discussing more of this in my very next video, #110, all queued up ready for imminent release.

Best of all, although I don’t know why I feel that way, I can ask my Amazon Echo, Alexa, to switch on my workshop heater – and she does! You can imagine the chaos caused by me videoing this and then playing it back whilst my Alexa was still listening to me! That poor Sonoff didn’t know what had hit it.

So what, I hear you ask, is the workshop microcontroller hub? Funny you should ask. I had already told you that an Arduino was not suitable because it had no built-in wi-fi for starters, and I didn’t want to add a shield or other LAN component. An ESP8266 would have wi-fi, and the power required to run some central control program. But having read up about sensors sending messages to, and receiving from, a central hub it became clear that if I was to support that (easily) then a Raspberry Pi Model 3B+ would be required. This £35 unit is a computer in its own right, sporting a dual-core 1.4Ghz processor with 1Gb of RAM, a fast LAN connection and wi-fi with both 2.4Ghz and 5Ghz frequencies supported. I’ve got it running with the Raspbian operating system. I barely had to do anything for this bit to work.

Raspberry Pi Model 3B+

My Raspberry Pi Model 3B+

More importantly, it can run the message queuing and transferring process provided by MQTT (Mosquito) pretty much out-of-the-box. MQTT manages the flow of messages from sensors (such as a thermometer) and back out to actuators (such as a heater switch).

It works with Node-RED, installed by default on the Pi, which is a web-based “flow editor that makes it easy to wire together flows using the wide range of nodes in the palette. Flows can be then deployed to the runtime in a single-click”. If that doesn’t mean much to you stay with my channel as we leverage its simplicity to make my workshop almost autonomous!

Here’s a bigger picture showing it all up and running in my workshop.

bty

As you can see it is showing the standard wallpaper with a taskbar at the top. It’s connected to my wi-fi and seems to be very quick.

I’ve connected up a wireless mouse but can’t find my wireless keyboard that works with the Pi so I’ve had to resort to a cabled version, spit, spit!

More on this in future videos but for now I must read up a bit more about the message queuing protocols and see what the absolute simplest set up is, so I can demo it. Until next time!

Categories:Uncategorized

8 replies

  1. My bro got an Echo from his wife, but seems she is more obsessed with it than he. The day after he unpacked it she was insisting all the lights all the lights should already be controlled by Echo/Alexa, coz ‘you only have to install a skill’ and was scolding him for not already having installed the “proper skill”.
    Apparently she expected all the classic outlets and switches to suddenly magically listen to Alexa’ s commands

    Like

  2. Looking forward to the video. I am a big fan of the Raspberry Pi but then I have been a Linux user since the year dot.

    Like

    • Well, I managed (more by luck than capability) to get MQTT running on my Pi. I wish I had stuck with Linux, Nick. When Red Hat and others started to offer Linux with a GUI I built a few PCs with it on. It was very different to Windows but I knew just about enough to get them going. 20 years later I’ve forgotten just about everything I knew, just when it would come in handy! Doh! Anyway, no time to chat, I’ve now got to grapple with Node-RED!

      Like

  3. Welcome back, Ralph! I could just imagine you soldering away, fitting cables and puzzling yourself with new ‘gadgets’ to add… all this under Benny’s supervision, of course! I’m sure that I’m not the only one eagerly awaiting your new videos… In the meantime, I’ve 3dprinted a few containers for my Arduinos, a useful CD card holder, and a screwdriver bit holder too… Have a good day!

    Like

    • Without Benny’s constant input I could not do any of this, Daniel, but I’m sure you know this already. Benny is just sitting here looking smug, because he knows it too.

      It would be really good if you shared your 3D creations on https://www.thingiverse.com/ (or another showcase platform) as I, for one, would be very interested in your 3D creations. I now have the room (but not necessarily the budget) for one but wonder whether I could make proper use of it. Ideas, like the ones you mention here, could swing the decision for me! Do you have any aspirations to show off your creations?

      Like

      • For the moment, I’m just downloading models from thingiverse (no point in re-inventing the wheel!) – but I’m exercising with Tinkercad… and will certainly share if I create something original.
        BTW, just got a few Teensys from the slow boat… good for keyboard simulation?

        Like

        • Understood, Daniel. When you get something worth sharing though, please do! Yes, the Teensy uses the same chip as the (now obsolete) Leonardo, although you can still get clones from Sparkfun and the like. All have HID (Keyboard, Mouse) capabilities. It’s how my video switcher works. Whatcha gonna use them for?

          Like

Leave a Reply

Please log in using one of these methods to post your comment:

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.