Posts

Showing posts from January, 2018

FTDI problems and Mac OS X CH340 USB-Serial Drivers

I thought I'd burn the latest, revised Sonoff code into my other Sonoff Basic, using my "FTDI" USB-Serial adapter . Should work, ok? Obviously, since I'm writing about it, NOT. Using the Arduino IDE to compile the latest Sonoff code, I first discovered that it's too large to go into a boring ESP8266 with only 512K of memory. So I had to comment out a whole load of features that I wouldn't be able to use with a Sonoff Basic anyway. Now it might fit... Then it's time for some stupid-seeming errors... basically the chip doesn't appear to be doing what the esptool thinks it should. Yuck. I try the esptool.py approach, including Flash clear/reset and so on - no joy, same or occasionally different error. Google time. This is an example - lots of people having this class of problems. Then there's an interesting find - guy reckons counterfeit FTDI chips are the problem! Mine worked ok before... but it's not now. So here's his USB-Serial Ada

RFLink errors resolved

Image
To recap, RFLink  is the software that runs on an Arduino that has been equipped with the Nodo  433.92 MHz Transceiver kit, which allows sending and receiving of 433.92MHz wireless control sequences , as used in doorbells, car security, heating thermostats and so on. I've been noticing the Node-RED debug output showing that RFLink is occasionally returning the " 20;xx;CMD UNKNOWN " response to one or other of the commands I've been sending to control lights around the house on timers. In addition, the lights sometimes mysteriously go off for a period, and then switch themselves back on, all the while that the status is shown as ON. Weird. My entire career was based on "if it smells bad, it probably is", so if I want a reliable system, maybe I'd better see if I can fix this. Let's face it, if I send a message I think is correct, and it's ignored, something I want to happen won't be, and we can't have that can we? So, what could it be

Charting SHT30 Temp/Humidity data

Image
Time to do something interesting with data. Let's chart the SHT30 output... First, let's get it off the MQTT and turn it into something the Dashboard Chart item can use... MQTT -> Selected Topic -> JSON -> 2 Messages/Different Topics The Sonoff Tele MQTT input listens to "tele/sonoff/#", which contain payloads with JSON-like strings. However, the messages include "tele/sonoff/STATE" as well as "tele/sonoff/SENSOR" which is what we want. Because I'm interested in seeing all the messages at the moment, and Node-RED will only show me messages to which it's subscribed, I'm going to use the Switch node to select by specific Topic i.e. tele/sonoff/STATE tele/sonoff/SENSOR It turns out that the msg.payload isn't proper JSON, so if I poke it through the JSONifier node it turns it into JSON i.e.  {"Time":"2018-01-15T18:05:26","SHT3X":{"Temperature":21.4,"Humidity":4

NodeMCU + Tasmota code + SHT30

Image
That was cool. Let's try something a bit "easier" - a NodeMCU module, which is easy to connect and upload to, in conjunction with a new sensor, the SHT30 that does humidity and temperature over an I2C interface. This is prompted by this article , which doesn't really say how to do any of this... Obligatory not very illustrative pic - bits are labelled pretty much! Oh yeah, had to solder the header pins onto the SHT30 - piece of cake now :-p. Compiled the latest Tasmota code (using the ESP 2.4.0 API + libs, which significantly improves the WiFi performance) in the Arduino IDE, it's already uploaded while I've been writing this. Gosh. And that was probably a bit rash! Re-compiled and uploaded, now I've edited the user_config.h file to include my Wifi details and a few other useful things. I'm hoping the code uses mDNS, because that's really handy. Hmm, that didn't seem to work - using the Serial Monitor indicates it's still us

Plan B: Flashing Sonoff devices using FTDI & wires - Success!!

Image
OK, so the SonOTA stuff didn't work, time for Plan B - use FTDI USB-Serial adapter and some wires to connect the ESP8266 to the Mac and have at it... To make sure everything happened cleanly, I thought I'd follow the instructions (blimey) . Removed current Arduino IDE install, and re-installed 1.8.5, the latest. Then I installed the Espressiv 2.4.0 board code, as per instructions. I compiled the sonoff code, minor glitch when the MQTT buffer was apparently too small. This was due to some old libs from my previous attempts - I hadn't deleted everything Arduino because I wanted to able to do some of the things I'd been doing previous to this escapade. I just deleted the old (differently named!) versions of ArduinoJSON and PubSubClient. Things then compiled ok. All good so far... At this point I had to connect the board via the FTDI adapter. I used a breadboard for this, and reckoned I could avoid soldering the pins onto the board by using male/female jumper wires,

Getting SonOTA to work on Sonoff Wireless Switches

A while back I obtained a couple of Sonoff Basic Wireless switches , which use the ESP8266 wireless SoC. Now I"m trying to use them! But of course I don't want to use the ITEAD CBB (Cloud Based Bollocks) and their doubtless wonderful iOS app... I want to use more open things that all work locally. So now I'm trying to install Sonoff-Tasmota firmware, which does more like what I want. My original plan was to do this the hard way, with an FTDI chip hammered onto the side of the box, and using USB-Serial to upload the new firmware. However, this page suggests that it's possible to do a rebuild using Over The Air (OTA) and thus avoiding the hammering bit. Let's have a go... Firstly, the instructions require Python3... already installed! I haven't used this for ages, let's hope it all works - I note that when installing pip I should have opted for "clang". Who knows? Run  pip3 install --user -r requirements.txt  . Argh, no "clang". Even

Telegram, NodeRed, and an alternative to SMS messages

Image
I used a Twilio test account to send SMS messages triggered by the front door bell , but of course that is about to expire, probably because I've flogged it to death with a piss-taking number of SMSs owing to connecting one of the security cameras at the rear of the house to it... Anyway, now I need a sensible free alternative - who wants to pay £0.04 per SMS, or £0.08 per doorbell ring? If you knew the number of packages we have delivered, you'd know this is infeasible! Besides, all the services have different APIs, and I couldn't be arsed to sing up for another trial somewhere else. What to do? Here's an idea - can I use Instant Messaging, like WhatsApp? WhatsApp announced that they aren't going to have an API, so that's out. I played around with iMessage, but that's pretty closed too. There are smartphone apps available that will receive a message and use the phone's text connection to send an SMS, but they also require using an API to contact th

Alexa Echo and Big Timer Alexa control of 433MHz switches...

Image
And finally, I added the capability to control one of the switches from Alexa Echo. Easy... Add an Alexa Local node, discoverable on the local network by Echo; this is only capable of on/off and %age signals, but that's enough Connect it to a simple Function node that converts the input to the right form for the TriState Control node  Route it via an Output Link node to the Tristate Flow Alexa and Big Timer flows for switch control The screenshot above shows the appropriate flow. Because Alexa Local can't distinguish which switch you're addressing and supply the right code/channel values, they have to be added. This actually works, much to my extreme and highly pleased surprised. The twins think it's pretty cool too, especially as they're already agog at the whole Echo thing. You can also see a Big Timer (a Scargill -provided timer function) linked up to send timed control messages to the same switch. This hasn't been so successful yet, but that

NodeRed Dashboard and controlling TriState (Maplin) 433MHz Switches

Image
The last post managed to get the Maplin RSL366T switches under the control of NodeRed. However, I don't want to be clicking things on and off through the laptop, by clicking an "inject" node... How much more useful it would be to have, for example, a web page that showed the state of the switches and allowed them to be toggled ON and OFF. The NodeRed add-ons suggested in tech.scargill.org  include the NodeRed Dashboard nodes. Let's take a look... Dashboard Input Fields Dashboard Output Fields There are two sets of widgets in the Dashboard selection - input and output, shown in the nearby screenshots. What did I need? Since this was a learning experience, I decided a On and Off button for each of the 3 switches, and a field to report the current status of the switch. In a new Flow Tab, I added 6 buttons 3 text fields linking two buttons to  each text field a Link node that links to the TriState Control widget on another tab Simple