Category Archives: Hardware

Cheerlights 2016

Cheerlights is a project that synchronises the colours of internet-connected devices around the world.  Anyone can choose the current colour simply by sending a Tweet that includes the word ‘cheerlights’ and the name of a colour (one of red, green, blue, cyan, white, oldlace / warmwhite, purple, magenta, yellow, orange, pink, or black).

The current colour is :

The Cheerlights website has all the information about how to get involved, with lots of examples of projects to inspire you.

So here’s another one.  Nothing radically original: the hardware is adapted from various sources, although the software is largely my own.  When no new colours come through for a while, it displays a randomly changing hue.

It’s currently installed in our kitchen, as mentioned in a recent Tweet.


The heart of the gadget is the ESP8266 chip, which can run quite sophisticated code and has built-in WiFi connectivity.

ESP8266-12E packaged as a NodeMCU board on the Lolin power supply and breakout base

For convenience, I used the ESP8266 packaged as a NodeMCU Devkit ESP8266-12E, and plugged that into a Lolin NodeMCU Base Shield.  The base allows me to plug in a single 12V supply that provides power for both the NodeMCU board and the LED strip.

LED strip

I used a cheap strip of RGB LEDs [… need the specs — current drawn etc.] — not the clever WS2811 / ‘Neopixel’ ones.  The only issue with them is that the colours aren’t balanced: for example, mixing maximum red and maximum green (to get yellow) gives a nasty shade of yellow-green.  I had to add some factors in the code to allow for this.

Interface board

The home-made bit of the hardware converts the PWM (see below) signals to the voltages required by the LED strip.

The circuit I ended up with is derived from

Please note that I don’t really know what I’m doing with electronics: if you make use of this design, you must do your own checks and testing to make sure that the circuit doesn’t draw too much current or overheat.

It uses three IRL520N MOSFETs, one to control the 12V supply to each colour, as driven by the signals from the ESP8266.

Breadboard layout for the MOSFETs

The circuit layout, as a breadboard design created in Fritzing is shown.  The .FZZ file can also be downloaded.

NodeMCU, interface board, and LED strip.  (This shows a strip with separate red, green, and blue LEDs; I later used a better strip with proper three-colour LEDs)

I transferred the MOSFETs and resistors to stripboard to make it more permanent.

Close-up of the NodeMCU and interface board

The circuits are mounted in a cardboard box, and held in place with Blu-Tack (other brands of sticky stuff are available).


The hardware runs the NodeMCU firmware, which is thoroughly documented, and provides a Lua interpreter/compiler and filesystem.

The NodeMCU was supplied with version 0.9.6 of the NodeMCU firmware, which was fine until I need to use the ‘http’ module.  For that, I downloaded a custom-built version of the latest firmware from the excellent service at  My build included just the Lua modules that I needed, freeing up valuable space on the hardware.  The firmware identifies itself as

NodeMCU custom build by
 branch: master
 commit: 81ec3665cb5fe68eb8596612485cc206b65659c9
 SSL: false
 modules: file,gpio,http,mqtt,net,node,pwm,tmr,uart,wifi
 build built on: 2016-12-09 18:27
 powered by Lua 5.1.4 on SDK

I found that I needed to erase the firmware before trying to upload a new one.  I used and these commands (adjusting the serial port and firmware filename to suit): --port /dev/ttyUSB0 erase_flash --port /dev/ttyUSB0 write_flash -fm dio 0x00000 "nodemcu-master-10-modules-2016-12-09-18-27-52-integer.bin" --verify

The board has a micro-B USB socket which can be connected directly to your computer, and provides power as well as the connection for flashing firmware and uploading your own Lua code.

The software that gets the colours from Cheerlights and sends them to the LEDs is on Github.

I used the ESPlorer IDE to upload and run the Lua code.

You will need to rename the file wifi-ssids.example.lua to wifi-ssids.lua, and then edit it to include your own SSID(s) and password(s).

Once you’ve got it all running, you can rename test.lua to init.lua so that the code will run automatically when the circuit is powered up.

It’s a bit quirky.  At one stage I seemed to be getting an unreliable feed via MQTT, so I added code to use the HTTP API instead.  Now it uses both feeds, just to be sure.  As a result, it would be very easy to add another ‘colour source’, such as a temperature sensor, to control the colours.

Features / Bugs

  • To keep the light level fairly constant, each colour is scaled so that R+G+B is the same.  This means that the difference between purple, and magenta is lost.


‘Installation’ is probably too strong a word.  I just stuck the LED strip along the shelf above the kitchen cupboards, tucked the hardware in amongst the crockery, and plugged the power supply into the socket that usually powers the extractor fan.

Here’s the final result — making our new kitchen look very cheery.


  • The software PWM sometimes seems to cause flickering.  Using dedicated chips for the PWM might help.


chkdsk hangs — but not from Vista

I usually run chkdsk from a bootable CD such as Hiren’s, but today I had a Vista machine with a disk fault, and chkdsk from the CD kept hanging at 1% of phase 4: it got completely stuck, and I had to force the computer to power off.

I thought that the disk must be completely borked, but in fact it did boot into Windows — but very slowly.  And when I set Vista’s chkdsk to run on restart, it worked perfectly: it just found bad sectors in one file.

So, the moral is: don’t dismiss the idea of running chkdsk from the faulty disk, even with Vista.

Panasonic KX-MB2000E on Linux

Notes on the Panasonic KX-MB2000E.

The printer — sorry, it's not a printer, it's a <q>Document System</q> — has a web interface: the user name is 'root' and the default password is '1234'.

Installing it as a printer on Xubuntu 11.10 was straightforward, once I'd done a bit of research.

Panasonic give instructions for Redhat here:

This is what I did on a laptop running Xubuntu 11.10:

  1. Download three .rpm files from
  2. Use alien to convert them to do .deb files.
  3. Use dpkg -i to install them.
  4. Connect the printer (I did it on the LAN).
  5. Use CUPS to set up the printer: when it asks for a PPD file, use the one in /usr/share/cups/model/kxmb2000.ppd.
  6. Done.

The scanner was more tricky — research suggested that it couldn't be done, and SANE had no reference to it.  But as the printer is capable of scanning to an FTP account or a Samba share, I set up a 'Scans' folder with write access via Samba, and entered the details on the printer (via the web interface or the buttons on the front).  And it works!  Pressing the Scan button and choosing SMB in the printer menu puts a PDF file in the Scans folder.  There's little or no control over scanning settings, but it's a start.

I tried to add this information to, but every time I try to log in there, I just get an empty page.