Introduction: OSD Audio ATM-7 Smartphone Speaker Control With Arduino and Blynk

These days there are several ways to implement multi-zone sound using smartphone based control but most are limited to a couple of zones or require expensive proprietary boxes in every location (Hello! Sonos). A speaker selector connected to a receiver with app control and generic speakers in each zone is an alternative solution that can potentially provide better sound and more flexibility. It's an especially attractive option if you already have some or all of the equipment in place. The only problem is that while most receivers these days are app controllable there is a dearth of speaker selectors with smartphone control. Here is a way (two ways, actually, which we will refer to as Method 1 and and Method 2) ) to add smartphone control to an OSD Audio ATM-7 speaker selector using an Arduino board and ethernet shield. Elements of this project can be adapted to add app control to any speaker selector but if you want to do this you might be better off looking at this. Actually, you should look at that project anyway since many of the steps are applicable to this project and the photos are clearer. I used the ATM-7 for a few reasons. First, I had one already. Second, it has vast amounts of real estate inside the case to house the Arduino and other stuff you'll need. Third, it uses 12v power and (very nice) relays to do the selecting - most speaker selectors are entirely passive with push-button mechanical switches. This wasn't quite the advantage I had originally anticipated (more on this later) but still made for a better starting point than a non-powered box. In fact, the only downside to the ATM-7 is the cost vs. a simple box - not necessarily relevant if you have one already though if you accidentally brick a perfectly functional unit during the project you might think otherwise. Proceed at your own risk.

Another caveat: While "Method 1" preserves all the ATM-7's original functions, "Method 2" eliminates some functionality. For me, and I suspect most other users, this is of no consequence. Nevertheless, if you proceed with Method 2 you may want to refer to Step 9, "What is Lost in the Fire", before breaking out the drill and hacksaw.

Finally, I certainly wouldn't want to suggest either Method is the best way to achieve the desired result - I've tried to flag obvious alternatives in the appropriate Step - but they do work.

Step 1: Ingredients

  1. OSD Audio ATM-7. I paid $150 for mine a couple of years ago so I was a bit surprised to see the price as of this writing had increased to $220. Hopefully you already have one if you've got this far.
  2. Arduino Board. This is a Mega but just about any recent Arduino or Arduino knock-off would do.
  3. Arduino ethernet shield. Make sure the shield will fit the Arduino board you are using (this one fits the Mega in item 2).
  4. Male to female connectors. You'll have plenty left over for other projects.
  5. 8 Channel DC 5V Relay Module. Controlling relays with another relay may seem a bit daft but this thing is so cheap...
  6. Latching switches. You'll need at least seven of these. Don't have to be as fancy as these though.
  7. Lots of twisted pair wire or similar for the interconnects (old telephone wiring or anything flexible and capable of carrying 30 mA or so should be fine).
  8. 5V power supply - you might well have one (or more) of these from some unused/obsolete bit of electronics but if not here you go.
  9. Depending how neat you want the finished product to look, an ethernet jack and USB port - probably not worth it if you don't have them lying around.

Method 1 does not require the switches and you could even complete Method 2 without switches. I had a bunch of perfect switches from an earlier project that went in another direction. Even if you need to buy them I think they might be worthwhile to include in Method 2. As explained later the 5V relay may also be not necessary for Method 1 but for $8 or thereabouts I'd use it. You will need it for Method 2 unless you are a real electronics whiz (see comment in Step 3).

Assuming you do have an existing ATM-7, therefore, total cost is around $80 (or less than $40 if you decide to go without the relay and switches). Speakers are extra ($10 to $100,000 each, depending on your persuasion).

Step 2: Tools

As with any project, the more tools at your disposal the better. At a minimum, though, you'll need:

  1. Multimeter
  2. Soldering iron
  3. Drill with a step drill bit (Method 2 only)
  4. Jig saw (probably could get away with a hack saw) (Method 2 only)
  5. Dremel
  6. Basic hand tools (pliers, screwdriver etc.)

Step 3: Disassembly and Method 1

The box is pretty easy to take apart. All screws are easily visible and there is nothing glued or molded in place. Once you have the cover off, you'll see just how much space there is to play with. The first picture shows the open case with the control board and relay board still in place. The wires I have messily soldered to the momentary push button pins of the control board were my first thought on how to execute the project. The black tape is insulation to isolate the relay and Arduino boards from the ATM-7 case. The second close-up picture shows which pins need to be connected more clearly. Shorting these pins toggles the corresponding speaker selector 12V relay via the logic in the ATM-7 control board. So what I was going to do was connect these wires to the NO terminals of the 5V relay which would then be controlled by the Arduino - which would then in turn trip the ATM-7's 12V relays. A more elegant solution might have been to have the Arduino fool the logic controller into thinking the momentary button had been pressed by sending a 5V signal directly to the NO pin from the Arduino but I never tested this (though I did measure the voltage of the signal sent from the button and it was about 5V). Using this approach there would be no need for the intervening 5V relay.

In any event, the relay solution definitely works and I got as far as writing the code (minus the web server) to test the approach. The only glitch was that the 5V relay board needs its own 5V power supply - the Arduino board itself does not provide enough current from the 5V output to power the relay.

I should perhaps mention that , if you really want to dispense with the 5V relay and are handy with electronics, it may be possible to add a circuit between the Arduino and each of the 12V relays so they can be controlled directly with the Arduino - see the very helpful Instructables post here. If the 5V relay was more than a few bucks I guess I might have tried this. This comment is equally applicable to Method 2.

The problem with Method 1 is that there is no easy way to know what state each 12V relay is in (and therefore whether a speaker zone is on or off). The front panel of the ATM-7 has LEDs to indicate state but that's not much use if you are not within line of sight. In fact, this was one of my frustrations with the stock unit. It comes with an IR remote (shown in the first picture above) and in a nice touch a remote sensor for the remote. So you could (and I did) have the ATM-7 hidden away (mine was in the basement) and run the sensor to a place where you could use the IR remote. This feature was why I bought the thing in the first place instead of a cheaper passive box. In practice, however, the IR remote set-up turned out to have very little use. Using the remote sensor meant by definition you were likely not in line of sight to the ATM-7 and the remote itself had no indication of what state each zone was in. Even more annoying was I found that I was rarely in the room where the remote/remote sensor was when I wanted to use the control - and this would have been the case wherever the sensor was located. Method 1 would resolve the second problem but not the first. If you don't care about knowing the state of the 12V relays (for example because you can hear which speakers are on or off) I'd definitely recommend you go with Method 1 because you can dispense with with the horrific violence to be visited on the ATM-7 to implement Method 2. In the end, I had no choice.

Step 4: Method 1 - the Catastrophe

If I'd stuck with Method 1 at this point the project would have been pretty much done. The wires from the selector push button pins just needed to be connected to corresponding channels of the 5V relay board and the relay board connected to the Arduino. These steps are described in the post mentioned at the top of this article so need not detain us here. I'd only note that by using the ATM-7 we only need to use one channel of the 5V relay per zone (since each ATM-7 12V relay switches both left and right speakers). I'd also suggest you consider my approach to the coding (described in Step 10) rather than the suggestion in the post.

However, I'm not someone to miss a chance to seize defeat from the jaws of victory. I really wanted to have the control app indicate state. The zones controlled by my ATM-7 are widely distributed (most are outside the house) so you can't really tell by listening which zones are on or off unless the volume is turned up to unneighborly levels. Exacerbating this problem is that the ATM-7 has no impedance protection (other than being able to disable simultaneous multi-zone operation). So if multiple zones are inadvertently selected there is a risk of damage to the amp or receiver. I had added external impedance protection of my own devising but I still worried about having all the zones on by mistake (it is the human condition to worry about something trivial if life is not supplying something major to worry about).

In any event, despite my complete ignorance of electronics (did I mention that?), and newbie-status with the Arduino, I figured I could solve the state issue. My thought was to have the Arduino read the on/off state of each front-panel LED zone status indicator and somehow integrate this information with the control app display. Quite how I was going to code this wasn't obvious to me but as a first step it was clear I'd need to employ my soldering skills again to add a wire to each LED pin to measure the applied voltage.

Earlier, in a step omitted from this already-long narrative, I had drilled some holes in the bottom of the ATM-7 case to mount the Arduino and relay board. While drilling I had made a mental note to be careful to clear out the swarf produced by the drilling before switching the unit on again. Unfortunately, making a mental note and actually doing something about it is not one of my strong suits. So when I powered up the unit after doing the LED-related soldering a bit of swarf got somewhere where a bit of swarf shouldn't be and I fried the control board. Oops.

Step 5: Method 2 - Lemonade (Method 2)

After some self-flagellation, I considered alternatives. The loss of the control board meant Method 1 was no longer viable. But in my view the real gubbins of the ATM-7 is not really the control board - it's the 12V relays and high-quality speaker terminals mounted on a separate board at the rear of the unit. And after all, what was I really trying to do from the get-go but to upgrade the control features? So @*#& you, control board, who needs you anyway?

At the end of the day, aside from a few non-essential bells and whistles, all the control board did was send a signal to the relays to change state. I had my Arduino to do that! True, the board did provide a way for the user to turn zones on or off using the momentary push-buttons if they happened to be standing next to the unit. But in my two years of ownership this was a situation I'd never encountered. In any event, using toggling with momentary buttons was the thing that was causing all the problems with showing state on the app.

That said, I was uncomfortable with having no way to turn zones on and off other than via a smartphone app. Call me old-fashioned, but a physical switch, and an old-school latching switch at that, is the gold standard for on/off. Also, as previously mentioned, I had a bunch of these lying around looking for a purpose in life. They even had built in LED status lights so the loss of the control board LEDs wouldn't be a problem either.

A minor issue was that the switches required a 16mm mounting hole - quite a lot bigger than the approx. 3mm holes in the stock unit. Enlarging the holes required removing the ATM-7 face plate from the chassis and drilling out the holes with a step drill. Once again, disassembly is a breeze with some easily visible screws. This is also a good time to remove the pesky control board (it's attached to the front of the chassis, not the faceplate) and set it aside. Do not discard - like Jay-Z it still has its uses.

If like me you don't do much metal work, it is worthwhile to remember to go easy with the drill speed - even though the faceplate is relatively soft aluminum. I also used a little cutting oil, partly as prophylactic, partly because I like the smell of hot machine oil. You also don't want to make the hole too big. Not only will the switch drop through the hole but in a stroke of serendipity rare in project execution the spacing of the existing 3mm holes was just enough to accommodate the mounted 16mm switches - provided you leave the hole just big enough to push the switch through to its flange.

Drilling the holes, while at first blush intolerable violence to a good-looking faceplate, is very straightforward and leaves a professional-looking result. If you use 16mm switches, though, you'll also need to enlarge the existing slot in the front of the chassis through which the switches must also pass. Since the chassis is hidden by the faceplate, this can be quickly accomplished using a jig saw equipped with a metal-cutting blade. The result isn't pretty but it gets the job done.

Be careful to clean up the swarf and other debris from these operations!

The ATM-7, in addition to allowing switching of seven speaker zones, also allows you to switch two sources, also using a 12V relay. I was comfortable leaving this to app-based control since, while I do have two sources connected, they are pretty much identical in available front-end inputs so there is never any real need to use the alternative source. Whether you install a physical switch for this is up to you but the same process would apply.

Step 6: Installing the 12V Relay Control Wire

OK, now we have wreaked havoc to the front of the unit, let us turn our attention to the back.

First we need to remove the relay/speaker terminal assembly from the chassis. This is held in place by a few screws through the PCB and about six million screws through the terminals themselves. (27, actually, but far more than seems strictly necessary).

Once you've recovered from the carpal tunnel from all that unscrewing, flip the board over and identify the control +ve and ground pins for each speaker relay. Solder a wire to each control +ve pin as shown in the picture (or not exactly as shown given my shameful soldering but at least to the same pins). Then solder a wire (or two) to one of the control ground pins (I used the Zone 7 relay - the two blue wires at the extreme right of the picture). Make sure each +ve wire is long enough to run under the PCB to the 5V relay terminal block and the ground can be connected to the unit ground. Not shown is the wire to control the A/B source relay (I decided to keep this functionality at the last minute). This is on the extreme left of the picture. Note that the control +ve and ground pins are reversed for this relay.

While the PCB is uninstalled, consider how you will turn the unit on and off without the control board. You could decide to dispense with this completely since we will use the ATM-7's original 12V supply to power the Arduino and shield - and this must be left permanently on to allow app control - and the remaining power draw is negligible (especially because the 5V relay has its own independent supply). However, I rewired the existing on/off switch directly to the 12V supply pins on the relay/speaker terminal PCB so the unit could be shut down completely if required. I don't have a picture to show this but the PCB layout is simple and you can use a multimeter to confirm the correct pins. Now that you've done that you can run 12V power to the Arduino's power-in jack (2.1mm power plug, center is +ve).

Step 7: Installing Ethernet Jack and 5V Power Supply

You could of course run an ethernet cable directly through the case to the Arduino ethernet shield but I decided to install an ethernet jack to make disconnection and movement of the unit a bit easier if required. The stock unit has a switch in the rear of the case to put the unit in "Master" or "Slave" mode. It also had an adjacent small square cut-out that served no discernible purpose. Frankly, the Master/Slave thing had always been a bit of a mystery to me too and its associations with a troubling part of American history recommended elimination of the functionality, whatever it was. Removing the switch and combining its hole with the unused cut-out provided a convenient place to install the ethernet jack as shown. Not the neatest job, perhaps, but it is in the rear and therefore usually out of sight. The black wire next to the jack is the incoming 5V supply for the 5V relay. If I knew anything about electronics I suppose I could have used a voltage divider or some such to get the 5V supply from the main 12V supply but since I had a surfeit of unused 5V power supplies lying around this seemed more trouble than it was worth.

I did consider adding a USB port so that new code could be uploaded to the Arduino without removing the case cover but since I didn't have the necessary interconnect and removal of the cover is pretty easy I didn't bother. You could also just drill another hole in the case for a USB cable or perhaps even figure out a way to mount the Arduino and ethernet shield so the existing ports can be made flush with the case and holes cut in these locations. For reasons I cannot now remember this last didn't seem an option for me.

Step 8: Wiring

Now we are ready to install and wire up the Arduino and shield, the 5V relay, the switches, and to re-install the 12V relay/speaker terminal assembly. I realize the synoptic view on the first picture is not that helpful other than to demonstrate general layout, though close inspection is more revealing than you might think. The close-ups are not much more helpful but might provide additional clues. The good news is that the chaotic wiring looks far more complicated than it is. What we are dealing with here is six identical channels for the speaker zones (the ATM-7 can accommodate, well, seven, zones but I am using only six) and a small variation of that wiring for the source selection. So once one channel is wired up correctly it is a simple matter to replicate the arrangement for the other channels.

Let's deal with the Arduino pins first. We'll need to connect seven digital I/O pins to seven of the input pins of the 5V relay (six for the speaker zones, one for the source selector). The only challenge here is to keep straight which Arduino pin is connected to which channel of the relay but since this is software configurable even this is of little consequence. As already mentioned, the 5V relay board cannot be powered by the 5V out pin of the Arduino but you still need to connect the Arduino 5V out and ground out to the corresponding input array pins on the relay board. The power to do the actual switching comes from the separate 5V supply and is connected to the 5V input pins on the right hand side of the board as you look at the picture (the blue and brown wires). My relay came with a preinstalled jumper on these pins that will need to be removed.

Next, connect the wires from the control +ve pins of the 12V relays we soldered in Step 6 to the NO terminals of the 5V relay. Then connect 12V +ve power to the common (center) terminal of each of the terminals.

Finally, we need to sort out the latching switches. Assuming you are using switches similar to the ones I used, I recommend soldering up wires to the appropriate terminals before you install them in the faceplate. Trying to do this with the switches installed would be very challenging.

Remember the purpose of the switches (other than to fill the giant holes we have drilled in the faceplate) is to provide back-up manual switching for the 12V relays. We also need to provide 12V power to the switches to indicate state. Keeping these points in mind will help you understand the wiring scheme. First, bridge the NO pin to the 12V +ve pin. Then solder another wire to the NO pin which will go to the NO terminal of the corresponding 5V relay channel. Next, solder a wire to to the common pin which will be run to the common terminal of the corresponding 5V relay channel. Finally, solder a wire to the -ve pin for connection to 12V ground. Given my soldering skills, I would have preferred to use spade connectors but these switch pins are so small I've never found connectors that would fit.

This arrangement means that the switches will indicate state correctly when they are latched "off" but the zone has been switched on via the app (which is what we want). Of course, it also means that if they are latched "on" the zone cannot be switched off via the app. But since the switches are intended to be primarily state indicators and only back-up control switches we shall airily dismiss this wrinkle as of no consequence.

Oh yes, remember the control board? I sawed it in half to remove the zone selector section and reinstalled the rest. This filled in some embarrassing holes in the faceplate and allowed me to add wires from ground and the NO terminal of the source selector channel of the 5V relay to the source selector LEDs so they indicated correctly on the panel (you'll need to add a 330 ohm resistor to each LED in series with the resistor already on the board). Nothing in this paragraph affects real functionality so feel free to omit.

Step 9: What Is Lost in the Fire

As disclosed in the introduction and passim, Method 2 does result in the loss of some functionality. For me, none of this mattered but it might to you. Here is what is lost:

  1. Ability to disable multi-zone capability (remember the ATM-7 has no impedance protection). Now that we can monitor which zones are already in use on our smartphone I think there is much less need for this. I never used this function even before modification because I not infrequently wanted at least two zones on at once.
  2. Ability to mute all zones. Never saw the point of this. Far easier to mute the source or turn off all zones (simple and fast now we can do it with our smartphone!)
  3. Master/Slave option. As discussed in Step 7, the less said about this the better.
  4. In/Out Mode. The ATM-7 allows you to connect up to seven speaker zones and two sources OR up to seven amps/receivers and two speaker zones. Not exactly sure what this button actually did (ensure two amps could not be simultaneously selected?) but in any event there is no conceivable scenario where I'd use it in the "Seven In" mode.
  5. IR remote. Junking another device-specific remote and replacing it with my phone is one of life’s guilty pleasures – especially if as here it had little or no practical utility.

Step 10: Code and Wrap-Up

By now you are probably quite tired and not ready to write (or even cut and paste) a bunch of code. I certainly was. I'm also not skilled enough to produce a nice looking app that is easily reconfigurable.

Fortunately, the folks at Blynk have done all the heavy lifting required and if (like me) you are new to Blynk it comes with plenty of free credits (or "Energy") to add the control necessary. You can even select the layout of the buttons to provide a graphical representation of speaker location and button color for inside or outside locations (for example).

The Blynk app is amazingly stable - far more reliable than any of my receiver control apps - and super fast even though I'm using the Blynk server (you can also use your own local server as explained on the Blynk site).

Follow the steps described on the site to download the Blynk libraries, cut and paste the code and authentication token, upload to your Arduino, and you are done. Yeah!

After whatever testing you deem appropriate (I checked expected continuity between source and speaker zone terminals) put the cover back on and wire up the source and speaker zones. This is perhaps the most tedious task of the project but once again the superior build quality and speaker binding post options of the ATM-7 go some ways toward justifying the premium price over a more down-market box.

Internet of Things Contest 2016

Participated in the
Internet of Things Contest 2016