Electronic – arduino – Any device with audio jack as UI

arduinoattinyaudiobuttonprototyping

I'm searching for ways to simplify prototypes, specially the requirements to create an II (input Interface) or UI (user interface). No need to drill holes for buttons or create a button array because it's not easy to experiment with this, espescially when you want to change or extend it. Yes, you can use a touchscreen (with or without display) for this but it is more difficult to change or maintain because it depends on the firmware and it needs additional hardware that pushes product costs. So, why don't use existing (obsolete) devices that got it all already to reduce costs but is also environment friendly.

Got a couple of phones lying around with great capabilities though but unusable for advanced tasks (like Nokia's for example) and want to reuse those to be a part of projects. All of them got a touchscreen, a browser that can display (offcourse) HTML and an audio/mic socket. Came up with the idea to create an extendible HTML interface with buttons that produce sounds (frequency instead of measure button resistance) to measure input/selection.

The solution is also very cheap because you can use any existing device that is able to play a soundwave and you only need an audio cable to process commands. You can even use dumb phones to do the 'trick'. Another nice thing is that you can 'record' commands, play a sequence of commands, for example with a MP3 player. Could be very nice.

Also experiment with remote controls, to reuse old remote controls. Problem with these is detection, different brands use another 'frequency' and it requires allot more work to get it working. So an 'App' is easier to develop, an App that produces just soundwaves (like DTMF) – see also: http://onlinetonegenerator.com/dtmf.html

If you can use the microphone, you can develop an bi-directonal i/o system, you can interact with the UI on the cheap. But okay, first things first.

I like to build an audio socket (with help of an Arduino) to measure frequencies. Found this – https://www.arduino.cc/en/Tutorial/SimpleAudioFrequencyMeter – but is very limited in handle frequenties. I really like to see the frequenties are above hearing limits, above 18.000 hz for example so you are able to make it a sort of wireless in the future (speaker -> microphone)? When playing music or other sound it doesn't disturb 'button' detection.

Is it possible to measure high audio frequenties anyway? What is the best way (without or less external components) to do this? Any idea's or links?


UPDATE:

Just found this:
http://www.instructables.com/id/Arduino-Audio-Input/

And:
Have experiment done with this device, a DTMF decoder:
https://nl.aliexpress.com/item/wholesale-1pcs-MT8870-DTMF-Voice-decoding-module-phone-module/32643931980.html
and converted the header into a dual line resistor network, works pretty well but you still need this device to decode the tones/frequenties.

Best Answer

If you want to use the audio jack output of a phone, you can't use frequencies above the hearing limit. Because the phones all contain a DAC followed by a low-pass filter that attenuates everything above 20kHz or so. So the phone output will never be able to produce ultrasounds.

As a consequence, the simplest is to use old-fashioned DTMF, as you suggested yourself. There are a bunch of chips able to do that, for example the Microsemi MT8870. The figure 9 in the datasheet shows a typical configuration that should fit your needs, and you'll see there are very few external components. And this way, the software arduino part does not need to do the actual DTMF decoding, and you get 16 possible output states (if it's not enough, you could use sequences of multiple tones).

By the way, nice idea, overall. Very simple and effective.