Meet our Archie
Every cat needs a collie, and this is Cleo's new wee brother, Archie.
"Wee" brother is right. Although he's grown to double her size, in the 4½ weeks he's been with us - compare the picture on the right with the one below, taken 4½ weeks later - he still gets "Wee Archie" due to his determination to cover the whole house in a uniform coat of wee!
Actually, that's a bit unfair. When he came to us at exactly 8 weeks old, he was already trained to go on the puppy training pads, and had more or less a 100% record on those. But that was only for wee; anything more demanding would be deposited instantly and immediately, just wherever he happened to be, as the mood took him. Now that we've started trying to take away the training pads, the result - with apologies to Kevin Bacon - has been a return to Everything Everywhere.
End of the Tunnel
Yesterday he attended his first puppy socialising class at The Dogs Trust, where he did us proud with his precocious knowledge of the Sit, Stay, and Down commands. All credit to Linda there, for her decades of experience training very intelligent border collies.
Socialising per se was less successful. Archie has had to be kept away from other dogs for longer than is usual, because his breeder failed to immunise him against deadly diseases such as Parvovirus. We didn't find out about this until we took Archie to our own vet, for what we thought would be his second and final inoculation, but which turned out to be a complete restart at day one.
So yesterday, two weeks later than he should have, he finally got to meet other pups. He was timid and reluctant, and basically failed to do so. However the instructor expressed his confidence that this delayed development can be put right over the coming month.
Archie and Cleo, everybody!
Thursday, 17 November 2016
Thursday, 10 November 2016
FLAC Forensics
Frequency Fingerprints
I was asked by a friend if it was possible to check whether some downloaded files were actually faithful to the original WAV format entities, or whether they had in fact been rehydrated from an unfortunate, lossy intermediate MP3 excursion. The files in question were FLAC compressions of the original 3½ hour, 42 track Analord series of electronic pieces by Richard D. James, most of which were only ever issued on 12" vinyl by the artist's now defunct Rephlex Records outlet.
Update: My personal RD James expert informs me that these original 42 tracks were also released in lossless digital format on Rephlex, and that some (or all?) of the subsequently released additional, digital-only tracks were also added to these by Rephlex.
I loaded the first of these files, SteppingFilter 101, into Audacity, and took a look at the frequency domain graph (Analyze|Plot Spectrum...). After a brief complaint about only being able to analyze 237.8 seconds of audio at a time, the result was this:
Notice the slight uptick at the extreme right (high frequency) end, around 22kHz. This represents extraneous noise generated by the digital sampling process, which in this case appears to have been set naturally enough to the CD standard stereo setting of 44.1kHz. This effect will be present in any rip, at some frequency or other, and is of a different kind from the artefacts introduced by MP3 processing.
Next, I used FooBar2000/LAME to convert this file to MP3 format, using the highest available quality, Constant Bit Rate standard preset, namely 320kbps CBR (actually LAME can handle non-ISO bit rates of up to 640kbps via its freeformat option, but very few MP3 players can handle such files).
The result of this 320kbps conversion has a very obvious steep cutoff at about 20kHz:
Any attempt to convert this back to the WAV format will preserve this telltale high frequency cutoff. Does this mean we can be confident that the source file represents a good, high quality, uncompressed rip from the original vinyl? I would say confident, yes; certain, well, that's another bottle of kippers. We haven't ruled out nonstandard MP3 or other shenanigans with this test alone, but those compression antics are at worst extremely unlikely.
I was asked by a friend if it was possible to check whether some downloaded files were actually faithful to the original WAV format entities, or whether they had in fact been rehydrated from an unfortunate, lossy intermediate MP3 excursion. The files in question were FLAC compressions of the original 3½ hour, 42 track Analord series of electronic pieces by Richard D. James, most of which were only ever issued on 12" vinyl by the artist's now defunct Rephlex Records outlet.
Update: My personal RD James expert informs me that these original 42 tracks were also released in lossless digital format on Rephlex, and that some (or all?) of the subsequently released additional, digital-only tracks were also added to these by Rephlex.
I loaded the first of these files, SteppingFilter 101, into Audacity, and took a look at the frequency domain graph (Analyze|Plot Spectrum...). After a brief complaint about only being able to analyze 237.8 seconds of audio at a time, the result was this:
Notice the slight uptick at the extreme right (high frequency) end, around 22kHz. This represents extraneous noise generated by the digital sampling process, which in this case appears to have been set naturally enough to the CD standard stereo setting of 44.1kHz. This effect will be present in any rip, at some frequency or other, and is of a different kind from the artefacts introduced by MP3 processing.
Next, I used FooBar2000/LAME to convert this file to MP3 format, using the highest available quality, Constant Bit Rate standard preset, namely 320kbps CBR (actually LAME can handle non-ISO bit rates of up to 640kbps via its freeformat option, but very few MP3 players can handle such files).
The result of this 320kbps conversion has a very obvious steep cutoff at about 20kHz:
Any attempt to convert this back to the WAV format will preserve this telltale high frequency cutoff. Does this mean we can be confident that the source file represents a good, high quality, uncompressed rip from the original vinyl? I would say confident, yes; certain, well, that's another bottle of kippers. We haven't ruled out nonstandard MP3 or other shenanigans with this test alone, but those compression antics are at worst extremely unlikely.
Saturday, 3 September 2016
Sundry Surround Sound Recordings
Planned Obsolescence
At the time of purchase in May 2015, my current universal (DTS/SACD/DVD-A/Blu-ray) player, a Pioneer BDP450, cost me a featherweight £159. Just over a year later it's "unavailable", unless I'm willing to settle for a refurbished model from Ebay. Reasonably priced multichannel DTS/SACD and DVD-Audio players are becoming really hard to find, even from the manufacturers who invented these formats. At present the best available options appear to be:
This is a partial list of my surround sound recordings by format. It will let me sit and grieve as first DTS, then SACD, then DVD-A, and finally (sooner than you'd think!) Blu-ray playback become impossible. Then I will at least be able to see at a glance each month, exactly what fraction of my collection has now become permanently unavailable to me. It's also a work in progress, since I have no intention of losing the bad habit of buying these wonderful recordings; currently I'm looking forward to the much-delayed Steven Wilson remixes of the early Roxy Music albums.
Top 100+ Speciality Multichannel Studio Mixes
This first table lists recordings where a studio engineer (usually Steven Wilson or Jakko Jakszyk ;-) has carefully pored over the source material, and arranged things in space to produce a curated, meticulously arranged, surround sound experience.
Notice that most of the Yes titles are double entries (in fact Fragile is a triple): the DVD-Audio and Blu-ray editions of these are of course equally essential.
The Loneliness of the Long Interval Musicologist
The Year column is problematic. Every recording has its place on multiple chronologies; for example, the life and development of its composer, its conductor, and its performing artist(s). The difficulty is that different performances naturally emphasise disparate chronologies, and a single date field in a table or database struggles to accommodate these variations.
For the historical study of musical development, the time stamp of primary interest is the date of composition. Sadly this is not recorded in typical media metadata, such as the ID3 tags on MP3 files. The "Year" recorded there represents the release date - when the particular edition was issued. Now, for most "popular" music (in the strict Amazon.com sense of "anything non-classical"), this is close enough to the date of composition; but for all of the recordings listed here, without exception, the release date for the multichannel edition is many years later than that of first publication of the original material, and the problem is only worse in the case of classical works.
Generally I've tried to get as close as possible to the date of composition. That means for popular works using the year of first issue, and for classical, the historical year (or century, for compilations) of composition. Still there remain intractable inconsistencies. For example, all of the material on the Beatles' "Love" album was recorded and issued long before Cirque du Soleil went shopping for a soundtrack in 2006. Finally, there's Daniel Barenboim. When the focus of a classical recording is neither composer nor performer, but instead a famous conductor, then I use the performance date.
Live Surround Sound Music Videos
This second table lists live video recordings of musical performances that just happen to have a surround sound component, often limited to a feeling of ambience in the hall where the recording was made. These are the second class citizens of the surround sound community, and this collection listing will be incomplete.
At the time of purchase in May 2015, my current universal (DTS/SACD/DVD-A/Blu-ray) player, a Pioneer BDP450, cost me a featherweight £159. Just over a year later it's "unavailable", unless I'm willing to settle for a refurbished model from Ebay. Reasonably priced multichannel DTS/SACD and DVD-Audio players are becoming really hard to find, even from the manufacturers who invented these formats. At present the best available options appear to be:
- PIONEER BDPLX58 (£449 at Richer Sounds)
- CAMBRIDGE CXU (£799.95)
- OPPO BDP105D (£1,099)
- PIONEER BDPLX88 (£1,099)
This is a partial list of my surround sound recordings by format. It will let me sit and grieve as first DTS, then SACD, then DVD-A, and finally (sooner than you'd think!) Blu-ray playback become impossible. Then I will at least be able to see at a glance each month, exactly what fraction of my collection has now become permanently unavailable to me. It's also a work in progress, since I have no intention of losing the bad habit of buying these wonderful recordings; currently I'm looking forward to the much-delayed Steven Wilson remixes of the early Roxy Music albums.
Top 100+ Speciality Multichannel Studio Mixes
This first table lists recordings where a studio engineer (usually Steven Wilson or Jakko Jakszyk ;-) has carefully pored over the source material, and arranged things in space to produce a curated, meticulously arranged, surround sound experience.
Notice that most of the Yes titles are double entries (in fact Fragile is a triple): the DVD-Audio and Blu-ray editions of these are of course equally essential.
The Loneliness of the Long Interval Musicologist
The Year column is problematic. Every recording has its place on multiple chronologies; for example, the life and development of its composer, its conductor, and its performing artist(s). The difficulty is that different performances naturally emphasise disparate chronologies, and a single date field in a table or database struggles to accommodate these variations.
For the historical study of musical development, the time stamp of primary interest is the date of composition. Sadly this is not recorded in typical media metadata, such as the ID3 tags on MP3 files. The "Year" recorded there represents the release date - when the particular edition was issued. Now, for most "popular" music (in the strict Amazon.com sense of "anything non-classical"), this is close enough to the date of composition; but for all of the recordings listed here, without exception, the release date for the multichannel edition is many years later than that of first publication of the original material, and the problem is only worse in the case of classical works.
Generally I've tried to get as close as possible to the date of composition. That means for popular works using the year of first issue, and for classical, the historical year (or century, for compilations) of composition. Still there remain intractable inconsistencies. For example, all of the material on the Beatles' "Love" album was recorded and issued long before Cirque du Soleil went shopping for a soundtrack in 2006. Finally, there's Daniel Barenboim. When the focus of a classical recording is neither composer nor performer, but instead a famous conductor, then I use the performance date.
Live Surround Sound Music Videos
This second table lists live video recordings of musical performances that just happen to have a surround sound component, often limited to a feeling of ambience in the hall where the recording was made. These are the second class citizens of the surround sound community, and this collection listing will be incomplete.
Artist or Composer | Album Title | Year | Physical Media | ||
DVD | Blu‑ray | ||||
Ash | Tokyo Blitz | 2001 | ✓ | ||
Daniel Barenboim | Knowledge is the Beginning / The Ramallah Concert | 2008 | ✓ | ||
Neujahrskoncert 2009 | 2009 | ✓ | |||
Europakonzert 10 | 2010 | ✓ | |||
Mahler Symphony No. 9 | ✓ | ||||
The Salzburg Concerts | 2011 | ✓ | |||
Blackfield | NYC - Blackfield Live In New York City | 2007 | ✓ | ||
Dream Theater | Live at Budokan | 2004 | ✓ | ||
Score | 2006 | ✓ | |||
David Gilmour | Remember That Night | 2007 | ✓ | ||
Led Zeppelin | The Song Remains the Same | 1999 | ✓ | ||
Led Zeppelin | 2003 | ✓ | |||
Opeth | Lamentations | 2006 | ✓ | ||
The Roundhouse Tapes | 2007 | ✓ | |||
Live at the Royal Albert Hall | 2010 | ✓ | |||
Orphaned Land | The Road to Or Shalem | 2011 | ✓ | ||
Porcupine Tree | Arriving Somewhere... | 2006 | ✓ | ||
Anesthetize | 2010 | ✓ | ✓ | ||
Steven Wilson | Get All You Deserve | 2012 | ✓ | ✓ | |
Yes | Symphonic Live | 2002 | ✓ | ||
YesSpeak | 2003 | ✓ | |||
Acoustic | 2004 | ✓ | |||
Live at Montreux 2003 | 2007 | ✓ | |||
Youssou N'Dour | Live at Montreux 1989 | 2005 | ✓ |
Monday, 16 May 2016
Surround Sound Switch #7: Wrapping Up
Spinning The Room
This is a quick summary of the contents and conclusions reached in my recent series of six articles on the subject of Surround Sound Stage Rotation switch designs and prototypes. The series is about various ways of rotating the sound stage of a surround sound / home cinema audio system, so as to make any chosen wall or corner the focus of the action.
Said action takes place in an arena I've dubbed the octoroom. This is a bit like a normal rectangular room, but with a satellite speaker in every corner, and another in the centre of each wall.
Part 1: The Mother Of all Relay Boxes
I start out by examining the ready-made solutions available in the market. This doesn't take too long, as there are none. The hopelessness of seeking help from the audio kit manufacturers is bemoaned.
I spend most of our session together longing for an earlier time, when things like the MORB-1 were available in shops.
Part 2: Rolling your own Commutator
I detail my personal colour scheme for octoroom wiring, explaining its minor deviations from the relevant standards. Then it's on to another pipe dream, this time involving acres of pristine copper plated (or more likely brass, or other alloy) substrate. An imaginary comb made of brushes is used to illustrate the ideal to which our prototypes can hopefully converge.
I spend most of our session together longing for an earlier time, when such commutators were available in shops.
Part 3: Bulgaria (rotary switches)
The ideal 8-pole commutator can be simulated by helically wiring a suitable stack of wafer switches. I discover 7P8T palladium contact rotaries for sale in Bulgaria, and buy them for research. They turn out to be ex-telecomms system components, too fragile, difficult to wire, and otherwise unsuitable for audio use. But they inspire a passive rotary switch design, which eventually becomes my first successful prototype.
A new feature dubbed Mode 5 is introduced, for the specialist who needs to analyse custom curated surround sound music recordings. It allows a 5.x remix to be "stretched out" over the whole 7.x room, without adding in any sound processing by the receiver.
Now that concrete prototypes are beginning to emerge, I describe a scheme for quickly and conveniently swapping them in and out of the home cinema system. The scheme is based on Bulgin 8-pin, cable- and panel-mounting, plugs and sockets.
Part 4: Group Theory (toggle switches)
The mathematical area of permutations teaches that a single 8PDT switch, suitably wired, can rotate our sound stage through any single angle that's a multiple of 45°. Such rotations can also be composed, or applied one after the other, simply by stringing two or more such switches in series, in any order. So, we can choose a suitable chain of three "basis rotators", say 45°, 90° and 180°, and by selectively turning certain ones on and off, achieve any multiple of the atomic 45° rotation.
Eight pole toggle switches exist, albeit outside the unspoken, hobbyist budgetary scope of this series. But usefully, permutation theory also shows that a safe implementation of the 90° rotation can equally be achieved by splitting our 8PDT switch into two more readily and cheaply available 4PDT units ganged together, and that the 180° can similarly be reached by this means, or even by ganging together four DPDT units.
What is meant by safe in this context, is that under failure conditions, when one or more of the component switches fails to operate, no damage other than a seriously mixed up surround sound image will be caused. Amplifier outputs will not become cross-connected, nor asked to drive two or more loudspeakers in parallel. Sadly, the same can't be said about the 45° rotation stage.
There's a brief, unintelligible diversion, something about binary clocks, I dunno...
I make two more successful passive prototypes based entirely on 4PDT toggle switches - first some big Hong Kong ones with screw terminals, then smaller switches with solder lugs. Each prototype contains a 90° and a 180° rotator, as well as the new Mode 5 feature, which takes up one further 4PDT switch for a total of five. The 45° rotator has been dropped temporarily, as there's no easy way to guarantee that its two associated 4PDT switches will always be operated simultaneously and kept forever out of the potentially destructive one on, one off state.
Part 5: Relayer (electromagnetic relays)
Essentially the same audio circuit can be transcribed from the toggle switches in part 4 to the 4PDT electromagnetic relays in this part. With the addition of a 12V PSU and a 4-bit hexadecimal thumbwheel switch, prototype number 4 - the first active device in the series - is born.
The 45° rotator is reintroduced, since the two 4PDT relays that constitute it can now be guaranteed driven together and kept synchronised. Even under rare fault conditions, e.g. a relay coil burning out, the risk of damage can at least be mitigated by assessing which failure mode - amplifier outputs shorted together, or loudspeakers becoming paralleled up - is the less serious, and wiring the switch contacts accordingly. A free online circuit simulator is used to pre-verify the audio wiring schematic.
I finally have a full 8-position, manually operated, prototype sound stage rotator.
Part 6: Arduino (remote control)
No sooner has it arrived, than the hex thumbwheel switch is replaced by an Arduino Uno, driving the relays and relay pairs through bipolar npn transistors. A wiring self-test program is written, seen operating in a YouTube video. This verifies again that all audio pathways are switched correctly, as the compass orientation rotates, and as Mode 5 is switched on and off.
The test wiring is removed, and an IR receiver module is interfaced to the Arduino. Suitable IR codes are obtained by "sniffing" an old Sony BD player remote; these are then embedded into the code, and verified to operate as expected.
Some speculation about future development occurs, but prototype number 5 feels like the logical end of this road. There's life after prototyping, of course. I still have to design a suitable custom PCB, using just the bare ATmega328P chip and a 16MHz crystal, so I can keep my Arduino Uno board for future projects. Still have to stick it all in a box. And so on and on...
Acknowledgements
Thanks to my wife for putting up with (a) so many odd deliveries of random munitions from Amazon, Ebay, Maplin (hi Scott!) and RS Components, not to mention international arms shipments from USA, Hong Kong, Germany and Bulgaria; and (b) the too many hours I spent locked away in the man-cave, playing with screwdrivers, soldering irons, and ticking devices bristling with hundreds of multicoloured wires.
Special mention to Georgi, my Bulgarian rocket scientist colleague, for pushing me to the Arduino limit, and convincing me there would be merit in these investigations. Without his input, I'd have contented myself with a twisting plug and socket manual solution.
The End
This is a quick summary of the contents and conclusions reached in my recent series of six articles on the subject of Surround Sound Stage Rotation switch designs and prototypes. The series is about various ways of rotating the sound stage of a surround sound / home cinema audio system, so as to make any chosen wall or corner the focus of the action.
Said action takes place in an arena I've dubbed the octoroom. This is a bit like a normal rectangular room, but with a satellite speaker in every corner, and another in the centre of each wall.
Part 1: The Mother Of all Relay Boxes
I start out by examining the ready-made solutions available in the market. This doesn't take too long, as there are none. The hopelessness of seeking help from the audio kit manufacturers is bemoaned.
I spend most of our session together longing for an earlier time, when things like the MORB-1 were available in shops.
Part 2: Rolling your own Commutator
I detail my personal colour scheme for octoroom wiring, explaining its minor deviations from the relevant standards. Then it's on to another pipe dream, this time involving acres of pristine copper plated (or more likely brass, or other alloy) substrate. An imaginary comb made of brushes is used to illustrate the ideal to which our prototypes can hopefully converge.
I spend most of our session together longing for an earlier time, when such commutators were available in shops.
Part 3: Bulgaria (rotary switches)
The ideal 8-pole commutator can be simulated by helically wiring a suitable stack of wafer switches. I discover 7P8T palladium contact rotaries for sale in Bulgaria, and buy them for research. They turn out to be ex-telecomms system components, too fragile, difficult to wire, and otherwise unsuitable for audio use. But they inspire a passive rotary switch design, which eventually becomes my first successful prototype.
A new feature dubbed Mode 5 is introduced, for the specialist who needs to analyse custom curated surround sound music recordings. It allows a 5.x remix to be "stretched out" over the whole 7.x room, without adding in any sound processing by the receiver.
Now that concrete prototypes are beginning to emerge, I describe a scheme for quickly and conveniently swapping them in and out of the home cinema system. The scheme is based on Bulgin 8-pin, cable- and panel-mounting, plugs and sockets.
Part 4: Group Theory (toggle switches)
The mathematical area of permutations teaches that a single 8PDT switch, suitably wired, can rotate our sound stage through any single angle that's a multiple of 45°. Such rotations can also be composed, or applied one after the other, simply by stringing two or more such switches in series, in any order. So, we can choose a suitable chain of three "basis rotators", say 45°, 90° and 180°, and by selectively turning certain ones on and off, achieve any multiple of the atomic 45° rotation.
Eight pole toggle switches exist, albeit outside the unspoken, hobbyist budgetary scope of this series. But usefully, permutation theory also shows that a safe implementation of the 90° rotation can equally be achieved by splitting our 8PDT switch into two more readily and cheaply available 4PDT units ganged together, and that the 180° can similarly be reached by this means, or even by ganging together four DPDT units.
What is meant by safe in this context, is that under failure conditions, when one or more of the component switches fails to operate, no damage other than a seriously mixed up surround sound image will be caused. Amplifier outputs will not become cross-connected, nor asked to drive two or more loudspeakers in parallel. Sadly, the same can't be said about the 45° rotation stage.
There's a brief, unintelligible diversion, something about binary clocks, I dunno...
I make two more successful passive prototypes based entirely on 4PDT toggle switches - first some big Hong Kong ones with screw terminals, then smaller switches with solder lugs. Each prototype contains a 90° and a 180° rotator, as well as the new Mode 5 feature, which takes up one further 4PDT switch for a total of five. The 45° rotator has been dropped temporarily, as there's no easy way to guarantee that its two associated 4PDT switches will always be operated simultaneously and kept forever out of the potentially destructive one on, one off state.
Part 5: Relayer (electromagnetic relays)
Essentially the same audio circuit can be transcribed from the toggle switches in part 4 to the 4PDT electromagnetic relays in this part. With the addition of a 12V PSU and a 4-bit hexadecimal thumbwheel switch, prototype number 4 - the first active device in the series - is born.
The 45° rotator is reintroduced, since the two 4PDT relays that constitute it can now be guaranteed driven together and kept synchronised. Even under rare fault conditions, e.g. a relay coil burning out, the risk of damage can at least be mitigated by assessing which failure mode - amplifier outputs shorted together, or loudspeakers becoming paralleled up - is the less serious, and wiring the switch contacts accordingly. A free online circuit simulator is used to pre-verify the audio wiring schematic.
I finally have a full 8-position, manually operated, prototype sound stage rotator.
Part 6: Arduino (remote control)
No sooner has it arrived, than the hex thumbwheel switch is replaced by an Arduino Uno, driving the relays and relay pairs through bipolar npn transistors. A wiring self-test program is written, seen operating in a YouTube video. This verifies again that all audio pathways are switched correctly, as the compass orientation rotates, and as Mode 5 is switched on and off.
Home is an MB4 project box |
Some speculation about future development occurs, but prototype number 5 feels like the logical end of this road. There's life after prototyping, of course. I still have to design a suitable custom PCB, using just the bare ATmega328P chip and a 16MHz crystal, so I can keep my Arduino Uno board for future projects. Still have to stick it all in a box. And so on and on...
Acknowledgements
Thanks to my wife for putting up with (a) so many odd deliveries of random munitions from Amazon, Ebay, Maplin (hi Scott!) and RS Components, not to mention international arms shipments from USA, Hong Kong, Germany and Bulgaria; and (b) the too many hours I spent locked away in the man-cave, playing with screwdrivers, soldering irons, and ticking devices bristling with hundreds of multicoloured wires.
Special mention to Georgi, my Bulgarian rocket scientist colleague, for pushing me to the Arduino limit, and convincing me there would be merit in these investigations. Without his input, I'd have contented myself with a twisting plug and socket manual solution.
The End
Tuesday, 10 May 2016
My Cat Here
Meet our Cleo
Of course the Internet is made of cats, everybody knows that. So here is our latest contribution, and indeed our latest family member: Cleo, aged almost one and a quarter.
Actually she's still at the Scottish SPCA rehoming centre right now, just awaiting a little dental scale and polish, and whatever other surgical interventions might be appropriate (ssshhh). But she has been duly reserved, her new home is ready and waiting, and we've been busy planning and buying her new toys and other worldly chattels.
Cleo strikes you at first as a quiet wee lass - indeed, "A very timid little lady" is the first entry on her vet's record. She's recently lost her owner(s), sadly no longer able to take care of her. And just at this time, with all she's been through and the upset in her life, she can appear a little reluctant to make new friends. But she didn't have to spend too long as a rescue kitty. As soon as she appeared in her temporary accommodation quarters, as soon as she came forward to get tickled, as soon as she miaowed, she was all ours.
Insofar as any cat can ever be said to belong to any of us... anyway.
The very lovely Cleo Kerr, everybody!
Of course the Internet is made of cats, everybody knows that. So here is our latest contribution, and indeed our latest family member: Cleo, aged almost one and a quarter.
Actually she's still at the Scottish SPCA rehoming centre right now, just awaiting a little dental scale and polish, and whatever other surgical interventions might be appropriate (ssshhh). But she has been duly reserved, her new home is ready and waiting, and we've been busy planning and buying her new toys and other worldly chattels.
Cleo strikes you at first as a quiet wee lass - indeed, "A very timid little lady" is the first entry on her vet's record. She's recently lost her owner(s), sadly no longer able to take care of her. And just at this time, with all she's been through and the upset in her life, she can appear a little reluctant to make new friends. But she didn't have to spend too long as a rescue kitty. As soon as she appeared in her temporary accommodation quarters, as soon as she came forward to get tickled, as soon as she miaowed, she was all ours.
Insofar as any cat can ever be said to belong to any of us... anyway.
The very lovely Cleo Kerr, everybody!
Thursday, 5 May 2016
Surround Sound Switch #6: Arduino (remote control)
SparkFun Electronics Arduino Uno R3 |
Mother Of all Relay BoxesAdding remote control to the relay-based prototype can be fairly trivial, since quite often the work has mostly been done for us already by others. One such easy route is via Arduino and infra-red, for which many IR receiver modules are cheaply available. Also available incidentally are WiFi and Bluetooth modules for Arduino, not to mention the fully Wi-Fi integrated MKR1000 and Uno WiFi, so there's no shortage of options. But today, I'll just be looking at IR.
Rolling your own Commutator
Bulgaria (rotary switches)
Group Theory (toggle switches)
Relayer (electromagnetic relays)
Arduino pins driving transistors driving relays. |
Regardless of the connectivity solution adopted, the first requirement is for the Arduino device to take over operation of the four signals controlling the seven relays. At the moment these terminate at the thumbwheel switch, which can selectively operate one or more coils by connecting their lower ends to 0V. In the case of a relay pair, this results in a current of 150mA sinking through the switch contact - much more than an Arduino digital output can either sink or source (20mA continuous recommended, 40mA absolute max).
The solution is to use a transistor, as shown in this circuit diagram, to amplify the current capacity between each Arduino output and its associated relay coil(s). Here I've used my old favourite, the silicon bipolar npn device; MOSFETs are another option. The relay drivers are on pins 2 (45°), 4 (90°), 7 (180°), and 8 (Mode 5). The four so-called freewheeling diodes (e.g. 1N4007), slung across the relay coils in reverse, protect the transistors from the back EMF generated when the highly inductive load is switched. Now when one of these four Arduino outputs goes high (+5V), current flows through a resistor into the transistor base, switching it on. This allows a larger current to flow from the +12Vdc rail through the relay coil(s) and the transistor to 0V. Any general purpose npn transistor with the following specifications will do:
min DC current gain hFE ≥ 40The popular 2N2222 is one example of a suitable component, but note that its frequently cited European "functional equivalent" BC548 is actually ruled out by having too low a maximum collector current (100mA). Now let's choose an appropriate resistor value:
max DC collector current IC ≥ 200mA
max collector-emitter voltage VCEO ≥ 20V
max total power dissipation Ptot ≥ 100mW
Rmax = Vcc / (Imax / hFE) = 5V / (150mA / 40) = 5V / 3.75mA = 1.3kΩ.I'd probably recommend using 1kΩ or so for that extra 30% safety margin. If the base resistor value is too high, the base current will be too low to ensure the transistor saturates and remains outside its high dissipation, potentially destructive "linear" mode. By contrast, when in digital mode, the transistor is either fully off (collector current is zero) or fully on (collector-emitter voltage is essentially zero), so in each case, the power P = I * V ≈ 0.
The IR Library
The Arduino microcontroller development system has access to an excellent free IR control library, Arduino IRremote, by Ken Shirriff. Thanks Ken! This code resource both sends and receives infra-red signals. Many people have made use of this, including Jason Poel Smith, who very reasonably asks,
Most of the buttons on a remote control are never used.then goes on to do just that - repurposing any unused command on any of your IR remotes, to control an electrical outlet switch. He even includes a simple and easy-to-use learning mode, whereby a single additional button press is all you need to teach your electronics which new signal it has to respond to.
So why not use them to control appliances and other electronics around your house?
The Command Set
Our requirements are a little more complicated than controlling the state of a single relay, but not by that much. We have to drive three transistors to control the orientation, and a fourth for Mode 5. So, four digital outputs, rather than one? No big deal.
Now for our UI commands. We'd like buttons to take us directly to a particular orientation, numbered maybe 0-7, maybe 1-8, or maybe mapped to the physical layout of a numeric pad - whatever you prefer. Two more buttons, to rotate from the current orientation by 45° increments, either left or right. A toggle, and/or two separate commands, to engage/disengage Mode 5. A reset button to set the orientation back to 0 and disengage Mode 5.
Sketch
Can't remember the last time the blog known as My Code Here contained any actual computer code, but anyway, here is the full Arduino sketch source for the project:
/*
RoomSpin
Audio soundstage rotation switch for 7.x surround sound system with 8 satellites
http://mycodehere.blogspot.co.uk/2016/05/surround-sound-switch-6-arduino-remote.html
This code is in the public domain - created 6 March 2016 by John Michael Kerr
*/
#include <irremote.h>
#include <irremoteint.h>
//#define TEST
void setup()
{
setupRelays();
#ifdef TEST
setupTest();
#else
setupMain();
#endif
}
void loop()
{
#ifdef TEST
loopTest();
#else
loopMain();
#endif
}
// Main program setup & loop
void setupMain()
{
setupReceiver();
}
void loopMain()
{
long code = readReceiver();
if (code)
performCode(code);
}
// IR receiver handling
const int pinIR = A5;
IRrecv* receiver;
decode_results code;
void setupReceiver()
{
Serial.begin(9600);
receiver = new IRrecv(pinIR);
receiver->enableIRIn();
}
long readReceiver()
{
long result = 0;
if (receiver->decode(&code))
{
result = code.value;
Serial.println(result, HEX);
receiver->resume();
}
return result;
}
// Command codes
const long
codeDigits[8] =
{
0xbeef0000,
0xbeef0001,
0xbeef0002,
0xbeef0003,
0xbeef0004,
0xbeef0005,
0xbeef0006,
0xbeef0007
},
codeLeft = 0xbeef0008,
codeRight = 0xbeef0009,
codeMode5_ON = 0xbeef000A,
codeMode5_OFF = 0xbeef000B,
codeMode5_TOGGLE = 0xbeef000C,
codeReset = 0xbeef000D;
// Command codes for Sony BD (RMT-B119P)
//
//const long
// codeDigits[8] =
// {
// 0x00090B47, // 0
// 0x00000B47, // 1
// 0x00080B47, // 2
// 0x00040B47, // 3
// 0x000C0B47, // 4
// 0x00020B47, // 5
// 0x000A0B47, // 6
// 0x00060B47 // 7
// },
// codeLeft = 0x000DCB47, // Left arrow
// codeRight = 0x0003CB47, // Right arrow
// codeMode5_ON = 0x000E0B47, // 8
// codeMode5_OFF = 0x00010B47, // 9
// codeMode5_TOGGLE = 0x00066B47, // Blue
// codeReset = 0x000E6B47; // Red
int compass = 0;
bool mode5 = false;
bool codeToMode(long code)
{
switch (code)
{
case codeMode5_ON:
return true;
case codeMode5_OFF:
return false;
}
return !mode5;
}
int performCode(long code)
{
for (int c = 0; c < 8; c++)
if (code == codeDigits[c])
return rotateTo(c);
switch (code)
{
case codeLeft:
return rotateBy(-1);
case codeRight:
return rotateBy(+1);
case codeMode5_ON:
case codeMode5_OFF:
case codeMode5_TOGGLE:
return setMode5(codeToMode(code));
case codeReset:
mode5 = false;
return rotateTo(0);
}
return 0;
}
int rotateBy(int eighths)
{
return rotateTo(compass + eighths);
}
int rotateTo(int eighths)
{
compass = eighths & 7;
setRelays();
return compass;
}
int setMode5(bool value)
{
mode5 = value;
setRelays();
return 0;
}
// Drive the relays
const int pinCTRL[4] = {7, 8, 12, 13};
void setRelayMask(int pin, int mask)
{
setPinMask(pin, compass, mask);
}
void setRelays()
{
for (int p = 0; p < 3; p++)
setRelayMask(pinCTRL[p], 1 << p);
setPinIf(pinCTRL[3], mode5);
delay(100); // Let the relays settle.
}
void setupRelays()
{
for (int p = 0; p < 4; p++)
pinMode(pinCTRL[p], OUTPUT);
}
// Low level I/O support
void setPinIf(int pin, bool condition)
{
digitalWrite(pin, condition ? HIGH : LOW);
}
void setPinMask(int pin, int value, int mask)
{
setPinIf(pin, (value & mask) != 0);
}
// End of tab
This listing shows placeholders for the actual IR remote codes generated by your remote. Run the program with the Serial Monitor enabled, then blast it with your own remote, making note of the hex code generated by each of your chosen command buttons. Then search my source for the string 0xbeef, and replace these hex constants with your own. The numeric keys (here numbered 0 to 7) are stored in order in the codeDigits array, and the command names following these should be self-explanatory.
I'm currently using this prototype with codes for a Sony BDPS590 Blu-Ray player (remote control model number RMT-B119P), these are the codes in the commented-out section below the placeholders. Known affectionately to my wife and me as as "stubby buttons", this is a well-behaved remote - most buttons generate a single code followed by a stream of 0xFFFFFFFF, as long as they're held down. The only exceptions are volume up/down, mute, and the other TV buttons, whose output depends entirely upon which make & model of TV you've programmed it for. With other remote brands, be prepared to do a little C++ protocol tweaking to handle alternate and/or repeating code complications.
Wire Test
Last time I promised you a fully automated wiring test using just the Arduino Uno with no additional hardware. How are we going to achieve that with only 14 digital I/O pins available on the development board, when there are 19 or 20 terminations on our relay loom? Count them: 4 control inputs, and on the audio side, 7 or 8 inputs plus 8 outputs. Answer: by pressing the Arduino's six analog inputs A0-A5 into service. These work just as well as digital inputs, and bring the available total to exactly plenty. In fact I've already used A5 to interface the IR receiver module (pinIR in the code), rather than the default pin 11.
Say we keep the existing pins 2/4/7/8 attached to the four coil controls, as in the diagram above. Now associate pins 3/5/6/9/10/11/12/13 respectively with the eight audio amplifier outputs. For test purposes these will take the place of the physical amplifier outputs in real life.
Next, for the loudspeaker inputs, associate analog inputs A0-A5, operating in digital mode, with the first six, and pins 0/1 with the remaining two. The IR receiver module must be disconnected from pin A0 during this test. Now all our test program needs to do is drive the coil controls with every binary pattern from 0 to 15, and for each pattern, walk a single bit (actually a logic zero) from the first audio amplifier output through to the last, checking that it appears only on the expected loudspeaker input pin, if any.
Note the change in I/O terminology here. While designing the relay network, we called the amplifier signals inputs and the loudspeaker destinations outputs. That made sense from the viewpoint of the switch. Now in the Arduino software, from the perspective of the system testing the switch, our ins & outs are swapped around.
Here is the source code for the wire test, which should be added as a new tab to the main code above. Then in the main sketch, remove the double slashes from the line //define TEST. Remember to undo this edit (and reconnect the IR receiver module) once the wire test is complete.
/*
WireTest
A wiring test utility for the RoomSpin project
http://mycodehere.blogspot.co.uk/2016/05/surround-sound-switch-6-arduino-remote.html
This code is in the public domain - created 6 March 2016 by John Michael Kerr
*/
const int
pinIN[8] = {A0, A1, A2, A3, A4, A5, 0, 1},
pinOUT[8] = {3, 5, 6, 9, 10, 11, 12, 13};
int
output,
expected,
actual;
void setupTest()
{
for (int p = 0; p < 8; p++)
{
pinMode(pinIN[p], INPUT_PULLUP);
pinMode(pinOUT[p], OUTPUT);
}
writeOutput(0xFF);
}
void loopTest()
{
for (compass = 0; compass < 8; compass++)
{
setRelays();
for (int mask = 1; mask < 0x100; mask <<= 1)
{
writeOutput(mask ^ 0xFF);
delay(50); // Let the outputs settle.
readExpected();
readActual();
while (actual != expected); // Crash!
}
writeOutput(0xFF);
}
mode5 = !mode5;
}
void readActual()
{
actual = 0;
for (int p = 0, mask = 1; p < 8; p++, mask <<= 1)
if (digitalRead(pinIN[p]))
actual |= mask;
else
actual &= ~mask;
}
void readExpected()
{
int mask = output ^ 0xFF;
if (mode5)
mask = useMode5(mask);
mask <<= compass;
if (mask > 0xFF)
mask >>= 8;
expected = mask ^ 0xFF;
}
int useMode5(int mask)
{
switch (mask)
{
case 0x01:
case 0x40:
return 0;
case 0x02:
return 0x01;
case 0x20:
return 0x40;
}
return mask;
}
void writeOutput(int value)
{
output = value;
for (int p = 0, mask = 1; p < 8; p++, mask <<= 1)
setPinMask(pinOUT[p], output, mask);
}
// End of tab
There's one headache with using up all 20 I/O pins in this way. Serial communications normally proceed via Arduino pins 0 and 1. With these tied up, how are we to glean any diagnostic information form the wire test?
My simple solution is first to add LEDs with series current limiting resistors to all twelve output pins (four relay drivers and eight audio channels). Now run the test, and jump into an infinite loop as soon as any unexpected result occurs. That's the function of this rather suspect looking line of code, with its barely noticeable empty loop statement:
while (actual != expected); // Crash!All being well, these LEDs will flash binary patterns and masks, repeating one full test cycle every eight seconds. When the unthinkable happens, the LEDs become frozen, displaying in an unambiguous snapshot the state of all output signals, at the instant of fault detection. Yay diagnostics!
Here's a short video of the wire test in action. It's a bit less dramatic than its title suggests. But if you've read this far, you know that already.
In a past life, I worked with embedded systems and microcontroller projects, based on hardware such as the Motorola MC68HC705 series [pdf], for over 15 years (1980-1995). This is the first time I've used a high level language which I didn't have to design and implement entirely on my own. Okay, it's only C++ with a little preprocessor supplied syntactic sugar, but I'm still impressed. I like your brave new world!
Future Expansion
Hmm, so back into normal operation, and the Arduino Uno still has a bunch of those analog input pins free, eh. It's tempting to drive them with signals derived from the actual audio waveforms, suitably rectified and limited, then perhaps using some custom automatic gain control (AGC) code, translate those input levels to PWM brightnesses feeding a retro ring of eight front panel LEDs. When the audio is quiet, these LEDs could pull double duty by indicating the currently selected orientation.
In fact that was the thinking behind the quirky output pin selections for the relay drivers and the IR receiver module. Since outputs PD3/5/6 and PB1/2/3 are capable of PWM operation, they're reserved for future LED driving duty. I'd be happy enough driving these LEDs in pairs just like the relays, but if you demand one LED per audio channel, you might want to reassign some I/O and use the Arduino Leonardo. That board offers an additional PWM output on pin 13, as well as extending analog input capability to several of the digital I/O pins.
Any other additional features? Maybe we'd also like the switch to revert automatically to the default, powered-down state, after a few hours of inactivity - just so we don't accidentally leave the relay coils needlessly burning up the watts for weeks on end when not in use.
Two Distinct Defaults
Typically a switch like this will spends most of its life in just one particular orientation, with an occasional foray into a second, still less frequently a third, and so on. Obviously it's worth wiring the most frequently used orientation as the default one, which has been called "North" in my descriptions to date, and in which all seven relays are de-energised. Then for most of the time you can simply have the device unplugged or switched off, saving power and component life.
Less obviously, the second most popular switch state might benefit from being stored in non-volatile memory, and selected automatically on power up. That way, whenever movie night, holiday projector time, or whatever other occasion rocks up, you need only power up, and the sound stage rotates instantly to the secondary setting, ready for the evening's entertainment.
Such a fixed "secondary default" could easily be programmed with a few seconds' work. A better solution however might be to introduce a new command, allowing the current switch state to be saved in the Arduino microcontroller's non-volatile EEPROM memory with the press of a button, and subsequently, to be retrieved from there upon power up. Or to automate the process completely, write the state to EEPROM every time it's changed, so the switch effectively remembers its setting through a power cycle. Just be aware of the EEPROM erase/write limit of nominally 100,000 operations.
The EEPROM storage requirements of this design are reasonably low, at one half of a byte.
Next time: wrapping up.
Thursday, 21 April 2016
Surround Sound Switch #5: Relayer (electromagnetic relays)
Messy business, prototyping. |
Mother Of all Relay BoxesToday I'm going to modify the toggle switch prototype design to use 12 volt relays in place of mechanical switches. I'm talking about electromagnetic relays, not the solid state kind, which are ruled out of analog signal graft by their zero crossing distortion. The use of relays will have certain advantages, which I'll come to in a moment. First, for me personally, there's a significant down side to consider.
Rolling your own Commutator
Bulgaria (rotary switches)
Group Theory (toggle switches)
All the prototypes seen so far have been completely passive, in that the only electrical energy passing through the switch circuits has been the amplified audio signal, on its way to the speakers. This feature has had a certain attraction. At home, in our living room, the TV unit conceals under its skirt two six-way mains extension strips, both of which are fully populated and occupied feeding sundry gadgets. Four additional, adjacent wall sockets - each with an integrated USB charge port! - are similarly stuffed with kit that resists further fanout. Finding a power source for an active switch is going to be tricky, but it'll have to be done.
As to the advantages:
- A single rotary control can be used to select any of the available speaker configurations.
- That manual input itself can later be replaced with an Arduino-based remote control system.
- When that great day dawns, I can retire the word "prototype" and take tequila shots.
45° clockwise twist from two 4PDT relays (2 ways). |
Here on the right is the last of the necessary sub-assemblies, the 45° rotator stage, required to complete our 8-direction relay switch. As was the case with toggle switches, 4PDT is the largest generally available electromechanical relay size, before prices start to escalate, so once again we'll be using them in ganged pairs.
Two alternative realisations are shown. In the top version, the input signals are connected to the switch commons, while in the bottom version, the outputs are taken from the commons. Now notice the central thin black vertical line, cutting across red, brown, yellow and green wires. These horizontal links between toggles 4/5 and 1/8, in both cases, illustrate that for the first time, the two 4PDT switches (the left and the right halves of the module) are not entirely independent. Both must always be open, or closed, together.
Let's look at the possible fault conditions. In the top version, activation of the left hand side alone results in amplifier outputs 4/5 becoming shorted together; with the right hand side, it's outputs 1/8. But in the bottom version, left-only activation connects output 8 to speakers 1/8 simultaneously, leaving output 4 open; while right-only connects output 4 to speakers 4/5, leaving 8 open.
As mentioned previously, the second schema might be preferred when, under conditions of switch sync failure, the consequences of one amplifier being connected to two speakers in parallel are less serious than two amplifier outputs becoming shorted together. The lower of these two versions might appear the more complex, but that's just an artefact of the drawing convention. In reality, and under normal (non-fault) operating conditions, they are physically, electrically, and topologically equivalent.
8-Way Switch with Mode 5 support - full cascade diagram - version 1. |
And, semi-finally, here on the left is one complete cascade diagram for the full 8-way rotator, complete with unrestricted Mode 5 support. This version uses the first of the 45° stage implementations just described.
As before, reading the diagram from the top: four of the seven amplifier outputs (1/2/6/7, those carrying the surround sound information) first arrive at relay RL1, which supplies the option to switch out of 7.x and into Mode 5. The outputs of this stage, together with the three remaining (non-surround related) signals 3/4/5, then reach relays RL2/RL3, which as before, operate in tandem to allow an optional rotation of 180°. Subsequent relays RL4/RL5 again offer a 90° clockwise rotation, while the new, last stage, RL6/RL7, offers a further 45° clockwise twist.
Relays | Orientation | Signal Destinations | |||||||||
RL2+RL3 | RL4+RL5 | RL6+RL7 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | - | |
- | - | - | N | 1/- | 2/1 | 3 | 4 | 5 | 6/7 | 7/- | 8 |
- | - | ON | NE | 2/- | 3/2 | 4 | 5 | 6 | 7/8 | 8/- | 1 |
- | ON | - | E | 3/- | 4/3 | 5 | 6 | 7 | 8/1 | 1/- | 2 |
- | ON | ON | SE | 4/- | 5/4 | 6 | 7 | 8 | 1/2 | 2/- | 3 |
ON | - | - | S | 5/- | 6/5 | 7 | 8 | 1 | 2/3 | 3/- | 4 |
ON | - | ON | SW | 6/- | 7/6 | 8 | 1 | 2 | 3/4 | 4/- | 5 |
ON | ON | - | W | 7/- | 8/7 | 1 | 2 | 3 | 4/5 | 5/- | 6 |
ON | ON | ON | NW | 8/- | 1/8 | 2 | 3 | 4 | 5/6 | 6/- | 7 |
Encoding & Decoding
The "truth table" above illustrates how the selective energisation of relay pairs 2/3, 4/5 and 6/7 is decoded by the clever wiring into one of eight possible sound stage orientations. The default starting position is labelled "North" by convention. A starter for ten might be in order...
In first orientation, N for North, all three relay pairs (RL2 through RL7 inclusive) are off. Audio signals #1 through #7 are sent by default to speakers #1 through #7, and the silent "null" signal ("-") arrives at speaker #8. The next row describes orientation NE (North East). Here the signal from amplifier #1 has been dispatched to speaker destination #2, signal 2 to speaker #3, and so on. Speaker #8 springs into life with the output from audio signal #7, while the null signal now goes to speaker #1. So it continues, rotationally, for the remaining six rows of the table.
It's worth making your default (or most popular) orientation correspond to the direction labelled "N" in this table, where all the relays are off. This should minimise the duty on both the relay coils and the power adapter, prolonging their lives. It also affords the option of powering down the unit under this default condition, and indeed under the majority of fault conditions, preserving a normal surround sound service when copper eventually fractures, or enamel cracks.
Hex thumbwheel switch. |
One elegant way to drive these relay coils would be using a rotary switch with binary encoded outputs. The one on the left, an Apem SMFB16N1248 thumbwheel device (RS Components stock number 425-0142), has four hexadecimally coded outputs. The encoding disc tracks are visible through the translucent PCB. We can use the first three, least significant outputs to drive the relay pairs according to the above table, so the switch positions 0 through 7 give us the cycle of eight orientations N through NW listed there.
Control wiring alternatives. |
The two alternative PSU / relay coil / thumbwheel switch wiring diagrams on the right show the use of a negative (top) or a positive (bottom) common rail for the coils. The only logical difference between these diagrams is actually the swapping of the ± signs at the PSU, but notice the numbering of the relays, which changes to minimise wire crossovers in the diagram.
The first case, known as high side switching, might seem the obvious one to use. But if you plan eventually to dispense with or override the thumbwheel switch, in favour of operating the relays from a remote controlled Arduino or similar device with 5V switchable outputs, it's probably easier to adopt the second diagram. Then you can interface using single npn transistors with freewheeling protection diodes to drive the coils. In the common negative case, you'd need an extra transistor per relay to control the 12V supply using a 5V signal.
What relays, DIN bases and crimps look like. |
The 4PDT relays I'm using, mounted on 35mm DIN rail sockets for maintainability, are Maplin Code N42AW (Beta Electric BMY5-4C5-S-CW) with nickel-silver contacts and 12Vdc, 160Ω coils.
When looking for a suitable project box, keep in mind that this DIN rail assembly alone will measure 8" x 3" x 3" (200x75x75mm). The ADA MORB-1 that started me on this quest was itself 6.37" x 4.87" x 3" externally. We're going to be quite a bit bigger than that - particularly when we leave prototyping mode and the surrounding cable trunking has to be packed in! But for the extra inches, linear and volumetric, we'll be getting sixteen different sound stage orientations, compared to just two with the MORB-1.
A parallel pair of these relays will draw a current of
Ipair = 2 * Vdc / R = 2 * 12V / 160Ω = 150mAfrom the 12Vdc supply (75mA might seem a lot for a single 12V relay, but remember it's a 4PDT type, so the mechanical bulk of switch that has to be moved is much greater than for a typical single pole unit). In the worst case (NW orientation, Mode 5 ON) all seven relays will be energised simultaneously, drawing a total current of
Imax = 7 * 75mA = 525mAfrom the supply, and dissipating a total power of
Pmax = Imax * Vdc = 0.525A * 12V = 6.3W.
What an AC adapter looks like. |
A 12 volt, one amp wall wart should cover our power requirements comfortably. Possible candidates can be found in the Mascot 9881 (unregulated) and 9883 (regulated) series. Might as well use the 2.1mm plug with positive centre pin, just to maximise Arduino compatibility.
Regulated supplies are almost twice the price of unregulated, but will minimise the PSU ripple, avoiding any 50Hz inductive pickup between the coil drives and (the albeit low impedance) audio leads. Also, we are going to be operating well below the PSU's maximum load at all times, and an unregulated supply can rise well above its nominal voltage under such conditions. Update: bought one of each to test. The unregulated one reads almost 20V on my digital multimeter! No problem though, Arduino's on-board regulator can actually handle up to 20V in, and like I said, this voltage will plummet once it's asked to energise a relay coil or seven.
For this application, incidentally, the thumbwheel switch shown above is a far better choice than the most popular encoded rotary switch alternatives, which tend to be rated at 150mA on the nose. This one's gold plated contacts are rated for half an amp - at mains voltage! Sounds like a lot, until you realise that the full 525mA under those maximum load conditions will be travelling along its single common contact strip. If anything, that 500mA rating is too damn low. One way to tweak this might be to use a 9Vdc supply instead of a 12Vdc one; the selected 12Vdc Beta relays actually have a "must operate voltage" specification of 75%, or 9Vdc (pdf). The worst case total current then drops below 400mA, with a corresponding drop in power of almost half (down to 3.6W).
Also, moving from one configuration to another causes the selector switch to visit all positions between the two. This relay power cycling ("chattering") is further exacerbated by the switch's use of plain binary rather than Gray encoding. If that's a problem, the answer may be to power down, move the switch to the new target configuration, then power back up. But the thumbwheel design is less prone to this chatter vulnerability, simply because it is more difficult to "spin" rapidly between settings.
4PDT DIN rail relay base. |
To optimise the DIN rail component and wiring layout, all relays will be mounted in a single row, and physically oriented in the same direction.
However, with either of the switch interconnection conventions mentioned so far, that's a bit of a pest. Both involve a lot of wires from the commons of one relay to the non-common contacts of another. These wires generally cross over from the top side of the DIN rail to the bottom. Why? The relay commons on the DIN rail base, 9-12, are generally on the opposite side from the non-commons, viz. the normally closed 1-4 and the normally open 5-8 (although terminal number 4 seems to have been displaced from its logical position by a mounting hole).
In a way it would be preferable to mount the relay pairs side by side in separate ranks, or to rotate alternate pairs, so as to shorten the connecting wire runs. But there is a third alternative, which has already been alluded to. We can rotate alternate banks electrically, by feeding the output commons of one bank to the input commons of the next, and similarly for non-commons. Schematically, the result is that alternate banks are best drawn upside-down. And since we already know the final stage (the 45° rotator) wants its outputs to be on commons, we're led ultimately to a single unique design...
8-Way Switch with Mode 5 support - full cascade diagram - version 2. |
... this one. Before we start the analysis, here's a quick reminder of the various functions of each of these relay banks:
RL1 - Mode 5 switchNotice that all the wiring complexity has now migrated to the two places where exclusively non-common relay contacts interface, i.e. between RL1 and bank RL2/RL3, and also between banks RL4/RL5 and RL6/RL7. Meanwhile by contrast, the connections between banks RL2/RL3 and RL4/RL5 have become simple one-to-one links. This is achieved by swapping the internal channel pairs in both RL2 and RL3, so they correspond more closely with their RL4/RL5 counterparts. When wiring a DIN relay rail, especially one surrounded by slotted panel trunking, contact proximity matters less than with toggle switches.
RL2/RL3 - 180° rotator
RL4/RL5 - 90° clockwise rotator
RL6/RL7 - 45° clockwise rotator
I've also included input signal #8, the yellow wire in the top right corner, for the first time. Although it's unused in the case of my 7.2 receiver, there are other formats (e.g. 6.x) where its inclusion might be of benefit and/or design guidance value to certain users. However, this rewiring exercise has meant that the green/yellow circuit on RL3 is no longer redundant. Even if you don't have a channel 8 (SB) signal, RL3 can now no longer be demoted to a 3PDT device. And as for 9.x, 11.x and Dolby Atmos users - how do you even add symmetrical front width & height speakers to an octoroom? You're on your own!
Control wiring - reduced options. |
It might be worth repeating here that each "stage" in the design is optional. To omit Mode 5, just remove RL1 and connect its inputs and outputs using wire colours as a guide. Similarly you can omit the 45° orientations, if you have no need to centre the sound stage in a room corner. Just replace RL6/RL7 with eight links, and remember to shift the wiring of the thumbwheel switch by one position down towards the LSB end.
The alternative control switch wiring to accompany both of these changes is illustrated on the left, again for both negative and positive common rails. Here, the relay coils have not been renumbered, so those remaining still correspond to the relay numbers in the main audio signal wiring diagram above. And although I'm still showing a 4-bit hex switch for purposes of continuity of illustration, only the two least significant bits of the switch are actually needed now. This could be replaced with a SP4T rotary plus four diodes.
Building Up
There are 62 individual pieces of colour-coded wire in the audio diagram. I've added suggested relay pin numbers 1-12 to each of the seven relays, but the four circuits within each relay can of course be permuted quite arbitrarily. Using the numbers shown, the table below offers a handy wiring schedule for the audio signal paths. Inputs and outputs are labelled i1..i8 and o1..o8 respectively, and the notation n/p means relay n, pin p.
Colour | Inputs | Stage 1 | Stage 2 | Stage 3 | Outputs | |
Brown | i1, 1/9 | 1/1, 1/6, 2/1, 2/7 | 2/9, 4/9 | 4/1, 4/8, 6/1, 6/6 | 6/9, o1 | |
Blue | i2, 1/10 | 1/2, 3/1, 3/7 | 3/9, 5/9 | 5/1, 5/8, 6/2, 6/7 | 6/10, o2 | |
White | i3, 2/2, 2/8 | 2/10, 4/10 | 4/2, 4/5, 6/3, 6/8 | 6/11, o3 | ||
Green | i4, 3/2, 3/8 | 3/10, 5/10 | 5/2, 5/5, 6/4, 7/5 | 6/12, o4 | ||
Red | i5, 2/3, 2/5 | 2/11, 4/11 | 4/3, 4/6, 7/1, 7/6 | 7/9, o5 | ||
Grey | i6, 1/11 | 1/3, 3/3, 3/5 | 3/11, 5/11 | 5/3, 5/6, 7/2, 7/7 | 7/10, o6 | |
Orange | i7, 1/12 | 1/4, 1/7, 2/4, 2/6 | 2/12, 4/12 | 4/4, 4/7, 7/3, 7/8 | 7/11, o7 | |
Yellow | i8, 3/4, 3/6 | 3/12, 5/12 | 5/4, 5/7, 7/4, 6/5 | 7/12, o8 |
This is the schedule used to construct the spaghettified prototype shown in the photo at the head of this article. Yes, that really was a snapshot of this project, not some random Google image search of bad wiring practices. For reference, if you're playing along at home, the relay numbers are RL1 to RL7 left to right in that photo.
Testing
It's probably a good idea to test your wiring before interfacing it directly to your fragile amplifier outputs and sensitive loudspeaker inputs. Once you've added the relay coil control wiring to the above schedule, connect the power supply, thumbwheel switch and relay coils together and terminate the audio inputs and outputs in suitable blocks. Then, for each of the 16 positions of the thumbwheel switch, connect one probe of a continuity meter to input 1/2/3/4/5/6/7/8 in turn, and scan the other probe along all 8 outputs, checking that only the intended output rings. You can read these intended output index values from the Signal Destinations columns in the first table at the start of this article. Where there are two values, the first corresponds to thumbwheel settings 0-7, Mode 5 off, and the second to 8-15, Mode 5 on.
That's a total of 1,024 manual continuity checks. Alternatively, you could wait until we add the Arduino interface next time, and use a simple test utility routine to perform this entire sequence of checks automatically, 120 times per minute. Your call.
Simulation
Prior to building and testing this prototype, I did a little simulation to prove the wiring. Here's the thing. Can your browser accept a URL that's over 4KB long? If so, click on this link and you'll be taken to Paul Falstad's infeasibly brilliant website, and in particular, to one of the dozens of amazing projects there: the fully web-based Analog Circuit Simulator Applet. You'll see the above 8-Way Switch with Mode 5 support, version 2, fully realised.
A couple of things are different. Six of the 4PDT relays have been replaced by three 8PDT devices, these virtual ones being quite a bit cheaper than similar physical relays. And instead of a thumbwheel switch there's a 4-bit binary counter driving the coils. The audio signals entering at the top are represented by a range of DC voltage levels, which appear in the simulation as a colour gradient between red and green. The idea is to click the clock pushbutton on the top left once, wait for things to settle down, then inspect the sequence of colours along the bottom. Obviously these should shift or rotate one place to the right per click, at least for the first seven clicks. Verifying the correct operation of clicks 8 through 15 is a little trickier, these being the Mode 5 orientations.
Actually you'll have to hold the clock pushbutton down for a good second, until the coil energising pattern changes, then let it go. The simulation is a lot slower than real time, with a circuit of this complexity. About 40x slower by my reckoning - the 2½ minutes it takes to cycle through all 16 orientations represent just 60ms of real time. Still, it certainly did the job of verification I wanted of it, rapidly enough. Paul's little applet is a fantastic achievement.
Next time: remote control!
Subscribe to:
Posts (Atom)