How to Connect a Sensor With Audio Input and Output




Introduction: How to Connect a Sensor With Audio Input and Output

A sensor is one of a basic component for capturing physical environment. You can get the change of light with a CDS photocell, you can measure the space with a distance sensor, and you can capture your movement with an accelerometer.

There are already several way to use push buttons in your projects (e.g. hacking mouse and keyboard, or Arduino, gainer, MCK). This probides alternative way to use faders with audio input and output. With a tiny circuit (which you will make), you can get sensor data with audio!

As side effects, it provides you with precious sampling resolution and frequency than the previous ways (i.e. 16bit to 8-10bit, 44.1KHz to 1KHz).

You can see examples of this with CDS photocell, and distance sensor (SHARP GP2D12).

We also present a sharker percussion with accelerometer and an application of this instructable from a sound performance project AEO.

All you need is just a sensor, some soldering, and some software.

Note: This is for analog voltage produce type sensors only. This will not work on digital type.

Note2: This is a series of "How to coonect with Audio". Please see others: Button, and Fader.

Note3: Allison and Place developed the SensorBox. The device accepted six sensor inputs and two audio inputs. The data from each sensor was carried as the amplitude of a sine wave, and mixed back on the two audio inputs. They did not provide its technical detail well, however their approach was quite same as this instructable.

Step 1: The Parts

Most of the components can be found at your local electronics shop (e.g. maplin in UK, RadioShack in USA, Tokyu-Hands in Japan). However you may need to use online electronic components store (e.g. RS in UK, Digi-Key in USA, Marutsu in Japan) for transformer and diaode.

1 Circuit board

2 Transformer / ST-75
The transformer adjusts the voltage. In this time, we use 'ST-75' from Hashimoto-Sansui. However other transformer could be used if its satisfy the specification (e.g. TRIADSP-29). Currently we try to figure out they could be used or not.

4 Germanium Diode / 1K60 (1N60)
The diode allows an electric current to pass in one direction.

3 2-point Power terminal
For audio input, output, and power.

1 3-point Power terminal
For sensor.

2 RCA AudioPlug
One for audio input and another for audio output.

1 Quad Cable
For circuit and connectors. The length depends on how long you want.

1 USB cable
For power.

1 Pair of DC connector
For power.

Step 2: The Tools

These are standard tools for assembling this project. I borrow part of the list from greyhathacker45's great work, thanks!

Soldering Iron



Wire Strippers



Helping Hands

Clipped Cables

Screw Driver

Step 3: Preparation: Power From USB

To obtain power for sensor (the circuit does not need power), you can use 5v (most sensor work with this voltage) from USB. Cut a standard USB cable and solder DC connector to voltage and ground sides (usually red is for voltage, and black is for ground, but you should check the correct line with multimeter).

Step 4: Preparation: Connectors

To have audio input, output, and power, it would be better to use connctors. Before soldering, the plug cover needs to be installed in the cable . The cutting side of the cable needs to be twisted to avoid expanses. After soldering, just attach the cover for the plugs.

Step 5: Breadboard

Before soldering, it would be nice to check the circuit with a breadboard.

Step 6: Dry Fit the Components

Let's layout everything on the board. If you have some trouble, please use our layout. The black dots show where the pins go through the board.

Step 7: Solder Stuff

Now you ready to solder the components on.

Step 8: Quality Control

Make sure that you have no accidental soldering. Multimeter is good for checking!

Step 9: Connect to the Audio Input, Audio Output, and Power

Now you have a working hardware. Audio input and output are connected to separate audio cables. Power is connected to the custom USB cable.

Step 10: Some Software

Open your programming environment (e.g. MaxMSP, Pure Data, Flash, SuperCollider). If it could treat audio input and output, any environment is ok.

In this time, we use MaxMSP.

Assign an audio signal (e.g. 10000Hz sine wave) for audio output.

Set volume calculator for audio input. In this time, we use 'peakamp~' object.

Add a receiver for the calculator. In this time, we use 'multislider' object.

Here is a basic example of MaxMSP patche.

MaxMSP: sensor-001.maxpat

Step 11: Moment of the Connection - 1 (CDS Photocell)

Connect a CDS Photocell to the board. One is connected to power, and the other is connected to signal.

CDS Photocell changes its output voltage by received amounts of light.

Start audio, cover the CDS photocell, and get the connection! You're ready to use a CDS photocell with your projects.

If it does not work, you just need to adjust the volume for audio output.

Step 12: Moment of the Connection - 2 (Distance Sensor: SHARP GP2D12)

Connect a Distance Sensor (SHARP GP2D12) to the board. One is connected to power, one is connected to signal, and the last is connected to ground.

The Distance Sensor changes its output voltage with the distance between the sensor and object.

Start audio, move the distance sensor, and get the connection! You're ready to use a distance sensor with your projects.

If it does not work, you just need to adjust the volume for audio output.

Step 13: Uses? Shaker Percussion

There are many possible uses for a sensor with Audio Input and Output. One of a feasible field is sound instrument. We made a Shaker Percussion with this instructable. It can make use of its precious samping resolution and sampling frequency.

Here is the setup. You will need split you audio output with stereo to dual mono cable. Connect an Accerelometer (Kionix KXM-52) to the board. It's 3-axis but in this time we just use one axis of the accerelometer. One is connected to power, one is connected to signal, and the last is connected to ground. On one channel you connect the board, and on another, you connect a speaker. It would be nice have a mixer between the audio output and the speaker to separately control the volume of the percussion.

In your software, you add a noise generator, and a volume to your basic patch. You also need an adjustment to fit the value from the accerelometer to the volume of the noise generator. Now, you can finely control the noise generator like a shaker percussion!

Here is a MaxMSP patch.

MaxMSP: shaker-002.maxpat

Step 14: Application: AEO

is a sound performance project consisting of three members: Eye (Performance), Taeji Sawai (Sound Design), and Kazuhiro Jo (Instrument Design). We transform the change of acceleration in each axis of accelerometer as the amplitude of audio signal by extending this instructable.

Step 15: Possible Improvements and Modifications

You can use other types of sensors instead, if it can work with 5v and produce analog voltage.

Though the sampling resolution of the movement is 16-bit or more (if you use external audio interfaces), you can use this instructable for controlling precious parameters (e.g frequency of oscillator).

If you need more sensors, you can extend the number with additional boards and external audio interfaces. In this time, you need to use proper plugs for the port of the audio interface.

Be the First to Share


    • Mason Jar Speed Challenge

      Mason Jar Speed Challenge
    • Bikes Challenge

      Bikes Challenge
    • Remix Contest

      Remix Contest

    6 Discussions


    4 years ago

    hi every body i need to learn hoe to connect arduino in pc with labview in other pc by using xbee (


    Hi, I am trying to develop a prototype in which I will utilize iPhone/Android phone's audio jack and by using an APP, I would turn a switch on/off.

    Just wondering if there are any kind of sensors in market which could help me in triggering the switch on and off.

    Appreciate all your help.


    7 years ago on Introduction

    This looks like a great project and I'm looking forward to trying it. You give clear instructions for assembling the circuit but unless I missed it, don't explain how the circuit works. At first glance the diodes look like a standard rectifier circuit arrangement, but the polarity on the diodes is not the same. Can you explain the signal flow through the transformers and diodes? Can you also provide some general specs for the transformers so we can know what to look for for these. Thanks!

    (I just noticed that this is an old project but hopefully someone can answer these questions.)


    11 years ago on Introduction

    cool instructable! Very useful, simple & elegant. It would be nice to see a video of the simple interaction that also included sound. Do you have any of those?


    Reply 11 years ago on Introduction

    hi, thanks for your comment! i just added "Uses? Shaker Percussion" as a (kind of simple :)) example of interaction. hope it works!