Category Archives: Adafruit

Terminal Login

I made this as a continuation of my current work with the NEO2 but there is no reason why this could not be adapted to other boards. There are also many ways to achieve the same thing i.e. colourful terminal login – this is merely a what I chose to do.

promptSo I like colourful terminals when working with little boards like the Raspberry Pi , NEO and many others.  I’ve long since gone off using the graphical interfaces (unless I’m making a media centre) – and play with the boards mainly from my Windows PC using WinSCP which gives me graphical access to the file structure and the ability to use Microsoft Studio Code (I used to use Notepad++ but that was, it seems, a lifetime ago).

Continue reading Terminal Login


Adafruit GFX

I’m hoping someone can save me a learning curve here.  I’m messing with the Adafruit GFX library here with a view to making a subset of my normal MQTT-based code supporting the little 160*128 LCD displays. All of this is working – I can put text up directly from an MQTT message – no problem.

But I’m having trouble getting my head around the GFX fonts.

Firstly – there seems to be a source code command line tool for generating fonts – and I need an LCD-type font… but I cannot find a precompiled version of the tool or similar for Windows and reference to Windows is so vague in the GFX info I’m not sure I want to go experimenting. Has anyone successfully made fonts in Windows for this library?

Secondly font height. The cursor positioning is based on pixels – and it seems that if you want to go to line X of text you have to guess how many pixels you need to use as a multiplier – that can’t be right surely?  There is a function for figuring out the XY bounds of a string so you can use a block erase before writing but that too is in pixels and assumes you know the height of the font. Surely there must be a function somewhere that simply returns the height of the current font?



External Drive for Pi2

I’ve read many articles about serious use of the Raspberry Pi and I’m now convinced that there is very little chance of mounting a Pi in a cupboard with MSQL and other write-intense programs – and expecting it seriously to last for a year or 3 because of the limited writes you can do to SD memory – that includes the ones that have wear-levelling.

With that in mind I’ve just strapped a hard drive to the Pi2. You cannot (it would seem) BOOT off the hard drive but you can put your entire file system onto there.

There are many, many ways to do this but as is often the case, Adafruit have a simple way.

Make sure you back up your SD before starting any of this in case it all goes to pot.

So in total:

I found a lead that has 2 usb and one mini-usb plugs – so that you can plug the drive into a power AND into the Pi  - I did this because the Pi will not power a hard drive – just not quite enough juice available. I plugged everything in and made sure the drive was whirring.

I followed the instructions on the above line from just under half way down below “If you’re using a stock  Raspbian install”.  I grabbed their helper. As I tried to follow the next instruction it went off to the internet for an update but proceeded automatically from that point on.

This helper program not only formats the external drive – but also uploads all your material from the Pi onto the external driver AND changes the file that determined on boot where to get materials from.

The instructions said “this will take a long time” – it took around 5 minutes as I wrote this blog. At the end of it I noted “your new root drive is accessible under /mnt. In order to restart with this drive at /, please type: sudo reboot”.

With a slightly elevated heart rate, after all this really WAS too simple….  I followed the instructions.

Well, much to my HORROR – tests showed that although there was indeed a new drive, I was not using it. I found 2 www. directories (one on the SD, one on the drive) and modified the one attached to the hard drive.  a quick run of the default web page (in the process of installing webmin you end up with a LAMP installation and hence a web server)  showed that I was NOT running on the hard drive.

So – I went looking into /boot/cmdline.txt – which is the file that tells Pi where to use for the root directory. It had INDEED been updated from:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p6 rootfstype=ext4 elevator=deadline rootwait


dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

All very nice but not what I wanted – it should be pointing to the external drive. Could it be a simple as changing that bold text to /sda1 ??

YES was the happy answer.. I updated the file and checked the web page and sure enough I was now looking at the updated version!!

And now, to back up that hard drive before I go any further!!

Or maybe a trip out with my good lady for a beer… (which is what actually happened…)