Weather calendar: ESP8266

The ESP8266 is an incredible little module produced by Expressif. It combines a little processor with a WiFi chip that can act as both a client to an existing wifi network, or as an access point to create its own network. At around $2 it is as “cheap as chips”!

I saw an excellent example of using a variant called the ESP-01 to run a remote e-ink display, along with the code to run this in Python. Whilst it was very attractive and had lots of function, it did not meet some of my earlier requirements of being low-powered as the ESP8266 chips still require about 70mA of current to run. So I could not run a battery powered system on this for long, although the simplicity of the setup surprised me in how easy it was to get the demo program working.

img_20160930_235422

I used a few websites to get started, preferring to connect to the ESP-01 using a CP2102 UART – USB module which I already had (and could set to either 5V or 3.3V – the ESP8266 uses only 3.3V). Once connected using the appropriate bits of wire and remembering that Tx-Rx and Rx-Tx on either board, I then had to set the ESP-01 into station mode, connect to my wifi locally, and start the server. Commands were roughly:

  • AT+GMR, to get the firmware version
  • AT+CWMODE=1
  • AT+CWJAP=”ssid”,”password”
  • AT+CIPMUX=1
  • AT+CIPSERVER=1,3333

… but see the sites referenced to better understand these modem commands and how the embedded server works. I like this chip and I’m going to order a few more just to have if I later want to wifi-enable more projects.

Links

 

Remove packages from a list of .deb files

I have installed a set of Linux packages from a directory of .deb files. I then wanted to uninstall them, but trying to guess the package names was hard – even harder was wading through the sheer amount of files to remove them! Linux has this weird thing where you can installed from anyrandomname.deb file, but you have to remove by package name.

A bit of Googling and some short script work got me this:

#!/bin/bash

for f in *.deb;
do
 pak="$(dpkg-deb -f "$f" Package)";
# echo $pak $pak
 sudo apt-get remove $pak ;
done

Every deb file is listed, examined and the packages listed then uninstalled by package name. While there may be more elegant ways, this seems to work!

Where did telephone numbers go?

Back in the day telephone numbers represented a house. People in organisations or from domestic dwellings would call houses and then ask for the person to whom they wanted to speak. Today we call another’s mobile and almost disregard what number we are calling, or use any number of mobile apps which ignore the whole idea of telephone numbers such as WhatsApp.

But he main purpose of fixed line numbers today seems to have become finding out who called you, and ignoring them. This can be done from a mobile of course, but think about this:

  1. We used to have printed telephone directories when you wanted to call someone else’s house.
  2. Commercial organisations would list their names in a colourful printed directory, sometimes call the Yellow Pages (or blue or pink in other countries).
  3. We would find people through directories and contact them via their fixed line telephone number.

oldman

So the important points are that:

  • People/organisations would be discovered through a directory
  • Numbers represented the route to contact that person or organisation

Present day

Today, the main use for fixed lines numbers seems to be typing them into Google and trying to work out ‘who called me’ – the plethora of web sites which provide such services seems to indicate that it is a growth business!

Following the theory that the best new businesses are those which remove part of an established process (think Uber – remove the payment, think AirBnB – remove the property) then we have moved to the place that telephone numbers have all but disappeared, and which specific telephone number we have is almost irrelevant, since no-one dicovers us, nor contacts us anymore through the use of a string of digits.

Design Thinking is not a spectator sport

dt

Many times when I have led Design Thinking classes one observation I have made is that those workshops don’t work well if there are ‘observers’. Whatever reason they may have, people who are not engaged with the participants – either talking amongst themselves, or absorbed in reading their email on laptop or phone, destroy the energy and engagement in the room.

Sometimes it is hard to deflect them – one occasion was that a senior manager from my organisation wanted to “see the effects” of a design workshop and joined us, only to sit doing their email on a laptop in the middle of the classroom. Other times it is because some urgent business reason has arisen and a student needs to communicate with other colleagues in the business – which is a perfectly valid reason and should take priority.

I no longer allow them, and gently suggest that they should either participate or leave the room. If events arise I believe that a professional person should either (a) step outside the room and deal with the matter, or (b) excuse themselves from the duration of the class. I’m happy with both: we are adults and you don’t need my permission, but to get the best outcomes for both yourself and the rest of the class I need you to:

Be Here Now!

Creating a clock using ESP8266 wifi and electronic paper

My current project is a clock using electronic paper which will run on batteries, access the internet to set the local time using the ntp protocol, and use a real-time clock to maintain accuracy.

Alternatives

I considered a number of ways of coding and controlling this display. Fundamentally I’d have to drive one of these e-paper displays, and secondly run from battery for long periods. Ideally I’d like to connect to it via wifi to update code and change things, and the clock would be a real-time clock driven by an accurate crystal with battery backup. My options seem to be:

  1. Single board computer with full Linux operating system
    • Odroid C1+
    • Raspberry Pi Zero
    • … your favourite SBC
  2. Embedded controller (of which the Arduino is a well-known type)

List of components

  1. Arduino Uno, for initial prototyping
  2. Embedded Artists EM027BS013 from Cool Components
  3. Adafruit Feather HUZZAH using the ESP8266 wifi chip
  4. Adafruit PowerBoost 500
  5. Adafruit Precision RTC featherwing daughter board

The HUZZAH board forms the main part of the clock with it’s ESP8266 ability to create a wifi access point, or join a existing wifi network. It can also be programmed using the Arduino IDE which is an advantage for those familiar with that environment. The PowerBoost may not be necessary as the HUZZAH provides a JST battery connector and can charge a LiPo/LiIon battery already, while the RTC daughter board will keep the time stable over extended periods.

The story thus far

On considering the single-board computers such as the Raspberry Pi I realised the power requirements of keeping a full OS and file system up meant that my clock would only run for about 9 hours maximum before needing a charge. There are plenty of comparisons around showing the differences between embedded controllers such as the Arduino versus the SBCs, but suffice to say that I thought achieving low power was easier with the controllers. The ease of programming the SBCs keeps me looking at something like a RaspPi Zero to see if it can be switched to low power, but I’m leery of starting down that route before exploring the other options.

Getting the Arduino controlling the display was easy.

IMG_20160730_134127

As the Embedded Artists display is using the RePaper / Pervasive Displays reference model and their code is up on GitHub made it easier to get help and understand what was driving where. I also found that Google was my friend, although getting the Arduino driving the display was simpler than moving that code onto the Adafruit.

Starting with the Arduino Uno was easy as Embedded Artists have the code up on Github for that and a couple of example programs. Very quickly I realised that there were two different versions of the display (revisions A,B,C) and I had the second one, revision D. This used a different pinout arrangement and the display started to look muddy and with multiple ghosted images. Once using the correct Git repo things quickly turned right and the demo programs could be run.

Feather HUZZAH

The Adafruit Feather HUZZAH is an excellent platform in a small form factor, and with lots of support and documentation. I was impressed and also purchased the ‘Featherwing RTC’ as a precision real-time clock.

However the lack of GPIO pins on that particular Feather board meant that I could not have controlled the display – perhaps other e-ink displays have less control lines but mine needed around 10 GPIO pins free.

Micropython

I’ve been a fan  of Damien George’s micropython since the early Kickstarter days, and twice supported it – for the initial board and the implementation onto the ESP8266. I love the language, but have never found a place to use it as the SBCs kept me busy with their Linux OSes and things such as Node-RED and Ethereum. But these Python boards are excellent and low-powered, and I get to program in a language I like. An unexpected gift was Peter Hinch’s full library for the Embedded Artists display – this demonstrates to me what a professional micro-controller programmer can do, even if he is retired!

So I may go down the micropython board route and ignore the wifi requirement for the moment. My version 1.0 board does not have pads for a JST battery connection although the v1.1 boards do, plus it already has a RTC that can be backed with a coin battery.

A Tale of Distraction

  1. Open tab in browser
    1. go to video game site
    2. download it
    3. played it
    4. noticed save game button
  2. Thought of ways to hold save games between computers, such as Linux or Windows.  After all, this was a cross-platform game!
    1. Box/Dropbox or similar?
    2. Owncloud (I used to run this on an older server)
    3. I have a SBC which is not in heavy use
    4. I have a 1TB USB drive which could hold Owncloud server …
  3. Installed Owncloud
    1. proxy rules on my nginx front-end server
    2. php installed on backend
    3. mariadb rather than MySQL
      1. there isn’t a executable for ARMhf
        1. download
        2. compile
    4. Went with MySQL because at least this works on ARMhf and there are executables in the repo
  4. … and so on.  I didn’t play that game again so all the above was lost, however I DO now have a great mechanism for sharing between computers.

This tale of distraction isn’t unique I know – XKCD wrote about it and we’re all afflicted in some degree, but it is interesting to me how much of my day is based around following-the-white-rabbit down the rabbit hole.  All good stuff!

Running Teamspeak on ARM

Teamspeak is a voice chat server which is very popular in the gaming world.  Clans and casual gamers use it to communicate during gameplay, and as it is not tied to one game publisher nor gaming platform (such as Steam, which also has a voice chat feature) so it can be used cross-game and cross-publisher. It is also very easy to set up and create channels, as well as allocate users and blacklist rogue elements or misbehaving players.  In addition you can use it for limited number of players for free – up to 32, beyond that there is a licence model for hosting providers and the like.

I’d previously run a very small Teamspeak server for my son’s clan on a Atom-based barebones PC, using a mini power supply and a flash hard disk on a SATA connection.  This worked well, but the small CPU hardware fan was annoying until damped down by a speed controller, and the electricity of 20W per day was unnerving, especially if no-one was using the server during the day.  That’s it below, and the mess of wires is just how it works.

redwall IMG_20160404_141846 IMG_20160404_141913

The problem was that Teamspeak only runs on Android/iOS and x86 architectures, there is no compiled binary for ARM architecture and none forthcoming. The endless requests on their forum proved this, and the continual “there are no plans for ARM” didn’t raise any hopes that the company was thinking of compiling their binaries for this platform.  Most single-board computers now are running ARM architecture, even though Intel is good it doesn’t have the cachet with the geek community in this space.

Therefore my wall of Raspberry Pi, Beaglebone Black and Odroid devices wasn’t able to run Teamspeak and I had to have an extra board hanging on the wall with lots of cords.  That was, until I discovered Eltechs – a Russian company who specialise in binary translation layers and whose Exagear Desktop was exactly that: a utility which allowed binaries compiled for x86 to run on ARM architecture devices.  I’ve now installed Exagear Desktop for about £24 on a single licence, and over a late Sunday afternoon’s coding and configuring got it running!  And it runs well!  Now, my wall of SBCs looks much neater and has just two BBB running NodeRED and other house control functions, while the Odroid is taking on the Teamspeak server (Odroid seems to have more capable boards than Raspberry Pi or Beaglebone) which it does without breaking into a sweat on its 4-cores, and then alongside is the newer Odroid C2 with a 64-bit architecture and the latest and greatest Ubuntu 16.04.

The outcome?  Much lower electricity consumption, and a set of always-on servers.

Working with a walking desk

My new home treadmill arrived several days ago, and having fought off a bout of flu I have started using it.  It is positioned under my Ikea standing desk which is much MUCH cheaper than the ‘official’ ones – it is a Frederik desk like here, and they really do work well.

The treadmill is a domestic one sold by a UK reseller, although most likely sourced from China somewhere.  The important point is that it is quiet, low, and slow.  I won’t be running a marathon on this thing and it isn’t meant to go fast like a gym one.  Instead, continual slow sessions of walking will accumulate into a workout will still meaning I can take conference calls and work at the desk.

This piece has been written while using it and I have to say it is a really, really easy thing to get used to.  I was impressed by Stephen Wolfram (of Mathematica fame) who used one, and also Neal Stephenson and his diatribe Arsebestos wherein he explains just how much sitting down is killing us.  Now, I don’t take that as evidence nor my own annecdotal experience but I do observe that when I used a standing desk I never had any back pains, and when I gave up for some time and re-used an office chair I ended up with a sacro-illiac joint problem which extended painfully for some months.  So back to the standing desk, and now the treadmill, and onwards to Skeletor!*

* (A character in Stephenson’s Reamde who is a lore writer).

A breeding-pile has appeared on my cabinet

I recognised the symptoms; interesting projects are being stored in all the right places, the hopper in which the ‘will-be-fixed’ items are placed has started overflowing, and along with the ‘essential-but-it-is-winter’ (so can’t be stored in the shed) the leftover bits from work exercises and the quirky-but-fun presents from family have started to accumulate on the only available spaces in my study and I think they have started to breed.

IMG_20160320_134708

The evidence is unmistakable, even if easily refutable.  The pile has grown larger in the past year since I refurbished and painted the room in place (moving piles around from corner to corner) and since setting up the standing desk with home treadmill and whiteboard wall.  The pile is now comfortable territory and sometimes I wave and greet familiar objects jutting from its edges – projects started one weekend and then abandoned when the working week intruded, or essential fixing tools which have to be close at hand when needed, then not returned to their place in some drawer.

As Stephen Covey observed (The Seven Effective Habits of Effective People) those who get the most done, decided beforehand what to do.  They prioritise, they categorise, they get things done.  Mostly, I’d have to admit, by deciding a lot of what not to do.

So the need remains, and I have one radical solution.  Dump it all in my son’s room.  He’s away at university and I can pretend that sweeping it into there will somehow help me declutter myself over here.  Done.

I might build a smart mirror

I took a read of this and thought I could build my own smart mirror.  I have a couple of LED mirrors already which have lights either in the mirror, or underneath it.  Both have heating pads to remove misting so I guess that that will have to be removed, but otherwise it seems quite a straightforward build.

Now to source some components!