Copyright 2009-2020 by djg. All Rights Reserved.

Wonky Gibbon Ramblings

The Katana 50 MkII – Making Great, Greater – Adding an FX Loop 0

Posted on October 07, 2023 by danny

This was a project inspired by user ColorMaker on the website. In this post ColorMaker posted a video showing a modification he’d done to his Katana 50 MkII which added an FX loop.

In every review of the Katana 50 MkII – the one criticism everyone has of this otherwise excellent amp, is the lack of an FX loop.

So Mr ColorMaker had done it and in so doing, proved it was possible – and he’d helpfully posted a block diagram showing roughly what was involved but, unfortunately without the detail.

Now despite a request for the circuit diagram posted on the website nothing was forthcoming. And I can’t say I blame him, having to support these things can be a right pain in the butt – I’d have to work it out myself.

Over the last few weeks I have thus been thinking about it, slowly gathering information, did a circuit diagram, translated it to a stripboard layout, bought the bits, soldered it up – and blow me – it works!

The one thing I will say at this point, is that this is not a project for a novice or suitable as a first project in hobby electronics. That’s not to say it electronically hard, it really isn’t – but – if you don’t know what stripboard is nor which end of a soldering iron to hold – this is not the project for you. It’s an awful lot of amplifier to be messing up.

You also need good eyesight. I used to find working with stripboard easy but I’m in my 50s now and my near vision isn’t as good as it was.

To be clear then, if you choose to do this and knacker your amp – or the circuit doesn’t behave as you expect and you don’t know how to debug it – don’t be sending me your complaints or requests for help. If you have a go at this – you do it at your own risk in the knowledge that if you mess up, you yourself will have to sort it out. You’re on your own, I’m not helping you! And I say that with love, but you know, life is too short.

Are we all good?


So here’s how the project went then.

I found a circuit diagram for the Katana 50 MkII here. The important information is on p40 in the top left hand side of the diagram, it shows a connector coming from the main digital board onto the amplifier board. As the signals on it have already been through the D/A process, they’re analogue. This is your point of interception and is why we’re in business with this project. There’s no track cutting involved or anything on the PCBs, just a cable. Opening up the Katana I found the connector – it’s the white and black bunch of wires, cable tied, in the image below, going from the top board (which is all the digital stuff) to the small bottom board (which is the 50W power amp module that drives the speaker).

So my FX send / return loop would effectively be inserted into the mono analog signal going across that connector. Pass me the wire cutters! Ok – maybe not – we need to do some planning first…

A further innovation ColorMaker had quite rightly done, was to insert two buffer amps into the circuit. As you don’t know how much current the upstream circuit can provide nor how much the downstream one (ie: your pedals) require, it’s polite to buffer these with an OpAmp at each end.

Also he’d discovered that the output voltage level of the amp on the connector can be too high for your pedals (ie more than 9V peak to peak), meaning the signal would clip and get distorted, so smartly put a signal cut switch in, to give the option of attenuating the signal as it goes out on the FX send and then boost it back to its original scale, on its return. The switch is there to turn this feature on and off depending on whether it’s required or not.

As an aside, you could do the attenuation part using resistors arranged as a voltage divider, but as we’re buffering with an OpAmp it makes sense to use that for the purpose since, it’s there and available!
On the return side, there is no option but to use an OpAmp to boost the signal anyway.

So on that basis both send and return sides each buffer using a standard inverting OpAmp configuration, for which the standard gain formula is: -Rf/Rin

As I wanted to achieve a cut factor of 4, resistor values of 1k2 and 4k7 respectively are appropriate.
Similarly on the return side we want a boost of 4x so the same resistor values can be used again, just swap them around ie: 4k7 and 1k2 respectively.

Now as we are using Op Amps – they need some power, ie: +Vcc, -Vcc and Gnd. Going back to that connector in the Katana, I could see from the diagram that it has supply rails on it. Unfortunately it didn’t indicate the voltage on them, so I had to open it up again and measure with a digital multi-meter.

The connector pins on the connector from the Katana Preamp to the Katana Power Amp are as follows
Pin 7 is the audio signal
Pin 5 is +Vcc (28V)
Pin 2 is -Vcc (-28V)
Pins 3&4 are Gnd

So we’re going to splice a 5 wire bus out of the main bus going between the two Katana boards that will branch off to our FX loop, comprising +Vcc, -Vcc, Gnd, Signal in and Signal out (with Signal In and Out of course being the two cut ends created when you cut, the wire from Pin 7) .

But wait a minute, +/- 28V you say? That is a lot, though not altogether surprising, as it is driving the power amp module through to the speaker – so of course it needs some beef. But yeah, supply rails of +/-28V is a lot. This leads to a problem as I’m not aware of any OpAmps that can run off supply rails that high. A bit of a google search did reveal one part that might have managed it but the information was scarce and in any case I couldn’t find a supplier.

SO – I decided to use my usual “goto” OpAmp for audio, the TL07x series, which is a very low noise part suitable for this sort of thing. It’s been around for decades and very easy to source (Amazon, Farnell etc)…

In this case as we need two Op Amps, I would be using the TL072 which contains 2 OpAmps in one 8 pin DIP package. This can run off supply rails up to about +/- 18V – so we would also need to build a voltage regulator circuit to bring the +/-28V down to a rather more manageable +/-12V which the TL072 can handle. The classic parts for this are the 7812 and 7912 voltage regulators, also decades old and easy to source.

In most of the circuit diagrams online for these regulator parts (which I’ll let you google), they have modulation capacitors both before the input and after the output. There are big ones for smoothing the AC mains power sinusoidal shape out (which you would need after a transformer / bridge rectifier), and smaller ones after the regulator for handling output ripple and then tiny ones for handling transient spikes. However – as we’re tapping into nice clean DC rails that Roland Boss have already cleaned up for us rather than the mains, you only really need the ripple ones which rather simplifies your parts list.

So – stuff all of that in a plastic box (thus avoiding any accidental short circuits from a metal box), add a switch and some suitable mono jack connectors – and you have an FX loop.

Here is my circuit diagram for the FX loop stuff.

And another for the 7812 and 7912 power regulation. Note: The pins for Vin and Gnd are swapped between the 7812 and 7912 so be careful when laying out the stripboard and wiring them up. Also you will need small heat sinks on those two parts or the purple smoke inside them is likely to come out. Electronics: it’s all about keeping the purple smoke inside the components…

I did think about providing sketches for my strip board layouts but I actually think it’s important you create your own, otherwise you get let off having to understand the circuits – and that path leads to amplifier death or something you can’t debug.

Here’s a picture of my little power regulator board. The big connector plug has +/-28V and Gnd going in, and +/-12V coming out, all on the one connector. I wish I could have found some nicer more compact connectors instead of that great big thing – but I didn’t have the time.

Here’s a pic of the main board before it got stuffed in the black plastic box (which also ended up containing) the regulator board

And what the back of my Katana looks like with the loop in place. NB: Set the box back a bit, so that the switch doesn’t catch on things and get broken when you’re carrying the amp around – gigging etc…

And here is the parts list:

Some Veroboard (aka Stripboard)
1x TL072 – Dual Op Amp
1x 8 Pin Dil package holder
2x Mono 1/4″ Jack sockets
3x 4k7 resistor
3x 1k2 resistor
2x 10k resistor (to “pull” the inputs down to 0V when disconnected)
1x DPDT Toggle Switch
Plastic Case

For the voltage regulator circuit:

Regulator 7812 (Vin max 35V)
Regulator 7912 (Vin max -35V)
2x 100uF on output to smooth ripple
2x heat sinks

Over to you – enjoy.

Things I would do differently if I was doing this project again? I’m glad you asked! … :

  • I used 7812 and 7912 voltage regulators because I happened to have some lying around. This means that the TL072 that uses them would have max peak to peak input and output signals of +/- 10.5V (since the TL072 can only get to within 1.5V of its supply rails). Now – I think that when you have the gain and volume knobs cranked right up on the Katana, plus a few effects – that could cause some clipping distortion. In fairness I haven’t heard any as yet, but given you could just as easily use 7815 and 7915 regulators (+/-15V) or even 7818 and 7918 regulators (+/-18V) as the TL072 is good for supply rails up to +/- 18V – this would give you a bit more headroom.
  • I’m not convinced the reduction switch is worthwhile. I can’t hear any difference in the amount of noise between the two positions (either clean or with gain), which is the only reason you’d elect not to cut the send and boost the return voltage. So I would be inclined to remove the switch, which removes two resistors from the circuit and reduces the wiring complexity – and just have it always wired to a ratio of 1:4
    • ie: Cut circuit : Rin=4k7, Rf=1k2
      Boost circuit: Rin=1k2, Rf=4k7
  • Talking of that cut / boost ratio of 1:4, we’re trying to get the signal down to something that will go though a pedal which runs off a 9V battery. Worse, if we assume your pedals also can’t get within 1.5V of the battery supply voltage (and I’ll bet they can’t) it probably means a peak to peak max signal of 6V (ie: +/-3V). Given we’re starting from a signal that could potentially be +/-16.5V you might want to increase the resistor ratio to around 1:6 rather than 1:4, both cut and boost side. Having said all that – as I say, I haven’t heard any distortion as yet so I could be being overly cautious.

Now, I’m going to say this one more time – if you haven’t done this sort of thing before – this probably isn’t the best project to start your journey in electronics. It’s a rather nice amp to be destroying if you get it wrong – and something of a pricey mistake.

This is why I have been deliberately a little vague in my descriptions here, to deter newbies. Not to mention that providing literal step by step instructions would be excruciating. If you can cut through the fog and work out what needs to be done and design your own stripboard layout from the circuit diagrams, then you probably have the necessary skills to do the project without damaging your Katana – and in so doing make both it and yourself feel fabulous. However, if you can’t – don’t.

Have fun!

Oh – and one final word of thanks and acknowledgement to ColorMaker. It’s one thing to build the circuits for this when someone has told you it’s possible – but ColorMaker did it from scratch with no help or clues from anyone else. That’s worth a round of applause – good work!

Windows Media Centre MCE – UK EPG Runs Out 0

Posted on January 12, 2018 by danny

As of sometime late 2017, the EPG in the UK no longer seems to update in MCE. In all honesty, the need for MCE and indeed PVRs in general is on the wane given the existence of on-demand services such as Netflix, Amazon Prime and catchup services like BBC iPlayer – not to mention Smart TVs and so on. Nevertheless – I’m not quite ready to kiss MCE goodbye – so I needed to keep it going just a little longer. Until I no longer need to play a Blueray – that sort of thing.

Googling – the solution seems to be to use a tool called EPG Collector. At the time of writing this can be downloaded from here:

Installation and Config for Windows 7 MCE as follows:

  1. Download the EPG Collector xxx msi file – and install it.
  2. Download the latest EPG Fixpak from the same page, unzip it, and copy the files over the top of those installed by the msi.
  3. Run EPG Centre
  4. Go to File -> Create Collection parameters… select UK-SkyTV (Freesat does not seem to work).
    This will now open the configuration window.
    The first tab (Tuning) should have all the parameters set. No need to change anything here but check your country and area are set correctly
    Output tab. Select “EPG Collector imports the data to Window Media Centre”
    Tick the boxes for the two ‘create episode tags …’ options
    Advanced tab. Tick the Use freesat Huffman tables…
  5. Channels tab. Click on start scan. Loads of channels should appear. Lots of junk and duplicated. Click on ‘exclude all’ and then untick the excluded box for the channels actually desired (and that successfully tune). You can click on the column headers to sort the data. In the current version I couldn’t see any tickboxes for exclude, but by moving the cell cursor into the right excluded cell using the arrow keys and then pressing the space bar I was able to change the setting. Excluded rows are shown in red.
  6. Click on File->Save as, to save your setup to disk – save it with the default name EPG Collector.ini.
  7. Click on Run->Collect EPG Data

If you now open Windows Media Centre, you should find a guide full of data. Yay!

If all is well, it’s worth setting up the Windows Scheduler to automatically run EPG Collector for you every day or so. I f you used the default location for the EPG Collector.ini file then you don’t need any arguments either.

To do this:

  1. Open Windows Control Panel and navigate to Administrative Tools.
  2. Open Task Scheduler
  3. On the right hand side of the Task Scheduler window are a set of typical actions. Select “Create Basic Task”
  4. Work your way through the wizard that pops up
    1. Set the task to run when the computer starts
    2. Select the program to run as C:\Program Files (x86)\Geekzone\EPG Collector\EPGCollector.exe
      1. If you used the default config ini file name, you don’t need to provide any parameters.

And your done.

Particular thanks to this guy:

GT88 Smart Watch Setup 3

Posted on December 28, 2017 by danny

So, it’s December 28th, you unpacked your sparkly new Kingwear GT88 smart watch (also branded as MindKoo and others) some 3 days ago, and you’re starting to think it might be a piece of crap. Perhaps you should be thinking about sending it back?…

Or not. It might just be a bit of a sod to setup.

This is the post I needed when I first got this device. Internally the device seems to be made by some people called Mediatek who then pass it to third parties to rebadge it.

The first thing I would do, is take the instructions and put them in the bin – because they really are utter rubbish. Comedy reading maybe but not actually helpful and completely fail to mention most of the things you need to do.

The next thing you need to know – is that the software you are told to install is not the software you need to make it work.

Start off by bluetooth pairing the watch with your phone. If you don’t know how to do this, go google it – life’s too short to type those instructions up.

That said, there is a crucial point here. Once you have Bluetooth paired the watch, you should tap on the cog to edit its settings on the phone. Within, you will find a setting that shares contacts, make sure this is ticked as it is not by default. Without this you will find that the watch is unable to access your phone’s contacts or the call history which severely limits it’s usefulness.

Next… go to the Android marketplace and install “Fundo Smart Device” – yes, I know the instructions want you to install the “Fundo Wear” app – but seriously, nothing works without the Smart Device app – so go install it. Sorry Apple users, I don’t own an iphone, so I’ve no idea what you need – this post probably isn’t for you.

So what do I think of this device?


I got the gold one – and I have to say it looks rather nice, it’s not heavy, the screen is good and the watch strap kind of matches. The built in camera is camouflaged as an old fashioned winder which is kind of neat. All in all it looks good. The problem is that it’s about 20% too big, particularly the thickness. It just needs to be that bit smaller.

Next question – why the arse have they put a camera on it? Have they even tried to use it? Unsurprisingly the pictures are uncompromisingly crap. Very low res and indoors, with a corking orange colour cast. Pointless. Maybe it was just cos they could. Who knows.

Charging is done via a proprietary magnetic connector with four connectors. The magnets are a little bit weak which makes it a little fiddly but it kind of does the job.

Battery life, seems to be around 36 hours when new. Nowhere near as good as a fitbit but better than many other smart watches, so not terrible.

It’s actually possible to open up the watch and put a SIM inside it with it’s own telephone number and so on. I’ve got to ask, what’s the point? I’m not sure I need my wrist to have a different telephone number to my inside pocket, the two are usually quite close to each other – and the idea that my Mum is going to stop off to wonder which she’s going to dial up seems implausible. Maybe the idea is that you could use it instead of having a phone. Err. No. I don’t think so. No. Happily the SIM is not mandatory and you can just use the watch as an extension of your phone which makes a lot more sense.


You can use the Fundo Smart Device app to install additional apps to the smart watch. At the time of writing this includes a Yahoo Weather app and a bunch of watch faces. I think that’s about it – in addition to the preinstalled apps.

So lets go through the apps. For reference my phone is an HTCH M9+ running Android 6.0

– Lists all the contacts in your phone. If you tap on one, you can use your phone to dial or message them. Works well enough. NB: This will not work if you haven’t set the Bluetooth settings for the smart watch on your phone, to share contacts.

Call Logs:
– Shows call logs.

– Just seems to show a calendar (ie: the day and date), but doesn’t seem to show any events from the phone. Currently a fail.

– Allows you to type a number and it will dial it. If you want to dial a contact, use the contacts area instead. Will talk a bit more about using the phone later on.

– Yay! It’s a simple calculator – and it works!!

– Displays SMS messages from your phone. This totally works – you can read them and write them (allbeit only in caps).

QR Code Display:
– To take your phone to the “Fundo Wear” app – shame it doesn’t take you to the more useful “Fundo Smart Device” app – as otherwise, it’s a pretty good idea.

Bluetooth Setup:
– For setting up bluetooth.

Music Player:
– Allows you to control the music player on your phone. Works well you. You can go forward or back through the current list, read the track name being played, change the volume and pause. It also works to a degree with other player apps such as the BBC radio app. If you don’t have headphones plugged into your phone – the sound will come out of your watch. If you do have headphones – it comes out of them instead, so great for out running / walking to work etc…

Some sort of internal Player for Video:
– Have yet to have need of this.

Theme Changer:
– Allows you to switch between a number of simple display themes.

– Will record video to an internal SD card or the phone. Haven’t really used it.

– Will take pictures to the watch memory. Low quality camera that you have to aim like James Bond in Moonraker from the wrist (whilst unable to see the screen). Daft. Why?

Voice Recorder:
– Allows you to make recording to the watch memory with a natty little control ui. Will probably make you feel just like “Secret Squirrel” and all very covert. Fun if you’re in to that sort of thing.

– Pretty important for setting the watch up. Most of this is straightforward haven’t yet investigated “Magic Voice” though!

– Displays notifications sent from the phone app. You can tune which phone apps are allowed to send notifications from the phone app to limit these to those that are interesting. It actually works pretty well allowing you to read emails and SMS as well.

Sleep Monitor:
– unlike a FitBit, this isn’t always on – you have to start it up. I haven’t tried this, so I’ll revise this section when I’ve used it.

Remote Capture:
– I think this is supposed to be used as a remote firing control for the camera on your phone. I haven’t yet got this to work. Not sure I care eithe.

File Manager:
– If I ever find a reason to store a file I need to manage on the device, I’m sure this will be very useful.

– Measures your heartrate. You hit a start button and it measures it for about 10 seconds and then comes back with a reading. I’ve read elsewhere that this is pretty wildly inaccurate and I’d be inclined to agree.

– You can setup alarms local to the watch. I can see this might be useful, though I’ve yet to use it.

– Like the sleep monitor, you need to start it, which is a bit mad. Similarly, I’ve yet to use it so will report back at a later date.

– Haven’t yet investigated how to use this.

Flight Mode:
– Does what it says on the tin. Turns off bluetooth I would imagine, and cellular activity if you have a SIM within.

Sedentary Reminder:
– I’ve yet to use this as yet but you can set a number of minutes after which it will prompt you to move. Presumably it can detect movement to reset the counter but I’ve not yet tried it out.

Clock Face:
– Allows you to set the look and feel of the clock face.

– Displays a screen saying “Smart Watch”. Handy. I did not know that.

Gesture Motion:
– Allows you to configure certain gestures to certain actions such as turn the screen on or answer the phone. Pretty useful. However the screen does flash on and off a lot if you’re typing and have set gesture to turn the screen on. In the end I disabled this and just use the button on the side. This gesture works a lot better on the Fitbit.

Power Saving:
– Seems to make the screen a little dimmer when switched on.

Siri Integration:
– Being on Android, I don’t have Siri. Maybe it will talk to google instead? Will have to check…


Initially I found there were quite a lot of notifications that pop-up telling you what your phone is doing. This gets quite annoying pretty quickly. I don’t care that my phone is optimising it’s battery use – it just needs to get on and do it. The notifications area in the Fundo phone app allows you to switch off / hide the ones that aren’t relevant to you. On my HTC this mean’t switching off the one for “System UI”.

Dismissing a notification on the Smartwatch does not dismiss it on the phone so it’s a bit of a one way experience. Could be better.

Receiving Calls

When you receive an incoming call you can answer either using the watch face or the phone. You can see the number calling and if memory serves the name.

The default seems to be to route both mic and speaker through the watch rather than the phone regardless of which device you tap to answer. I would have thought that tapping the watch would use that device, whilst tapping the phone would use that device. You can use the phone to reroute the call to its own mic or speaker during the call though, easily enough. Sound quality of the watch speaker is good enough and according to people on the other end, sound quality from the watch mic is also fine.

When in the car I would like the car hands free system to take priority if it is connected. If not then the watch or the phone itself depending on which device I use to pick up the call. There is no easy way in android to do this. Bluetooth priority is simply determined by the order in the Bluetooth devices list and there is no function to reorder them. So your only option is to delete the bluetooth connections and recreate. The highest priority device is listed first.

If you always want to use the phone’s speaker and mic and never the watch, you can disable these in the Bluetooth settings on your phone for the smart watch as well.


Well, I’m going to have to spend some time living with it but first impressions are this:

If you don’t have access to instructions like these, the device is a disaster. However once you work out how to configure, it’s not actually that bad. But for most people this will be snatching defeat from the jaws of victory. Big fail by the manufacturer.

It’s kind of the opposite of Fitbit. Fitbit do good software but their devices in my view lack robustness and longevity. And they’re pricey. They measure steps etc… pretty accurately though and the battery will run for 5 days at a time which is pretty great. Boring displays though.

In contrast here, the software is average but the hardware appears more robust. It’s also much cheaper. Not sure about accuracy of measurement. Battery life around 1.5 to 2 days. Some of the displays you can install are quite nice.

Core features: Making and answering phone calls works pretty well. Reading texts and other notifications is good though dismissal of notifications doesn’t go back to the phone. Music Control is good. These are the key features it has to nail and mostly it does.

Other features are mostly irrelevant.

The main fail is the calendar – but it’s not annoying enough to make me send the phone back.

I suspect things like the step counter which are central to fitbit, will annoy if you want that sort of functionality – but it’s no biggie for me.

The device does not support Android Wear – so all the good stuff of turn by turn navigation on your wrist or slicker google integration is missing. On the other hand this device is a third of the price (or less) of an Android Wear – so you pay’s your money – you take your choice.

So… once I’d sorted out the phone software, less irritating than expected and more functional. I’ll be keeping it 🙂

Raspbery Pi: Copying SD card image to a smaller SD 0

Posted on January 19, 2014 by danny

Aaargh! So one of my Pi’s running AirPlay died. Or rather the SD card did. I bought a replacement and attempted to write the SD image to it in the usual way using Win32DiskImager. However it refused to write to it, saying that the image was bigger than the SD card.

Turns out that due to manufacturing errors, SD cards vary a little bit in capacity with dead bits hidden away. The new card had less capacity front than the old one.

So – I needed to find some way to burn the image to this card that was just a smidgen too small. This post was useful

In the post some people talk about having to shrink the linux filesystem a little before cloning the card however, it turned out I’d never resized my partion up from 2GB to 4GB so I didn’t have this problem. The easiest solution in the end, proved to be to fix the problem using an Ubuntu install rather than Windows. The nice thing about Ubuntu is that like many linux distro’s it can be run direct from the install media without actually having to install it, either DVD or memory stick.

The steps to resolve the problem were as follows:
1) In Windows, download Ubuntu from and burn to DVD (just to big to fit on a CD).

2) Then restart the laptop and let it boot the Ubuntu OS from the DVD.

3) Click on the dash icon and start typing the word “Terminal” so that it finds the terminal program. Double click and you get a command line.

4) Place the source SD card into the card reader slot and let Ubuntu mount it.

5) Type:

cd Desktop

6) Then type this command to make an image file on the desktop:

sudo dd if=/dev/sdb of=sdimage.img bs=4M

‘sudo’ gives root priveleges. ‘dd’ is a copying program, ‘if’ is the input file which is the sd card reader device, ‘of’ is the output image on the desktop and ‘bs’ is the block size.

This gives this output:

ubuntu@ubuntu:~/Desktop$ sudo dd if=/dev/sdb of=sdimage.img bs=4M
953+1 records in
953+1 records out
3998220288 bytes (4.0 GB) copied, 211.068 s, 18.9 MB/s

With 8GB of RAM on the laptop I was able to use the desktop effectively as a RAM disk. If you have less than this – you could try saving to your windows hard drive which Ubuntu will have mounted.

7) Take out the source SD card and replace it with the target one (which is a bit smaller) and execute this command:

sudo dd if=sdimage.img of=/dev/sdb bs=4M conv=notrunc,noerror

The aditional parameters at the end tell it to write the full size and allow it to continue when it runs out of space.

This gives this output:

ubuntu@ubuntu:~/Desktop$ sudo dd if=sdimage.img of=/dev/sdb bs=4M conv=notrunc,noerror
dd: writing `/dev/sdb': No space left on device
932+0 records in
931+0 records out
3904897024 bytes (3.9 GB) copied, 482.878 s, 8.1 MB/s

The 3.9GB at the end tells you that a little bit of the image was lost. Happily it is of course blank.

All of which results in a working SD card that the Raspberry Pi can boot. Sorted!

Raspberry Pi Does Sonos – Part 2 – Transmitting on AirPlay 2

Posted on December 30, 2013 by danny

In the first part, I talked a bit about setting up the Raspberry Pi as an AirPlay receiver; something that can receive audio streamed over a home’s wifi connection and play it.

Transmitting from Apple

Apple Devices already support AirPlay by default (not a shock – it’s an Apple invention). So to connect an ipad, iphone, itouch etc… is straightforward. You simply double swipe up in IOS7 and enable AirPlay in the control panel. Job done.

Transmitting from Windows

Windows can be made to talk to the Pi using a program called Tuneblade. This is an application (that if you’re streaming to Shairport as described in Part 1, is free) and can be downloaded from

Once launched, Tuneblade can be accessed from your system tray and includes a volume control, so remember to turn it up! It streams the audio even if you mute the local audio output – which is handy if you don’t want to listen to your tiny PC speakers.

Transmitting from Android

On Android, some app’s (such as Streambels) support direct streaming to AirPlay – but many popular apps do not, for example, Spotify does not. Similarly, TuneIn the radio app doesn’t. So another solution is required, similar to that used on Apple devices. ie: redirect the entire audio stream of the device.

There are a number of Apps for Android that will stream the entire sound output of the phone to the Pi. For example, one called AirAudio and another called AirStream. Both of these have demonstration versions to allow you to test. However you will have to buy a licence for around £4 to get a permanent solution (ie: one that doesn’t switch itself off after 10 mins). I didn’t find a totally free alternative (and I’m not anti paying software developers in any case!!).

Whilst apps like Streambels that only stream their own audio channel don’t need root privileges, these other applications that give the greater flexibility of sending any audio on the device (such as that coming out of Spotify) by effectively snooping on other applications audio output – do require root access / super user privileges.

This gets you into the exciting area of device rooting. The process for this can be complicated and in many cases results in the device being wiped as one of the steps to do it. This was certainly the case for the house Nexus 7 though happily not my Motorola Atrix phone. Doing so, however gets this solution to work. In addition it also provides access to a variety of other very useful apps including backup tools that can backup application data as well as the install apk’s and much more. Rooting an android device is not for the feint hearted and comes with associated risks of bricking the device and invalidating your warranty. So something you do, at your own risk.

Transmitting to Multiple Zones

By setting up multiple Raspberry Pi’s around the house with different device names you can effectively zone the house into different audio areas. In addition many of these transmitting programs can broadcast to more than one AirPlay receiver at once. In our house, with our network setup, solely using Raspberry Pi’s, they seem somehow to sycnhronise which is very cool for parties!!!

Raspberry Pi Does Sonos – Part 1 – Making an AirPlay Receiver 0

Posted on December 30, 2013 by danny


So … I want Sonos. I want the ability to be able to select tunes from Spotify, my NAS drive, the radio, whatever – on a tablet and have it come out of my hifi without the tablet physically attached to it.

I could use Bluetooth. But the range is poor and the sound quality questionable.

But what if a Raspberry Pi could do the same thing? What if it could receive audio streamed over Wifi, from a tablet, or my phone, or a laptop etc?… turns out it can.

Apple’s AirPlay protocol is usually used by iTunes to allow it to communicate with Apple TV and is the backbone of the project. However as luck would have it, going beyond Apple and iTunes it is possible for other devices to use Airplay including a variety of Android apps and a few windows apps. There is also a linux project, shairport that allows linux devices to receive Airplay streams and play them.

This is the point I have to fess up and say that I should have written up the Raspberry Pi part of this as I was doing it – but hey ho, it’ a month later so this will lack detail but at least give a general overview.

The challenge with the Pi is simple enough: Get it running headless with shairport (which provides the audio listening service and outputs the audio through the Pi’s 3.5mm jack) running as a service from startup. And in fact, using the raspbian distribution this is relatively easy. However there were some issues: First, I quickly discovered that the Edimax micro USB wifi adapter I had, didn’t have the range to reach my router through a couple of walls. So I swapped it for a Ralink wifi usb adapter with a proper stick aerial I had lying around – but could I get the drivers to work? Could I hell!! Additionally, even without this problem and without launching a GUI, raspbian isn’t that quick to boot and I like quick booting!

For that reason I decided to do it again, using ArchLinux. ArchLinux boots fast and I knew from a previous project that the Ralink wifi adapter could be made to work.

Steps to Setup the Pi

So the steps to success on the Pi

  1. Install Archlinux
  2. Get Wifi Working
  3. Get a build environment working
  4. Download shairport package
  5. Compile
  6. Configure to get it working

To Install ArchLinux you can download an sd card image from here. And then bring the packages up to date using the instructions here. The most important section is that about updating the system. Don’t worry about installing additional software or a desktop environment.

Next – get the wifi working.
This page provides a guide to setting up wifi on ArchLinux. Personally I found the wpa_supplicant approach a real arse – in fact I didn’t get it working. By comparison the automatic Netctl approach mentioned, is very straightforward.

Now that the wifi is working, check that it can get a wifi signal from wherever in the house you tend to position the Pi. If you can’t and you’re using a micro adapter, you may need to change to an adapter with a larger / proper aerial.

Next, some development tools are required. The first command below installs gcc, make etc… the second provides support for git, which is where the shairport source repository is stored.

# sudo pacman -Sy base-devel
# sudo pacman git

My own efforts from this point got a certain distance, including a lot of mucking around with perl packages and cpan, but I was unable to unravel is completely. However, this blog post by Orson Tyrell – works extremely well.

At the end of this, you should have shairport installed and set to automatically startup at system boot.

You may well find that when you send a test signal it is very quiet.

If so, launch

# alsamixer

Set the volume to 100% or close and exit.
If you then call

# alsactl store

(you may need to use sudo) then this volume will be stored away and reused after a reboot.

In Part 2 – I’ll talk a bit about broadcasting to the Pi from other devices.

There were quite a lot of pages used in doing this, but the key ones were:
And on raspbian
… thanks to all.

Migrating Windows 7 on an ASUS N56VM Laptop to an SSD 1

Posted on October 13, 2013 by danny

That’s it! I can’t stand it any longer! My beautiful ASUS N56VM laptop – a mere year old, has slowed to the pace of an arthritic snail. Despite having 8GB of RAM and a 2.something GHz i7, it’s as wheezy as hell.

It’s time to move from spin disk to SSD, a 500GB Samsung 840 SD. Not least as I’d discovered that the existing disk was spinning at 5700rpm. I mean what is the point of selling a system with an i7 and 8GB of RAM and then equipping it with an ageing gerbil on a wheel to spin the disk. No wonder it had slowed to a heap of crap.

SO – how to copy the system from the existing spin disk to the SSD? Well first, I bought a disk big enough to take all my data. I can’t be doing with deleting stuff or moving onto external disk drives. Boring, boring, boring! I placed it temporarily into an external enclosure and used the free “EaseUS Partition Master” software to clone the disk from the internal spin disk to the external ssd.

There are two main advantages to cloning the existing spin disk. The first is that you don’t have to re-install all your software and setup all those little machine tweaks you like, second, if like this ASUS the windows installation software is all on a hidden recovery partition, it’s the only way to continue using the Windows 7 OEM licence that came with the machine.

So with the disk cloned – I took the ssd out of the external enclosure and swapped out the spin disk, turn on the machine and kapow lightening fast boot speeds, straight into windows – easy peasy.

Errr… No.

What I actually got was a boot failure and this error message screen:
– Status: 0xc0000225
– Info: The boot selection failed because a required device is inaccessible.


A bit of investigation revealed that the original disk and the clone were both using GPT rather that the older MBR partition table of yesteryear. GPT is a newer type of partition table that uses 64bit addresses rather than 32bit allowing for greater disk capacities and other good things. It forms part of the UEFI standard and indeed the ASUS uses UEFI for basic system configuration rather than the older BIOS system. UEFI was expecting an ID relating to the old spin disk and instead was getting one relating to the new SSD. So it stalled.

Pressing ESC when the ASUS symbol appears at boot brings up the boot selector, but even selecting the ssd there doesn’t help. A Windows Repair Disk is needed to fix the startup process. Type “Repair” in the start menu search area, will bring up “Create a System Repair Disk”. Unfortunately doing this on an OEM Windows 7 (as installed on the ASUS) creates a less useful repair disk that only allows you to re-install the operating system. You need a proper repair disk as would be created by a vanilla Windows 7 installation. Hope you’ve got one of those to hand!

With a vanilla Windows 7 Repair Disk in the DVD drive, reboot the machine and let it boot the DVD. Once booted, it will ask you to select a language and will then display a list of all the Windows 7 installations it has detected. There may well be none in the list as happened with me. Click “Next” in any case and let it attempt to repair the system. This will end up with a reboot.

Let it boot the repair disk again. It will probably find your Windows 7 installation this time. You will probably have to do this cycle of repair and reboot a few times.

Eventually – you will need to help it fix the boot record. Select the command prompt from the repair menu:
– work out which drive letter your DVD drive is mounted to (select each drive in turn, type DIR, repeat etc…) – let’s say it’s G: then type the following:

cd boot
bootrec /fixboot

This command can be used to recrete a Windows 7 boot loader too:

bootsect /nt60 SYS all

This fixes the boot record.

Then run the repair system again, just kind of… because.

At the very least you will now be able to boot your system from the ESC boot menu – if you’re lucky it may even boot without ESC key intervention at all!

Thanks to the following sites and References:

DNS-320: Access Denied from User Nobody 0

Posted on June 15, 2013 by danny

Just had a bit of a hair pulling moment with my DNS-320.

Despite having given myself write privileges to a shared drive, I couldn’t write to it from windows, only read. Every time I tried to do any writing activity, Windows 7 would say “Access Denied” and indicate that I had to get permissions from the Unix user “Nobody”.

I logged into my Debian Squeeze installation to check the permissions on the directory – they all looked fine.


Or not so mad.

It seems that the only way to reliably maintain the mapping between the windows user on my laptop and the unix user on the DNS-320 is using the utility that came with the NAS drive, a simple mapping of the network drive in Windows is not sufficient.

So if you run into this problem. Unmap the drive in windows and then recreate the mapping using the D-Link utility.

Raspberry Pi Wireless Radio – Part 2 0

Posted on March 25, 2013 by danny

To control the Raspberry Pi radio, you’re going to need to connect a bunch of switches to the GPIO header block. How many switches and the functions they perform is up to you. For example you could use them as presets, or channel up/down. And don’t forget you’ll need something to control volume.

I purchased some ribbon cable, veroboard, tactile switches, an IDC connector and a bunch of resistors to make my control board (see pic below) but you could go a breadboard route at least initially to get something working. This post is an excellent introduction to the wiring required:

To interface with my external switch board (via the GPIO header block), I’m going to use Python.

Installing Python

Although installing python in itself was straightforward, finding information on how to install the gpio library was more challenging, most users having used it with raspbian or debian. In the case of archlinux it was clearly going to have to be compiled from scratch which given I haven’t compiled anything from scratch, was a bit daunting.

However, whilst standing on my own shoelaces and generally face planting, I stumbled across this post on the subject which outlines everything needed to install both python and the gpio library as well as a host of other development tools required along the way such as gcc and so forth.

First install the development tools you’re going to need (including things like gcc)

$ sudo pacman -Sy file base-devel abs git

Next download the gpio source code and unpack it

$ wget
$ tar xf raspberry-gpio-python.tar.gz

Now run the make process that will create a package that can be imported by pacman, and import it

$ cd raspberry-gpio-python
$ makepkg -Acs --asroot
$ sudo pacman -U raspberry-gpio-python

By this point you now have Python 2 and 3 installed, plus a variety of other development tools and the gpio library.

NB: If at any point you see error message that look a bit like this:
error: failed retrieving file ‘libpulse-2.0-2-arm.pkg.tar.xz’ from : The requested URL returned error: 404
the chances are that the package database in pacman is out of sync with what’s out on the internet. The following command will resync the database:

$ sudo pacman -Syy

If that doesn’t work try changing the download mirror

$ cd /etc/pacman.d
$ nano mirrorlist

Comment out the original mirror and remove a comment from one of the others, then save and update

A Simple Python Radio Control Program

This simple program has three radio stations and two mp3s assigned to various input buttons, plus a volume up and a volume down.

import RPi.GPIO as GPIO
import time
import os

def PlayRadio(station_url):
    os.system("mpc stop")
    os.system("mpc clear")
    os.system("mpc add " + station_url)
    os.system("mpc play")

def PlayMp3(mp3_file):
    os.system("mpc stop")
    os.system("mpc clear")
    os.system("mpc add " + mp3_file)
    os.system("mpc play")

def VolumeUp():
    os.system("mpc volume +2")

def VolumeDown():
    os.system("mpc volume -2")

def mainProg():
    # to use Raspberry Pi board pin numbers

    # set up unused GPIO as output channels and 0V
    # set up GPIO input with pull-down control
    #   (pull_up_down be PUD_OFF, PUD_UP or PUD_DOWN, default PUD_OFF)
    GPIO.setup(14, GPIO.OUT)
    GPIO.setup(15, GPIO.OUT)
    GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
    GPIO.setup(23, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
    GPIO.setup(24, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
    GPIO.setup(25, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
    GPIO.setup(8, GPIO.OUT)
    GPIO.setup(7, GPIO.OUT)

    GPIO.setup(2, GPIO.OUT)
    GPIO.setup(3, GPIO.OUT)
    GPIO.setup(4, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
    GPIO.setup(17, GPIO.OUT)
    GPIO.setup(27, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
    GPIO.setup(22, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
    GPIO.setup(10, GPIO.OUT)
    GPIO.setup(9, GPIO.OUT)
    GPIO.setup(11, GPIO.OUT)

    # set RPi GPIO output pins low
    GPIO.output(14, GPIO.LOW)
    GPIO.output(15, GPIO.LOW)
    GPIO.output(8, GPIO.LOW)
    GPIO.output(7, GPIO.LOW)

    GPIO.output(2, GPIO.LOW)
    GPIO.output(3, GPIO.LOW)
    GPIO.output(17, GPIO.LOW)
    GPIO.output(10, GPIO.LOW)
    GPIO.output(9, GPIO.LOW)
    GPIO.output(11, GPIO.LOW)

    # look for inputs on RPi board pins
    prev_input = 0
    while True:
        #take readings
        this_cycle = 0
        input = GPIO.input(25)
        if ((prev_input == 0) and input):
            print ("Button 1 pressed")
            this_cycle = 25
            # ISA FM
        input = GPIO.input(24)
        if ((prev_input == 0) and input):
            print ("Button 2 pressed")
            this_cycle = 24
            # LBC
        input = GPIO.input(23)
        if ((prev_input == 0) and input):
            print ("Button 3 pressed")
            this_cycle = 23
            # Fun Kids
        input = GPIO.input(22)
        if ((prev_input == 0) and input):
            print ("Button 4 pressed")
            this_cycle = 22
            # Rock Lobster mp3 Test
        input = GPIO.input(27)
        if ((prev_input == 0) and input):
            print ("Button 5 pressed")
            # Beethoven mp3 Test
            this_cycle = 27
        input = GPIO.input(18)
        if ((prev_input == 0) and input):
            print ("Button 6 pressed")
            this_cycle = 18
        input = GPIO.input(4)
        if ((prev_input == 0) and input):
            print ("Buttpon 7 pressed")
            this_cycle = 4

        prev_input = 0
        if (this_cycle > 0):
            prev_input = 1

        # software switch debounce
def main():

if __name__ == "__main__":

From here you can really go to town. I followed this up with a web interface coded in Python and Django to allow button configuration and all sorts. Far to long to blog about here. But plenty of fun to be had!

References: describes wiring describes GPIO describes GPIO describes python programming with GPIO python for newbies for finding IP URLs for radio stations how to unpack BBC tokenised streams

Raspberry Pi Wireless Radio – Part 1 0

Posted on December 27, 2012 by danny

As with many such posts, this one is primarily a reminder to myself, should I need to repeat my steps at a later date. However, I hope they are of use to someone also as it was a number of days work.

You will need one raspberry pi and a wireless USB adapter based on the Realtek RTL8188CUS chipset such as the Edimax EW-7811Un micro-usb adapter (cheap as chips and available from Amazon).

Basic Setup

Download the Arch Linux ARM install (because it is very lightweight and boots in under 10 seconds), burn to an SD card and plugin to the Pi as per the instructions on the download page here.

Boot it up. If you don’t have a screen and usb keyboard available just plug it into a wired network. ssh is enabled by default so you can connect using Putty immediately, instead.

Follow the update instructions here ( to bring it up to the most recent distribution.
Early on it talks about rc.conf which doesn’t exist in this distribution, there’s probably an alternative but as I didn’t need to change timezones, I wasn’t concerned.
The command pacman-key –init, does take A LONG time (like 10 minutes with no onscreeen feedback).

Wireless Networking

Plug in the Edimax EW-7811Un micro wireless USB adapter and reboot. Support for the Realtek RTL8188CUS chipset this is based on is built into the current distributions of Arch Linux for the Pi.
Install the netcfg package so that wireless can be configured from the command line

 # pacman -S netcfg

Then follow these instructions to configure wireless:
Use the example wireless-wpa script as the starting point.
After issuing this instruction in that post: # netcfg mynetwork you will see this error nl80211: ‘nl80211’ generic netlink not found. This isn’t actually a problem, this post describes why
To ensure wireless is restarted after a reboot of the Pi, the following command in that post must be executed

# systemctl enable netcfg@myprofile

Reboot and check that you can putty to the Pi over wifi.

In the event, that the wireless hardware doesn’t initialise fast enough (can happen), you may get an error like ‘wlan0 does not exist’. See the entry in this post to resolve.

You may find that a few days after doing this, the IP lease for the Pi expires on the router causing it to assign a new IP address to it. This can cause the Pi to no longer be able to connect to the router because it’s own expectation of what the IP lease should be, aren’t being met. This post should troubleshoot this.

Install and Configure Media Player

Now install mpd & mpc:

# pacman -S mpd mpc alsa-utils

Sound itself needs enabling at boot up. To do this you need to create a script in the directory called /etc/modules-load.d called snd_bcm2835.conf which looks like this:

# Load snd_bcm2835 at boot

You also need to install initscripts:

# pacman -S initscripts

A lot of the challenge is in getting mpd configured correctly, when stuff doesn’t work, it’s usually due to this file not being setup quite right. Also the errors reported to the command prompt are often less than helpful so don’t forget to check the mpd.log file, sometimes that actually provides useful help. In general it is recommended you don’t run it as root but rather as a user with less all-encompassing rights.

Here’s my /etc/mpd.conf file:

music_directory		"~/music"
playlist_directory "~/mpd/playlists"
db_file "~/mpd/mpd.db"
log_file "~/mpd/mpd.log"
pid_file "~/mpd/"
state_file "~/mpd/mpdstate"
user "wonkygibbon"
bind_to_address		""
port				"6600"
input {
        plugin "curl"
audio_output {
	type		"alsa"
	name		"My ALSA Device"
	device		"hw:0,0"	# optional

The default input plugin is called “curl” and can be used to pick up streaming audio over the web.

For this to work, I needed to create the various files and directories that these point at. Hence, login as your user (in my case wonkygibbon), then do the following:

$ mkdir music
$ mkdir mpd
$ cd mpd
$ mkdir playlists
$ touch mpd.log mpdstate

Finally, start mpd, connect to a radio stream, and play it:

$ mpd
$ mpc add
$ mpc play

The IP address is that of one of my favourite french stations – replace with whatever you want to listen to.

If you wish to test using mp3 files – you can copy them to the Pi using WinSCP (provides an ftp type interface from windows to the Pi using ssh – meaning you don’t need the Pi to be running an ftp server).

They need to be placed in the “music” folder you created earlier. Then update mpd’s music database using:

$ mpc update

Thanks primarily to the following sites as well as others to numerous to mention:
Part 2 if/when it follows will focus on how to to add external switches to select channels and the bits of scripting required to respond to them.

↑ Top