Doorbells

As I work more in my garden shed some of the conveniences of the house become apparent: heating, power, internet connection, cups of tea, and doorbells. I realised this last one after missing a couple of deliveries which while they were expected, weren’t expected at exactly the moment I stepped out my back door.

The problem isn’t the doorbell, the problem is that having a doorbell convinces you that you’ve answered the question of knowing when someone is at your door.

Nest are now supplying their WiFi doorbell in the UK and it looks a very capable device, and Amazon also do the Ring video doorbell.  While the price is high there is a lot of function provided and they variously do facial recognition, storage of video for review (with a subscription), presence detection, and letting you know when someone is at the door. That last one is strange: I run design thinking workshops and one of the exercises involves asking people to re-imagine the door bell. First exercise begins with: “draw me a doorbell”, while the second is exactly the same but begins with “draw me something to tell me that someone is at the door”. Needless to say the second elicits a wider range of devices including dogs, pressure mats, windows, and pull bells. But doorbells these devices are not: their primary functions are to enhance the door arrival experience so that we can either speak to the person there, let them in remotely, or see unwanted visitors before they see us. So why am I leery of wifi doorbells?

Power

Power is the enemy of remote devices. At least one of the current crop of internet connected doorbells needs a wired connection and this smacks to me of a fudge. My bottom line is that I might as well wire in a press button and a Raspberry Pi with video camera via power-over-ethernet as load such a big device on my doorstep. This aversion stems from my earlier work with power budgets on embedded devices and how it compared to other devices running in the ISM band, some of which operated for up to 2 years on a coin battery! Astonishing to consider that SBCs like the Raspberry Pi only operate for a day or so on a massive 13Ah battery pack, and even lower powered devices such as the Pycom LoRa struggle to get micro-amp-hour range while sleeping.

433MHz/868MHz devices, on the other hand, can exist for much longer on a smaller power budget – my Friedland front door chime runs for years on a coin cell battery. While I’ve played with ISM band devices before, their OOK or FSM modulation is difficult to understand unless you have a spec sheet. Long ago I had a set of devices from a now-defunct small electronic company which used an embedded protocol called LLAP and a cyclic wake mode which worked perfectly for my variety of monitors. Sadly, I am resurrecting the whole setup using more functional, but more power-hungry LoRa devices.

While there are other attempts such as DoorPi and some convoluted GitHub repos that write everything in Python, including event handling and streaming of video, I want to simply use my NodeRed installation to slave off the door press and everything else can happen from there. From my central NodeRed running on an Odroid SBC I can stream video, send a text message, speak back to the caller, switch on lights, and so on.

Question: how do I slave off the wireless ISM Friedland door chime?

Commercial Alternatives

Ring

The Ring doorbell by Amazon is an interesting alternative. It has the advantage that it is wire-free, but some of the reviews warn that it only trickle charges while connected through a wired extension and that ‘excessive’ number of people walking past can drain this – for which read 6-7 people max! That means a busy footpath like our road would very quickly drain it, so a non-starter. Also, lots of reports about delayed triggering of the phone application and

Nest

I like the Nest ecosystem, it handles well and rarely gives any problems. I have the Nest thermostat and their fire alarms and while the new Nest doorbell is currently retailing in the UK for around £250 and looks good, the base requirements specify a wired chime unit with exposed lugs on which to wire the leech wires from the door press. That makes it a no-starter for me as the initial cost of installing another wired door chime would be higher still. Perhaps if they do a wire-free option

Others

While there are others out there and some pretty good CCTV combined monitors and door releases, I wanted to attempt my own because, well – because! I have plenty of experience of using radio frequency ‘stuff’ and while I’m not an embedded microprocessor engineer, I will shortly have more time on my hands to complete projects.

I’ve started by using some Arduino code on a Wemos (- now called ‘Lolin’) D1 mini, which is an ESP8266 encapsulated on a board to expose the GPIO and powered by micro-USB. This can be programmed using the Arduino IDE and I’ve copied some code from Jamie Jones’ doorbell project. My sounder or chime is wirefree and links from the Friedland door press by using the ISM 433MHz radio band. Getting this part working was quite simple and a matter of adapting the code to local environment, and putting it into an enclosure – which is still to be done.

Next is to work out how to sound the chimes triggered by an MQTT message on a specific topic.

Advertisements

Extending WiFi to the garden shed

I’ve purchased a pair of Ubiquiti Litebeam M5 network dishes to extend my house wifi to the garden shed.

litebeam-m5-hero-gallery-01

Normally you’d only need one of these either to send or receive the broadcast from the main house, as my shed however is made of metal it tends to act as a Faraday cage and shields most radio frequencies, hence the pair of CPE devices. I have these set up so they point directly at one another and connect via the proprietary AirMax protocol which speeds things along as it is a layer 2 link (which means that broadcast and other packets normally inspected at the bridge boundary are passed as-is). While Ubiquiti do provide an excellent management server (UNMS) running in a Docker container, this is supplied only in a x86 image and won’t run on my always-on ARM SBCs.

These M5 are nice units because they are cheap, simple to assemble and operate, and gain up to 23db over a simple omnidirectional antenna.

litebeam-ac-features-gain-2x

Careful positioning is needed, and when they are talking to each other directly the signal is taken into my shed using normal ethernet Cat6 cable – although for professional and hardier situations there are toughened cables that you may use. This signal is fed to a Vigor 800 access point and spreads around the inside of my shed. Ethernet connection to the AP is also possible which gives really good latency response for playing games. I’ve measured 18ms response on a speed test which is pretty good considering how many bits are in the way, and the cable/radio/cable arrangement back to the main modem. I now have a number of managed switches and ADSL devices spread around my house, which is pretty good considering I don’t run a lot of servers.

Interestingly, the M5 are PoE meaning that they only have one ethernet cable into the actual radio ‘horn’, and further back you supply power and a connection to a PoE box – passive in this case – which feds 24 volts along the ethernet cable to the assembly. I also use this for my LoRa antenna in the loft as it means you don’t have to have power so close to the installation. They work well and my multi-protocol house is rapidly gaining an assembly of antennas!

(images taken from Ubiquiti web page)

Life Skills

As the world progresses the necessary ‘life skills’ needed in each era seem to change. The simple ones like being able to drive a car or horse, being able to read or use social media and understanding the difference between a cursor and and screen pointer! But even those get very old, very quickly.

Take, for example, the analog clock: the clock face with 12-hour divisions came from the ancient Egyptians with the the duodecimal system based on finger joints or lunar cycles. The skill based on being able to interpret the clock face is diminishing, and no-one needs it except those taught many decades ago. “Teach children to spell” yell the older generation while fumbling around on a keyboard and ignoring social media. “Make the remote control easier” grumble the same folks, while most younger people use their mobile phones to control their home lights, order meals, go shopping or find the next public transport. Skills change far more rapidly than a codified education system can keep up.

Take typing. If the only time you extensively have to use a pen is during an exam, surely you are training people for … the wrong things? Post university most people type things versus using a pen at almost a 10:1 ratio, yet we take many years to teach writing first. Teach them to drive a car just when autonomous cars appear and you’ve done the same thing as encouraging weaving just before the Industrial Revolution, or spelling just as spell checkers arrive.

We need to urgently identify those skills that are universal such as relationship management, ability to learn, adapting to change and fundamental things like self-learning and being curious. To paraphrase Pink Floyd, “we don’t need no prescriptive education”.

Life is a Journey, not a Destination

I’ve always had an itch to try out new ways to get somewhere. I guess I got that from my father; he’d be admonished by mother for wanted to try ‘shortcuts’ when driving which often resulted in back-tracking or otherwise ending up lost – and when lost means the middle of the Australian bush that is very lost indeed. His knowledge of remote country roads was only matched by his seeming disregard for transition from single man into family patriarch and the responsibility that entailed. I don’t want to paint a picture of someone who was frivolous or ignored safety, but at his heart there lurked an element of wildness.

So too for me. Before GPS, Google mapping every road in the world, and mobile phones I would study maps and work out that there may, just may be another way to get from A to B. I really enjoy the path less trod, understanding a new contraption from more than just the instructions, and trying new experiences.

Stoke left, stroke right

I have for many years enjoyed a personal computer from Apple. Having used hundreds, if not thousands of computers during my time in IT, I fully appreciate the fundamental advantage of a Macbook: it just works.

I’ve now passed this older laptop to a member of the family and are now using a newer work machine, but need to keep both work and leisure separate – so I run two different browser windows with the ‘left’ one covered in employment related tabs, and the ‘right’ one open with personal items such as my home email. The method seems to work although I too often find myself at the wrong end of the spectrum, so to speak.

Swipe

It reminded me of some of the dating apps that use the ‘swipe left, swipe right’ idea of approval – only my swiping is replaced by the MacOS idea of four-fingered strokes left or right on the enormous Macbook Pro touchpad. And oh – the Pro is a very enjoyable type of machine.

Home broadband

I’m really impressed by my internet provider, Andrews and Arnold. I’ve used the internet since before it was named, and Fidonet, 1200-baud modems, bonded twin ISDN lines and the whole shebang. Today’s FTTC and ADSL are fast and simple in comparison.

However the last physical leg is often the source of issues. Trees rubbing on telephone lines, storms, and cable modems losing sync when it rains are all part of that ultimate physical connection to my home. Even mobile data via 4G gets rain fade in a heavy rainstorm. A wet piece of string will still transmit a signal, but it will be pretty weak.

When I speak to my sister in remote Australia it seems that they are lucky to get even a mobile phone signal when standing in a particular corner of one room of their house. There is no internet via land-line, and often reasonable internet connection is only available from her office in the town. Netflix and streaming movies, Facebook and the like are all distant, unreasonable realities and for many people in developing nations. So my little worries and 80Mb per second seems like luxury. My quota is 1Tb per month, but I rarely reach that. I am also served by cable and could use that but the latency is too great for good gaming.

So I’m pretty happy with my internet connections!

ctypes and uctypes

Having obtained the raw protocol description from the vendor, I confirmed many of my earlier observations and now have a working system which can read the information. Like many programmers I approach the problem in a step-wise manner by getting each element working in turn and refining my solution. These are the steps I took so far:

  1. Obtained and assembled hardware, including a XY-017 TTL converter in a USB stick. This is used to read the incoming RS485 protocol.
  2. Attempted to read anything from the USB interface. I developed a program (‘disp.py’) to do this and the results are in the Git library.
  3. Cycle on #3 above until satisfied.
  4. Started work on a simple sending program on a Pycom LoPy which transmits to my LoRa antenna in my loft. I’d previously got the whole LoRa thing working hardware assembly and work on connecting to The Things Network.
  5. Vacillated for a few months. Hey, this is a hobby!
  6. Created a program to read the incoming message from MQTT as The Things Network publishes all incoming messages on a MQTT broker, and by subscribing using the appropriate keys you can read the raw messages.
  7. Decomposed the messages by using ctypes library on the CPython implementation, and uctypes on the MicroPython implementation.

This latter stage wasn’t so easy, as having muddled through to gain an understanding of how ctypes works and mapping the fields, I then had to learn a new way of mapping bit structures since MicroPython tries to be helpful by removing all the challenges of endian architecture in their implementation and it works different to CPython. It took a good chunk of time to get the normal Python working, and then realising that I had to grok something that looks completely different.

I’ve written some small-n-dirty test programs to make sure I understand this new aspect of MicroPython, and then I will implement it in my actual program running on the LoPy. I also need to create an accumulation as not all data will be sent immediately, and also turn off WiFi radio and set the IoT device into low power state. Lots more fun along the road.

LoraWAN weather station

I’ve just received a nice new ‘headless’ weather station from China, and I am engaged in connecting to its RS485 feed and understanding the protocol. They supplied a RS485-UART USB stick with it, and after playing around with some containerised NodeRED flows which couldn’t read the USB finally just used PySerial and have started dumping the data. Although it is advertised with the tag line “we will supply the communications protocol” this wasn’t forthcoming so I just dumped the bits down on the screen and have started reading them. Apparently they are a Fine Offset type of station and equivalent to the WH2950 type, without the monitor or network link. It’s all down to me!

WeatherStation

The bytes look like this:

24 B3 7A 62 61 46 00 00 00 00 00 01 00 00 00 48 A3 $.zbaF………H.
24 B3 7A 62 61 46 00 00 00 00 00 00 00 00 00 D3 2D $.zbaF……….-
24 B3 7A 62 61 46 00 00 00 00 00 02 00 00 00 D4 30 $.zbaF……….0
24 B3 7A 62 61 46 00 00 00 00 00 00 00 00 00 D3 2D $.zbaF……….-

… which is fun. I quickly worked out that the standard size was 17 bytes, now I have run it through a hex dumper and started eye-balling the bytes. I may need to spin the anemometer to generate events to get readings, but this looks good.

I’ve also now connected it via a LoRaWAN link and have the data flowing back to me via MQTT. I need to compress the data as well as recording and averaging the readings, since the standard interval time of 16 seconds would exceed the fair-use policy of The Things Network. Meteorological masts (or ‘metmasts’) conform to an IEC standard, but mine can be much less rigorous than that: I’ve decided to take ten measurements and transmit the min/avg/max of them every 160 seconds. Given enough compression I think I can get the seven measurements (wind speed and direction, temperature, humidity, UV, lux, rainfall) into less than 10 bytes.

The git repo is up on BitBucket.

Emergencies

I’ve just encountered one of the interesting aspects of our drive to buy everything online: emergencies. It used to be that when you lost an item, say a power cord for a computer, that you would ask a friend or colleague, or go to the shops. With the push for ‘everything online’ that last choice has disappeared.
In the 90s there were many places where you could find spare items for your travel kit. I often added to my kit bag when travelling through an airport–the electronics shops there had lots of things including mosquito zappers, bug spray, ear buds, headphones, travel pillows, clothes detergent, and many odd fitments for your average travel worrier. Failing, the absentminded would exit their warm hotel and venture into the local shops to buy things from many places which stocked bits and parts. They used to be as frequent as nail bars in my local shopping area.

Now, along with the growth of fixed-price betting shops (and those nail bars), I miss those electronics shops replaced by endless coffee bars and empty hoardings. So commerce has moved online where prices are cheaper, but the immediacy of picking things up when you wanted has gone and I’m back to ‘making do’ for two days while my latest purchase is delivered.

Feelin’ melancholic

Long way back I read a book which spoke of four types of personality. Nowadays we recognise five broad trait dimensions or domains, sometimes called the “Big Five”: Extroversion, Agreeableness, Conscientiousness, Neurotic-ism, and Openness. The 1960’s book wasn’t to blame for only choosing four since even longer back people talked of four elemental substances, such as earth, water, air, and fire. Especially the ancient Greeks, and they had some pretty good ideas.

But regardless – a personality type of ‘melancholic’ was one of the four types and these types of people were meant to be more prone to moodiness, feelings and deep thoughts.

I reject this now. My whole life experience suggests that instead of general types of people and categories into which they fall, that rather everyone has umpteen dimensions and lies in a spectrum along each of those. So I may be good at one thing and bad at another, while my neighbour is average at both. The point being that there is hundreds, if not thousands of these dimensions and everyone has them in different quantities and qualities. Understanding people through a lens of a specific type is almost as useless as handwriting analysis, which simply tells you that the writer is a person with human features – and yes, I read lot of books about that as well before realising that just speaking to someone for five minutes would reveal far more than hours of looking at their handwriting.

So when I ‘feel’ melancholy I associate it with a certain type of mood, or a combined feeling of warmth, wonder, content and amazement at things. I know that the word is meant to evoke deep feelings of gloom and pervasive sense of impending event, but I associate those more with depression and a lack of ‘agency’, or the ability to impact my own existence. I think some Heidegger, Sartre, or perhaps just plain Thoreau would be good at this part!