Skip to content

Incorporating Sensors

153armstrong edited this page Jun 16, 2017 · 36 revisions

Here we explore ways to use the TRRS/TRS pin of the audio jack to connect sensors to the phone.

LED

Lighting up an LED using the headphone jack is probably one of most easiest tasks. Take the left/right of the TRRS pin and connect it to the shorter end of the LED. Take the ground and connect it to the longer end of the led and you are good to go ! :)(The polarity does not really matter for this since all you can get out of audio jack is just AC).

The potential difference between the two terminals of the led is ~3V (AC). If you want a brighter glowing led, you can use the OTG cable and connect the +5v (DC) of the usb to the led. ( Use adequate resistance value in series with the led in order to prevent any damage to the phone)

Fun:

If you play music through the headphone while the led is still connected, you would be the witness to a scintillating display. The led would 'dance' to the music, since the potential difference is always constantly changing :D

Video Demo :

https://www.youtube.com/watch?v=JjjCv1atYAo ( LED + TRS )
https://www.youtube.com/watch?v=YUGdWVQlV_A ( Controlling the led intensity using volume control )
https://www.youtube.com/watch?v=ovgJ_4j0tjo ( TRRS + Drawdio + IR Sensor )

LDR


It can be taken in via the astable mode of the timer circuit and the resistance variation is converted to frequency variation. In the same way you can measure any other resistance based measurements.

Video demo:

https://www.youtube.com/watch?v=1rIB6d0d2kQ (LDR Watch)
https://www.youtube.com/watch?v=-EW1IOBxxls (LDR Slider)
https://www.youtube.com/watch?v=fCYbdLSlIw8 (LDR + Drawdio )

Resistance

The characteristic of the astable mode of the timer circuit is the variation of the frequency with respect to the resistance. By mapping the resistance values to its corresponding frequency values a database is established that allows the interchangeability of frequency and resistance.

Video Demo:

https://www.youtube.com/watch?v=a69deueq3rg ( Measuring Resistance using headphone jack + drawdio )

Capacitance

It can be measured either using the timer circuit or directly like the condenser mic.

Video Demo :


Analog voltage

This can be given to the control voltage pin of the timer circuit. You can do analog temperature measurement or even analog accelerometer measurement.

Piezo

You can connect the piezo between the mic and ground to use it as a mic. You can attach it to instruments, your table, your vocal cords, just about anything and capture the vibration.

Or take the left,right and ground pins from the TRRS and affix it to two piezos. Now, if you play music the piezo acts like a stereo headphone.

You can use these piezos as a bone conduction earphone as well. The amplitude will have to amplified using an op-amp such as LM324.

Video demo :

https://www.youtube.com/watch?v=FaXbSpDBZsg
https://www.youtube.com/watch?v=-ZlnPVIiqlc (Bone conduction video)

ECG electrodes


Yes you can connect them too between mic and the ground. You might need an additional amplifier like an lm324 OP-AMP.
We were able to graphically plot the heartbeat. The heart beat was surprisingly distinguishable into p-waves,t-waves and the QRS interval.
There are a lot of projects that are currently in progress based on this. We will keep you updated.

Video demo:

https://youtu.be/anCOX0meW8A ( TRRS + ECG electrode )


IR Sensor

Nowadays most smart phones come with an IR blaster inbuilt. But nevertheless if you find yourself in a situation where you are not comfortable with the apparel, you can always make your own IR blaster by plugging the IR led/s with the left/right and the ground of the TRS/TRRS pin.

Now what you can also do is play music on your phone/laptop and that will get relayed on to the IR led. And by using a IR receiver you can capture it and listen to the music being blasted. A form of wireless music listening portal.
This opens up a plethora of applications. For instance, an audible proximity sensor. How cool is that! able to sense the obstacle based on the frequency that you hear.. It would be like a sense indeed..

Video Demo:

https://www.youtube.com/watch?v=_G2n6kHw8qo (IR Blaster + receiver )
https://www.youtube.com/watch?v=nkdH6YyFmIY (IR wireless music (#1) )
https://youtu.be/Y0wzwoucy5w ( IR wireless music (#2) )
( IR audible proximity sensor )

Vibration Motor


Procuring button sized vibration motors were the ultimate challenge. But once that was resolved, the motor was connected between the L/R of the jack and the ground. It helps to have a amplifier to intensify the vibrations.
One could use Audacity to produce square waves of desired frequency in order to control the motors.

Fun:

One of the weirdest but yet satisfying experience with the vibration motor is when you connect the vibration motor through the audio jack without any amplifier. You can hear the music being played through the vibration motor. The motors seems to be dancing to the music being played.
We tried so hard to capture the phenomenon but the sound was too feeble to be picked up. That shouldn't stop you from giving it a shot.

Video Demo:

https://www.youtube.com/watch?v=UN8m3esGtu4 ( Vibration motor control using Audacity )