Close
0%
0%

Muffsy Stereo Relay Input Selector

Open Source, versatile audio relay input selector controlled by an ESP32 or a rotary switch.

Similar projects worth following
A stereo relay input selector controlled by an ESP32 or a rotary switch, with full ESP32 pin break-out for maximum flexibility.

This project uses Panasonic TQ-2 relays and separates power and signal grounds to prevent any switching noise, clicks or pops in the audio channels.

This project is fully open source. Use it for any purpose and change it into whatever you like. I would appreciate some credit if you decide to fork the project, but it's not required.

PROJECT STATUS:
This project is fully built and tested. There's no programming of the ESP32 offered as of yet.

Eagle project files and gerbers are available in the files section.

Features

  • Five stereo inputs, switched with Panasonic TQ-2 relays
  • One stereo output
  • Controlled with ESP32 or rotary switch
  • Space for the ESP32-DevkitC/NodeMCU, with break-out for all pins
  • IO pins go high when activating a relay, can be used for indicator LEDs
  • Power/GND for ESP32 and relays separate from signal power/GND
  • Pin distance for power and signal input/outputs: 5.08 mm / 0.2"
  • Pin distance for optional rotary switch: 2.54 mm / 0.1"
  • Fully open source, no strings attached

Schematics and Downloads

ESP32 Module

The ESP32 module used for this project is the one called ESP32s NodeMCU. It's got 2x19 pins, no pin labels on the top, and a white bottom side with the text "NodeMCU ESP-32S v1.1"

The ESP32 development kit has a CP2102 USB to UART bridge, drivers are available from Silicon Labs:

Information on how to program the ESP32 using the Arduino IDE is available from Espressif:

Espressif's "IoT Development Framework" IDF/SDK is available here, along with a lot more information:

MuffsyRelayInput-Eagle.zip

Muffsy Relay Input Selector - Eagle project files

x-zip-compressed - 39.45 kB - 02/26/2018 at 07:19

Download

MuffsyRelayInput-withoutESP-Eagle.zip

Muffsy Relay Input Selector without ESP32 - Eagle project files

x-zip-compressed - 46.23 kB - 04/15/2018 at 15:28

Download

MuffsyRelayInput-Gerber.zip

Muffsy Relay Input Selector - Gerbers for PCB manufacturing

x-zip-compressed - 296.32 kB - 02/26/2018 at 07:22

Download

MuffsyRelayInput-withoutESP-Gerber.zip

Muffsy Relay Input Selector without ESP32 - Gerbers for PCB manufacturing

x-zip-compressed - 152.83 kB - 04/15/2018 at 15:29

Download

ESP32-DEVKITC.lbr

The ESP32S Devkit - Eagle Library

lbr - 16.82 kB - 02/04/2018 at 22:35

Download

View all 9 components

  • Lo Tech Muffsy Stereo Relay Input Selector - Without ESP32

    skrodahl04/15/2018 at 15:22 0 comments

    A version that excludes the ESP32 and adds LEDs has been requested. So I made one. Eagle project files and Gerbers are available in the files section.

    Here it is (just imagine the drum roll first):

  • Wifi problem gives great cable for rotary switch - The Muffsy Input Switch is now fully tested

    skrodahl04/06/2018 at 13:27 0 comments

    One problem with projects like these is that they have a tendency to end up as a heap of spaghetti.

    So I've been wondering about how I should do the rotary switch in particular (in a setup without the ESP32 module). This is the simplest setup, and you don't have to write any code at all.

    Coinciding with this, wireless coverage isn't that great in my new house. So I bought a Google Wifi bundle, and look what came with it:

    Yup, a very flat network cable. Great timing, hey? Let's get snipping!

    I kept the white leads on each side, and cut the white ones in the middle. The switch is 2P5T, I'll only use one of the poles. Yeah, and the ESP32 module will be removed.

    Here's the board without the ESP32 and the transistors, cable fully connected:

    There are crimp connectors on the rotary switch, since it's fairly sensitive to heat (such as from a soldering iron). That's it, apart from connecting power to the relays, connect inputs and output, and cut the flat cable to the correct length.

    Finally, with power connected. The rotary switch works perfectly, turn it to slowly and it will break one channel before connecting the other one. So no two channels mixed at any time.

    There you have it. A stereo relay input switch that can be controlled by either an ESP32-module or a rotary switch. Fully tested and all.

  • Simple sketch - Switch between Relay1 and 2, every 4 seconds

    skrodahl03/31/2018 at 15:53 0 comments

    This sketch will:

    • Define all the relays, and the ESP32's internal LED
    • Turn on Relay1, blink internal LED once
    • Wait four seconds
    • Turn off Relay1, turn on Relay2, blink internal LED twice
    • Wait four seconds, turn off Relay2 and start over
    • It also writes to the serial monitor when a relay is turned on or off, and uses two different ways of blinking the LED

    This shows how to turn on and off relays. Remember, you can connect an LED between the relay1-5 IO pins together with a 330 ohms resistor to GND. This LED will light up when the corresponding relay is active.

    The ESP32 has the capability to store the last selected relay, so it can be selected directly if the device is turned off and on again. (not shown here)

    Instead of just looping through the relays you can use push buttons, a potentiometer or a rotary encoder (and lots of other things that can hook up to the ESP32) to decide which relay is turned on.

    #define LED   2       // Internal LED
    #define relay1 23     // relay1 on IO23
    #define relay2 22     // relay2 on IO22
    #define relay3 21     // relay3 on IO21
    #define relay4 19     // relay4 on IO19
    #define relay5 18     // relay5 on IO18
    
    void setup()
    {
        pinMode(relay1, OUTPUT);
        pinMode(relay2, OUTPUT);
        pinMode(relay3, OUTPUT);
        pinMode(relay4, OUTPUT);
        pinMode(relay5, OUTPUT);
        pinMode(LED, OUTPUT);
        Serial.begin(115200);
    }
    
    void loop()
    {
        // Turn on relay1
        Serial.println("Relay #1 - ON");
        digitalWrite(relay1, HIGH);
        
        // Blink internal LED once
        digitalWrite(LED, HIGH);
        delay(200);
        digitalWrite(LED, LOW);
    
        // Wait 4 seconds
        delay(4000);
    
        // Turn off relay1
        // Turn on relay2
        Serial.println("Relay #1 - OFF");
        digitalWrite(relay1, LOW);
        Serial.println("Relay #2 - ON");
        digitalWrite(relay2, HIGH);
    
        // Blink internal LED twice
        for (int counter=0; counter<2; counter = counter+1){
          digitalWrite(LED, HIGH);
          delay(200);
          digitalWrite(LED, LOW);
          delay(200);
        }
    
        // Wait 4 seconds
        delay(4000);
    
        // Turn off Relay2
        Serial.println("Relay #2 - OFF");
        digitalWrite(relay2, LOW);
    }

  • Eagle Project Files and Gerbers

    skrodahl02/26/2018 at 15:13 0 comments

    Eagle project files and Gerbers are now available in the files section.

  • First Test of Audio Switching - Success

    skrodahl02/25/2018 at 21:30 0 comments

    The ESP32S is now mounted on pin headers:

    Testing with an oscilloscope and the QA401 audio analyzer reveals that there's no switching noise, nor any clicks or pops injected in the audio channels. And, it does of course switch the left and right stereo channels. :) 

  • Boards Received and Assembled

    skrodahl02/19/2018 at 21:11 0 comments

    The slow boat parked outside my house today and brought with it some shiny white PCBs.

    As you can see from the pictures, it's already built. The board was tested successfully using a short loop turning the relays on sequentially. I was able to verify that each relay turned on and off using the continuity tester on my multimeter.

    This first picture shows a test mounting of the ESP32S and the terminal blocks for signal input/output.

    A first for me, silk screen on the back:

    Stuffing the board was a quick job. Since my pin headers haven't arrived yet (and I am quite excited to see if it works), I soldered the ESP32S to the board.

    I need to either skip the terminal block for input power, or be really convinced that my programming is correct before I mount it. The screw terminals will block the USB connector of the ESP when in place. Of course, I am going to build a few more, so I might just consider this the prototype.

    Here's the completed board, without any kind of sensors or mechanics for actually switching channels:

  • Project Coder: Zeev Glozman

    skrodahl02/09/2018 at 11:12 0 comments

    I am not the best programmer there is, so I'm happy to say that @Zeev Glozman kindly volunteered to do the ESP32 coding for this project.

    Thanks Zeev!

  • Test - Controlling a relay with ESP32

    skrodahl02/05/2018 at 09:21 0 comments

    The ESP32 switches the relay on and off, just as a proof of concept:

  • ESP32S Devkit - Eagle Library

    skrodahl02/04/2018 at 22:38 0 comments

    I couldn't find the footprint for the ESP32S Devkit anywhere, so I made my own.

    You'll find it in the files section.

  • Schematic

    skrodahl02/04/2018 at 22:27 0 comments

    Here are the five relays, all controlled by the ESP32 (or a rotational switch, using S0 to S5, S0 being the center pin).

    Five stereo inputs, one stereo output.

    The ESP32 switches the relay power to GND using transistors connected to IO23, IO22, IO21, IO19 and IO18.

    Power ground and signal ground are separate.

    Here's the routed board with dimensions in mm:

    Power inputs and signal inputs/output have 5.08 mm pitch (0.2") to accomodate screw terminals. 

    The solder pads for the rotational switch (S0-25) and ESP32 break-outs have 2.54 mm pitch (0.1").

View all 10 project logs

Enjoy this project?

Share

Discussions

woelfel.pub wrote 03/12/2018 at 10:24 point

Hey, do you plan to offer this as a kit like with the MC Phono Amp? I would be very interested.

  Are you sure? yes | no

skrodahl wrote 03/20/2018 at 15:28 point

Hi,

Due to the cost of both the ESP32 module and the relays, it would be a very expensive kit indeed. Also, it lacks a power supply.

The answer is no on this one. But you do have all the design files to have your own boards produced, and a Mouser shopping cart for easy ordering of the components.

  Are you sure? yes | no

Zoltan Sisko wrote 02/25/2018 at 22:57 point

The emitter and collector of the transistors are reversed on the schematic diagram.

  Are you sure? yes | no

skrodahl wrote 02/26/2018 at 07:14 point

In what way? I am connecting two grounds. The circuit is shorted when the base goes high, regardless which sides are connected to the base and the collector.

I have changed it though, so it looks the way it "should". New schematics, Eagle project files and gerbers are in place.

  Are you sure? yes | no

Zeev Glozman wrote 02/06/2018 at 16:28 point

Hey i just wanted, to share this while its a completely differnet application, its an interesting read. http://www.arrl.org/files/file/QEX_Next_Issue/2014/Mar-Apr_2014/Dzado.pdf

  Are you sure? yes | no

skrodahl wrote 02/02/2018 at 15:25 point

The following steps have been taken to avoid pops and noise:

 * Using "make before break" relays
 * There are diodes between the relay rails
 * The relay power/GND is separated from signal/GND (which means this things needs its own separate PSU to work as intended)

I hope that will make this thing silent. I won't know before I build it though. PCBs are on their way on the slow boat, so it'll be a week or four...

  Are you sure? yes | no

skrodahl wrote 03/02/2018 at 10:18 point

UPDATE: The relay board has now been fully tested using an oscilloscope and the QA401 audio analyzer.

There are no clicks, pops or noise of any kind entering the audio channels.

  Are you sure? yes | no

K.C. Lee wrote 02/02/2018 at 12:47 point

I had to use relay for muxing audio because I didn't want to wait for my PCB.  It worked but there are pops when they switches.  Video shows it.

https://hackaday.io/project/12133-automatic-audio-source-switching/log/44041-stand-in-daughtercard

Relay contacts bounce during switching and inject noise into the audio. That's why I didn't use them for my design.    Analog MUX on the other hand are quiet.

If you still want relays, you could mute the output during switching.  Also looks for something with less bounce.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates