How to Connect a Sensor With Audio Input and Output

by jojporg in Circuits > Sensors

19712 Views, 43 Favorites, 0 Comments

How to Connect a Sensor With Audio Input and Output

SANY4685.JPG
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.

The Parts

parts.jpg
SANY4685.JPG
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.

The Tools

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

Soldering Iron

Solder

Multimeter

Wire Strippers

Nippers

Solder-sucker

Helping Hands

Clipped Cables

Screw Driver

Preparation: Power From USB

SANY4687.JPG
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).

Preparation: Connectors

SANY4707.JPG
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.

Breadboard

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

Dry Fit the Components

SANY4689.JPG
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.

Solder Stuff

SANY4693.JPG
Now you ready to solder the components on.

Quality Control

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

Connect to the Audio Input, Audio Output, and Power

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

Some Software

������������ 1.png
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

Downloads

Moment of the Connection - 1 (CDS Photocell)

SANY4698.JPG
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.


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

SANY4700.JPG
SANY4705.JPG
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.


Uses? Shaker Percussion

������������ 2.png
������������ 3.png
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


Downloads

Application: AEO

aeo.jpg
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.





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.