Audio Switcher (Arduino)

2,119

11

6

Introduction: Audio Switcher (Arduino)

About: Hi, i'm Thomas a Dutch ICT student and graduated Mechatronics engineer. I like to Make projects, watch movies and series, sometimes read and try to play keyboard.

This project was came to a start because my school project group and I needed to switch multiple audio sources to one audio amplifier. When searching on the internet for some sort of audio switch module for Arduino we couldn't find anything like it. I already knew of a chip capable of switching analog signals, but no really useful mudules were available for it either. So I got to work and created my own.

Step 1: What Do You Need

This board is completely SMD (except for the pin headers) which means all of the components are soldered on top of the PCB. This means the soldering connections are very tiny and thus harder to solder than through hole components. For this reason I recommend you not to try this without first practicing with larger components.

Bill Of Materials:

  • 1x 74HC139
  • 1x CD4052
  • 10x 10uF capacitor (0805)(bipolar)
  • 4x LED (0805)
  • 4x 330 ohm resistor (0805)
  • 5x female audio jack
  • 1x 5 pin header

There also is a BOM exported from EasyEda:

Step 2: The Schematic Explained

I will only go over the workings of the schematics briefly so most people can follow this if they want.

As the pin header is not that interesting we'll move on to the 4052 chip. This chip is a dual analog switcher and as the name implies it switches the audio signal from on of it's four inputs and directs it to the one output. Because most of the time audio is stereo we need two audio switchers. this is where the "dual" comes in handy. The lables are marked as CH1_L for "channel 1 left" or COM_L for "common left" and can be followed to the jack connectors.

Next up is the SN74HC139. This is a demultiplexer but don't worry about this weird term. Its main functionality is to indicate which channel is currenty selected to pass through the audio signal. This is the part where I made a minor mistake. It was supposed to light up an LED at the channel which is selected, but as it is it lights up all leds EXCEPT for the selected channel. So you can think of the LEDs as "this channel is muted" indicators.

The only parts left are the audio jack connectors. Nothing special to see here actually. The only thing that might seem weird is the capacitors. These are decoupling capacitors and they block DC signals and let trought AC signals like audio.

Step 3: Ordering a Board

As you may have seen on the photos of the real PCB I had to make a connection with a wire which I didn't plan for. This is because the package of the 74HC139 is not correct (an error of the EasyEda library). Until I fixed the board with the right package size there will be no board file available.

This page will be updated on a later date with the Gerber files

Step 4: Using the Board

The first thing you will need to do is to power the board with 5 volt because it will not work without it. All logic also works on 5 volt. Connect Sel1, Sel2 and Mute to the arduino because they are not pulled up or down by any resistor. If they are not connected they will be floating wich will evoke weird hehavior.

This board has a mute functionality which will prevent any signal to travel trough the board. In its muted state all LEDs will light up. To mute the board pull the pin high.

To select a channel first mute should be disabled. With the two Sel pins you can select a channel according to the truth table.

Step 5: End

Thanks for checking out my instructable. I hope this was of any use to you. If you have any questions left leave them in the comments. Most of the time I reply within a few days.

Be the First to Share

    Recommendations

    • Pocket-Sized Speed Challenge

      Pocket-Sized Speed Challenge
    • Audio Challenge 2020

      Audio Challenge 2020
    • Maps Challenge

      Maps Challenge

    6 Discussions

    0
    Thibautw1
    Thibautw1

    2 months ago

    Thank you for this tutorial!
    I was searching for the audio demultiplexer for hours! I want to embed this one in my selfmade arduino nano project so I just need a power source and some buttons to select the correct source, kinda like an all in one pcb!

    I got one question though.
    Is the signal reversable? Can I use one input source as the common pin and four the channels as output?
    Greetz T

    0
    Thomazzz3
    Thomazzz3

    Reply 2 months ago

    Hi there,
    I'm glad you liked it! I know your trouble finding the right component. For ICs that need to perform very general tasks I generally look first at well known chip series like the 40xx or 74xx series.

    To answer your question I needed to look back at the datasheet. Yes, it looks like you can use the common pin as input source. The datasheet states that it is an analog multiplexer (many to one) as well as a demultiplexer (one to many).

    Have fun with your project ;)

    0
    Thibautw1
    Thibautw1

    Reply 2 months ago

    Hello!

    I found another issue, I've come across. One connection between a channel and a common pin also has a microphone input. I suppose I could just buy two four pin audio connectors and route the mic net directly to the output. Now my question is will it cause my computer to detect the microphone when it's not connected? And if it isn't connected will it cause some noice on the mic net?

    Greetz T

    0
    Thomazzz3
    Thomazzz3

    Reply 2 months ago

    Hi,
    Your situation and setup is not very clear to me.
    As for your unconnected input question.
    (1) your PC will probably not detect a mic if it is not connected. For example in your "mic directly to output" case it will just act like an extension cable. If you want to test it just hook up a normal audio extension cable to your PC and see if it detects anything.
    (2) I believe there will be noise present on an unconnected input as an open ended circuit acts like an antenna. By directly connecting this to your output/PC it may cause noise and I don't know what will happen in you connect a mic an have one channel playing at the output.

    Maybe you can put your mic in to one of the 4 channels of the multiplexer. Or do you want to use your mic and one channel at the same time?

    (reference) Noise on input: https://www.diyaudio.com/forums/solid-state/254128-lots-noise-input-unconnected.html

    0
    jamesrobertguy
    jamesrobertguy

    Question 2 months ago on Introduction

    Hello.
    I am trying to make something very similar to this so thank you in advance for the help that you have already given me without knowing!!! Im going to connect it up to a D1 mini and control it with Alexa.

    I have a couple of questions if you dont mind.
    1) Is the 74HC139 chip and LED Needed or is just something you wanted? If so what is the fix to to make sure that the designated led corispondes to the correct port.
    2) Im probably not going to make mine SMD at this stage. But do the capacitors have to be bipolar?

    Again. Thank you in advance and i will let you know how it turns out.

    James

    0
    Thomazzz3
    Thomazzz3

    Answer 2 months ago

    Hi James,
    It sounds very fun what you are doing with Alexa. If I remember correctly D1 is a wemos D1 mini (with the esp8266). I've used it once for some wifi and deepsleep stuff, but not much more. Anyway to answer your questions:
    (1) the 74HC139 and leds are not needed. They are just indicators of which channel is selected. Just leave them out if you want.
    (2) yes, the capacitors have to be bipolar because the audio signal is AC. Polarized capacitors are not allowed to be reverse charged (if that's the correct term) . In this application you would call them coupling capacitors.

    Here the use of the capacitor is explained more clearly (upvoted answer) : https://electronics.stackexchange.com/questions/6958/audio-ac-coupling-capacitors

    If you have more questions just let me know.
    Goodluck!