I am building a FFT audio-reactive project with an Arduino that I would like to add a line-in input to. I am most likely to be using a ATTiny84 or ATTiny85 as the sampling device, which is running at 3.3 volts with the AREF set to VCC (also 3.3V).

What sort of schematic would I use to ensure that I can read the full range of the audio input while not harming the device? I am aware that the audio signal is likely to vary based on what the input device is, so please try to make any suggestions as flexible as possible with simple passive components. The target source device (not perhaps the only source, but a reasonable average) is an MP3 player with a 3.5 mm audio jack that can power headphones or a reasonable unpowered PC speaker (Sandisk Clip) or a PC headphone-out jack.

(Note: I have only a limited selection of capacitors, so knowing what ones aren't too specific would be helpful. I have a bunch of 0.1uF, and three or four 10uF, but I'm not sure I have enough to make two of these. I also have a number of ceramics of varying values. I have a large assortment of most common resistors, however.)

It may be possible to use the system at 5V levels if I can disable the internal i2c pullups on the ATTiny (how?), but I am communicating with a 3.3V host device, so those MUST be disabled if I am to do this. If you can confirm how to do that (or to disable them again fast enough that it won't be noticed on the line), a 5V system and AREF can be assumed, if that would simplify the design.

Similar designs I am aware of (but that I don't know the voltage ranges for): https://forum.arduino.cc/index.php?topic=476900.0, https://github.com/PaulStoffregen/Audio

For further information, I would ideally like this to be interchangeable with the microphone breakout here in terms of functionality: https://learn.adafruit.com/adafruit-agc-electret-microphone-amplifier-max9814/ (Offset at 1.25V with AC signal. Note that this microphone is thus for 3.3V as well, but I'm fairly sure that the FFT library I use won't care too much about where the resting value is, so a different DC offset is fine if building for 5V.)

  • 1
    \$\begingroup\$ An Arduino ADC does not have the speed to get any kind of usable audio into it without using something external to capture the audio. Also, depending on the number of points used for the FFT the Arduino would not be able to process the data with any kind of speed. \$\endgroup\$
    – vini_i
    Commented May 30, 2019 at 19:07
  • \$\begingroup\$ It's polled every ~20 ms for a 10,000 sp/s reading of 256 measurements. The Atmel chip just gets a set of raw ADC measurements (note that the ADC clock speed is boosted a bit, but not so far it's inaccurate -- gammon.com.au/adc) that are read over fast i2c to the application processor (which does not have an available ADC). I'm not sure how poor of a range that is (up to 5000 hz, I guess?), but it works for most common audio sources (random music selections played over a speaker) that I can get. Of course, that's over the microphone input since I don't have the line-in yet. \$\endgroup\$
    – user222703
    Commented May 30, 2019 at 19:37
  • \$\begingroup\$ This is still a severely unwise choice of processor for this purpose \$\endgroup\$ Commented May 30, 2019 at 20:55
  • \$\begingroup\$ I'm unfortunately aware, but it's also my best option at the moment, sadly. I'm limited by cost and a few other hardware requirements, so it has to be on a coprocessor and must be reasonably affordable. \$\endgroup\$
    – user222703
    Commented May 30, 2019 at 21:04
  • \$\begingroup\$ I designed an audio-reactive matrix switch controller for quadriplegics in '75 as my thesis. It was primitive based on either row/column scanning and stop with blowing into a mic, or selecting 1 of 4 tones and whistle to dial a phone or toggle a light switch. no uC back then or Teensy. Just MC6800 types. \$\endgroup\$ Commented May 30, 2019 at 21:04

1 Answer 1


The mic amp gives out 2Vpp max. Audio outputs will vary between devices, but this does not matter as the devices also have user controllable volume control. The schematics given in the Arduino forum link are OK to start. The AVR can work with 3Vpp signal when powered from 3.3V. The 100k resistors will bias the ADC input to 1.65V or half-supply voltage. With that high resistances, even 100nF cap will provide audio down to 31Hz or so, and it will work with 10uF as well. Only thing you might want to consider is a low pass filter to limit the audio bandwidth to about half of the sampling rate to avoid aliasing.

  • \$\begingroup\$ Could you explain how the aliasing would occur? I'm a novice to this sort of thing, so while I might be able to get this working, I am lacking in some background. \$\endgroup\$
    – user222703
    Commented May 30, 2019 at 21:02
  • \$\begingroup\$ Well, it's beyond the scope of this question and answer could fill a book. But if you sample at a rate of 10kHz, highest frequency that can be recorded is 5kHz. A 6kHz frequency would be recorded as 4kHz frequency. Just draw some sinewaves on a piece of paper and try sampling at different rates to see this. \$\endgroup\$
    – Justme
    Commented May 30, 2019 at 21:06
  • \$\begingroup\$ aliasing means it turns to a freq mixer with distorted intermodulation \$\endgroup\$ Commented May 30, 2019 at 21:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.