Set up thinkfan on Lenovo Thinkpad T430 – Ubuntu 16.04

If you have a Thinkpad T430 you’re probably quite familiar with some of the issues with how the BIOS handles the system fans. Luckily, we have third party utilities for fixing this.

If you’re running Windows, you will want to install tpfancontrol. For the Linux people, you will want to install thinkfan.

I recently installed Ubuntu 16.04 and all the installation guides appear to be out of date so I’d like to document procedure for installing thinkfan on Ubuntu 16.04:

Install the software:

sudo apt-get install lm-sensors

Edit /etc/thinkfan.conf and set up your sensors in the configuration file. The latest version of thinkfan at the time of writing is 0.9.1 and the configuration file has changed a bit. Note the use of “hwmon” instead of “sensor”.

Here is my configuration file – please adjust for your machine. Note: I have a SSD in my machine so I’m not concerned about hard drive temperatures:

hwmon /sys/class/hwmon/hwmon0/temp1_input
tp_fan /proc/acpi/ibm/fan

(0,	0,	60)
(1,	57,	65)
(2,	63,	75)
(3,	72,	80)
(4,	78,	90)
(5,	87,	95)
(7,	92,	32767)

To find out what paths to use for the values above, use the following command:

sudo find /sys/devices -type f -name "temp*_input"

You can add them all in but I’ve chosen to use the “virtual” device which appears to be a summary of the others.

Enable fan control in the thinkfan_acpi kernel module:

sudo echo "options thinkpad_acpi fan_control=1" >> /etc/modprobe.d/thinkpad.conf

You probably need to reboot now.

After a reboot, you should be able to test out your configuration by running thinkfan in no-daemon mode:

sudo thinkfan -n

Once you’re happy with your configuration, you can set thinkfan to start at boot. Ubuntu 16.04 is now using systemd so the command to do this is:

sudo systemctl enable thinkfan.service

Thanks to Ivan at for most of this. I’m just updating the information for Ubuntu 16.04 and adding my personal configuration.

Comments { 1 }

Internet Radio Project

I want to share my latest DIY project with everyone: A Raspberry Pi based internet radio. Making this has been a blast and I’m very happy with the results. It performs nicely and sound pretty good. (It’s not Audiophile by any means).

I had a few specific goals for this project:

  1. It had to look good. Or at least, it shouldn’t look like I just stuffed a raspberry pi into an ice cream container and gave up. It had to be something I could put on a shelf or table in the lounge and have it not look out of place. I went for the retro vibe and built a timber box. The point color is called “Feisty Red” and I love it. You might be surprised but this was, by far, the hardest part of the whole project.
  2. It had to be simple to use. My initial goal was to be able to have music playing with the press of a single button.


The project uses the Pi MusicBox distribution for the Pi. This provides a solid base with all the bits you need already installed. It also has great support for many popular DACs already built in. At the core of this is the Mopidy music server. This is what does most of the heavy lifting and through the use of special extensions, you can enable your Raspberry Pi to play or stream from a wide variety of music services like Spotify or Google Play Music as well as local or networked files. I’m using the Spotify service in particular but I also want access to other internet radio streaming services like SomaFM and

Basic operation

The entire radio is driven from a single rotary encoder. A short press on the rotary encoder will start or stop playing. If no playlist is loaded, we load a default playlist automatically and start playing. Turning the rotary encoder will adjust the volume. If you long press the rotary encoder button, a menu will be displayed.

I built a simple frontend extension for Mopidy which hooks into their core API and allows receiving of events (like the currently playing track). This extension is also responsible for receiving input from the rotary encoder, updating the LCD and driving the menu.

If you need to do anything fancier, you can connect via your phone or web browser and control the radio using the full interface.

If you’re interested in the python LCD menu system, the code is available here. The code for the extension (warning: work in progress and in need of cleanup) is available here.


  • A Raspberry Pi Model B
  • A 2.2inch 240×320 TFT LCD (ILI9341 controller). This particular LCD works with the Adafruit library available here.
  • The amplifier is rated at about 3W which I built from a kit (available from Jaycar electronics)
  • A dodgy speaker that I pulled out of an old Logitech subwoofer.
  • I built my own power supply board with dual rails of 5V for powering the Pi and +-12V for powering the amplifier.
  • A rotary encoder


Here you can see the bits and pieces mounted inside the case. The power supply to the left, the amplifier board to the middle and the Pi (with USB sound card) up on side in the middle. The black box on the right is a ground loop isolator which helps reduces noise from the power supply getting into the signal. If I was more skilled at power supply design I might have been able to get away without this… but alas.

I would like to try and capture a video of the menu in operation… but for now, here is another picture. J

Comments { 0 }

Share a folder on your Raspberry Pi using Samba

I often need to share a folder on one of my Raspberry Pi computers. Here is the process I use:

Install the software:

sudo apt-get install samba samba-common-bin

Check that the daemons have been started:

sudo service samba status

Make a folder to share:

mkdir ~/share

Add your share to /etc/samba/smb.conf

[My Share]
  comment=My Share
  only guest=no 
  create mask=0777 
  directory mask=0777 

Set a samba password:

smbpasswd -a pi

Restart samba daemons:

sudo service samba restart

Test it

Now you should be able to see your share over the network and log in using your user/password entered above.


If you cannot see the share, make sure that you have restarted the daemons and that they started back up. If you can see the share but cannot access it, check that the path you entered actually points to a valid location and that your user has the rights to access it.

The next step is to have a look in the log files which are located under /var/log/samba

Comments { 0 }

Twitter Account

If you need to find me on twitter, my new handle is @andrewj_nz

Well, it’s a long story… No, actually, it’s a short story. I was hacked. A note to everyone: Always use strong passwords.

Comments { 0 }

Raspberry Pi: Clean Install to SSH Headless Box

Ever since I got hold of a Raspberry Pi computer, I’ve been singing its praises to anyone unlucky enough to be standing close to me. Not only is it affordable (even after you’ve bought/repurposed all the supporting gear) but it’s cheap to run 24/7 because of the low power consumption of the hardware.

I mostly use my Pi’s headless (no monitor, mouse or keyboard) and then use SSH / Remote desktop to connect to the machines over the network from my Uber desktop machine.

If you want to do the same, you can follow these steps but just tweak them for your own requirements.

Install Raspbian

Follow the instructions here on how to download and install the NOOBS Software onto your SD card. From there you can install a wide range of specialist operating system designed for the Pi. I generally stick to the recommended Raspbian distribution.

Configure Basic System Settings Using “raspi-config”

  • Update raspi-config to the latest in case they’ve made any bug fixes.
  • Set your password.
  • Set your host name. The host name is how your new machine will be identified on the network. Give it a nice, descriptive name because you’ll use it often.
  • Enable SSH. This will allow you to connect to the machine over the network and get to the console.
  • Set locale options : Locale – “en_US.UTF-8 UTF-8″

To get back in to the config program once you’ve quit, enter the following
sudo raspi-config

Change keyboard layout from “UK” to “US”

The keyboard layout is set to the UK by default. If you’re not in the UK, this will cause some issues (e.g.: tying “#” will give you a “£” instead). Let’s fix this.

sudo nano /etc/default/keyboard

Change XKBLAYOUT to “us”


sudo reboot

Configure Networking

By default, your Pi will be configured to use DHCP. I prefer to set up static IP address for my servers. Change these to match your network.
sudo nano /etc/network/interfaces

iface eth0 inet static

Assign a .local domain (Multicast DNS)

Install the Avahi-daemon so that you can refer to your Pi by name rather than use an IP address. There are other ways of doing this but I’ve found that this approach works nicely.

sudo apt-get install avahi-daemon

Now, if you don’t have it already, download and install Bonjour on your Windows machine from here. This will allow windows to be able to discover multicast DNS services like the one published by Avahi.

After you’ve installed Avahi (on the Pi) and Bonjour on your windows machine, you should be able to locate your raspberry pi on the network by its multicast name. (Your host name with a “.local” on the end).

Note: If you get an error from Avahi which mentions an existing unicast .local domain, fix it by doing the following:

sudo nano /etc/default/avahi-daemon


Connect to your Pi remotely via SSH

If you’re on a windows box, download and install Putty.

You should be able to connect via SSH using the default settings.

Enter your username and password and you’ll get to the SSH console.

Install Remote Desktop

sudo apt-get install xrdp
You can now connect to your Pi and get an X desktop environment using remote desktop.

Enter your username and password when prompted and you’ll be treated with a remote X session.


Congratulations, you can unplug your monitor and keyboard and hide your Pi under the desk or in a cupboard.

Now, time to get a second Pi?

Comments { 1 }

Noon // 053

Really enjoying the latest Noon Pacific Mix…

Comments { 0 }

Async & Await Talk – Slides and Demo App

I presented a talk on the async and await features in .NET at an Aderant Lunch & Learn session.

For those who are interested, I’ve uploaded the slides and demo application to Github.

Comments { 0 }

Resources: LINQ / LINQ IQueryable providers

I’m currently taking a deep dive into LINQ and here are the resources I’ve found most valuable:

Expression Trees

A really good introduction to expression trees:

IQueryable providers

LINQ: Building an IQueryable provider series:

This question on stack overflow has some useful answers:

Comments { 0 }

Happy New Year

It’s 2013 now – happy new year everyone!

My only resolution for this year is to finish some of the things I’ve already started.

Comments { 0 }

Graphical User Interface Timeline


As a “GUI “ guy and a general “tinkerer of operating systems” I really love looking back at how far we’ve come with computing.

Some of the original system which started it all are before my time and are only interesting academically, however, the ones I experienced personally while growing up are quite nostalgic.

Comments { 0 }