Soldering on

I mentioned yesterday that I’d been listening to the radio and promised to say more about that.

Now, listening to the radio is perhaps not all that unusual, although it’s not something I do very often these days. What was notable, or at least a source of great satisfaction to me, was the fact that I was able to listen to this particular radio, which I’d managed to break several days earlier.

The radio in question is a fairly cheap little portable DAB radio that I picked up a couple of years ago in order to be able to listen to my favourite stations (mostly that’s Radio 3, Radio 4 and Radio Cymru, with occasional forays elsewhere) without all the extraneous noise that tends to happen with analogue radios, especially if (like me) you live in an area with not particularly good reception. In fact, I think they are due to be turning off analogue broadcasting sometime soon if they haven’t done so already (or maybe that was just TV – I’ve not had one of those for several years but I’m fairly sure they are digital-only by now).

I didn’t actually use this radio all that often but recently I’d started tuning in again a bit more frequently (mostly the other week when I was working in my shiny new home “office” – aka my sitting room but had my music collection on the PC in my bedroom and hadn’t yet succeeded in setting up my Raspberry Pi as a music server from which I can access my music anywhere in the house; that is now up and running pretty well, and I may even get round at some point to tweaking it so I can access it from outside the house – not that there’s a lot of point in that just now; anyway, I digress!).

All was good until a few days ago when I moved a trailing extension cable, completely forgetting that the radio was plugged into it and sitting precariously balanced on a shelf at just about the extent of its power cord’s range. The radio came crashing down on to the floor. I picked it up and put it back, admonishing myself to be more careful next time, and then proceeded to get on with playing music on my Pi (controlled via ssh from my laptop), which I had by this time managed to get working.

I didn’t discover the problem until a couple of days later when I decided that, since I no longer needed the radio to listen to music while I worked, I’d put it in the kitchen to enjoy music while I cooked or washed up. I then discovered that the radio was not working, or at least it started ok and then stopped with a message about low power despite clearly being plugged in and turned on at the wall. A brief inspection revealed that the power connector was wobbly (to use a technical term).

Undaunted, I dug out a screwdriver and took the back off the radio (after unplugging it from the mains, of course, and being very careful to avoid going near any capacitors inside. It turned out that the power connector (a micro-USB socket) is surface-mounted to a PCB and held on by four fairly flimsy solder connections, all of which had got disconnected as a result of the radio being yanked off the shelf by its power cable.

Still undaunted, I figured that it was worth a shot at resoldering the thing since the worst that would be likely to happen would be a non-functional radio, which I already had, and there was at least a chance I might manage to get it working again, which would obviously be better than consigning it to landfill and having to either buy a new one or do without. I’d say my soldering skills are fairly rudimentary (and quite out of practice) but just about up to a relatively simple task like this.

Actually the hardest, or at least the slowest, part of the task was probably digging my soldering iron and related equipment out of the garage, where I’d left them after my latest burst of enthusiasm for electronics waned a few months (or years?) ago. The soldering itself went pretty well and I soon had the connector more or less firmly attached to the PCB once again. After that it was a simple matter to put everything back together and find out whether it would actually work.

It did, and so far is still doing so (well, not right at the moment as I’ve got it switched off, but I’m confident it will work next time I switch it on unless I’ve managed to pull it off the kitchen windowsill and break it again by then). And now I’ve dug out my soldering iron, along with several boxes of components and a handful of books, I may just have another go at getting back into electronics.

(In unrelated news, today is the anniversary – 33rd, or thereabouts – of the violin grade 1 exam that remains the pinnacle of my qualifications, if not my actual achievements, in practical music-making. I can’t remember whether I’ve ever played my violin on the radio, though I have apparently played it on Romanian national television!)

Another slice of Pi

I mentioned the other day that I’d got myself a new Raspberry Pi computer and promised to say more about it soon, especially the fun I’ve been having with its GPIO port. This post was slightly delayed due to the pressing need to write about other Pi-related stuff at the end of last week, but here it is now.

GPIO (short for General Purpose Input / Output) is the name for pins on various integrated circuits (or chips) that are available to be programmed by the user. Essentially it’s a convenient way to interface your chip with a wide range of hardware. The Raspberry Pi FAQ defines GPIO as “a pin that can be programmed to do stuff.”

The Broadcom BCM2835 chip at the heart of the Raspberry Pi has 8 GPIO pins (as well as several other pins that are accessible by the user for various purposes that I haven’t yet figured out) and a nice, shiny 26-pin (IIRC) connector to make all of the pins accessible. Unfortunately that includes about half a dozen pins that can fry your chips if you connect stuff to them. Also, it’s not terribly convenient to connect wires directly to these pins. For these reasons, I decided to invest in a cheap, simple and potentially extremely useful accessory called a Slice of Pi (NB I have no connection to Ciseco, the company that sells this product, apart from being a satisfied customer). This is described as a “breakout board” and plugs in to the GPIO port on the PI, providing nicely labelled female connectors (i.e. sockets rather than pins) for the pins you can usefully use while hiding the ones that are liable to destroy the processor.

The Slice of Pi comes as a PCB with a bunch of loose connectors that need to be soldered into place. As well as being, presumably, slightly cheaper for the company to produce, this gives you the flexibility to only include the connectors you actually need. Fortunately it is not a particularly difficult soldering task to assemble the board, as my soldering skills are not the greatest.

Armed with my new Slice of Pi and a bunch of electronics stuff that I’ve had for years (since a previous occasion when I got interested in electronics), I have been able to wire up a few simple circuits to test out the GPIO capabilities of my Pi. So far, this has amounted to a few LEDs and a switch (plus a bunch of resistors and some wires) and all I’ve done with them is to make the LEDs flash in pretty patterns (hopping from one pattern to the next at the press of the switch) but I look forward to being able to move on to bigger and better things soon.

Pi Led #3

On the software side, the GPIO port is controlled by a library for your programming language of choice. At least, I assume there are GPIO libraries available for several languages. So far I’ve only looked at Python, which is the Raspberry Pi’s language of choice (and the reason for the “Pi” bit of the name, although they don’t tie you into using just one language) as well as one of my own favourite programming languages (and probably my strongest, to boot).

Having accomplished my first goal of getting the Pi to flash LEDs in pretty patterns, my next task is to figure out some actually useful things to do with the GPIO port.