Attiny Noob qiestions for Signal sense - Page 1
Forum section: electronics / general

author: Michaelaudio
author_rank: Regular Contributor
timestamp: May 08, 2023, 07:00:11 am
content: Heya, i wanna make a Auto standby circuit, with an Attiny85 and since i cant programm anything (i will get Help tho) i have a few Basic qiestions.So the main thing i wanna know is, do i have to activate the ADC of the tiny, for the audio signal sensing, or can the tiny just Sense the positive waves only? I want it to Switch a mosfet, when ko audio signal is sensed for 10 minutes, and Switch back on when signal is applied.

author: Psi
author_rank: Super Contributor
timestamp: May 08, 2023, 07:58:21 am
content: You need the ADC if you want to determine a voltage or waveform on a pin of the ATTiny in more detail than just 1 or 0 (voltage, no voltage).So, for audio you would almost always use the ADC since you want to measure the exact voltage of the audio signal in more states than on and off.

author: Michaelaudio
author_rank: Regular Contributor
timestamp: May 08, 2023, 08:22:42 am
content: Well, i only need to knowifthere is an audio signal, wouldnt it be enough then if the tiny just knows if 0 or 1?

author: AndyBeez
author_rank: Frequent Contributor
timestamp: May 08, 2023, 09:56:53 am
content: Not knowing your design constraints, I you can use a (N-Channel) MOSFET as aninput buffer; the input gate voltage is connected to the signal source and the output drain is connected to a digital pin on the Tiny. You then sense if the digital pin is high or low. No ADC required. For noise immunity the mosfet needs a low pass RC filter and (possibly) some voltage clamping diodes. A slightly more complex method is to use an Op-amp instead of the mosfet.

author: Michaelaudio
author_rank: Regular Contributor
timestamp: May 08, 2023, 01:51:28 pm
content: That would be a good solution, but i already have made a Board. the signal gets clamped from the Inputs, via a Filter straight to 2 Attiny Pins. Is the tiny capable of sensing an audio signal straight away? Or is it Just possible with activating the ADC?

author: Faranight
author_rank: Unknown
timestamp: May 08, 2023, 03:36:59 pm
content: By "audio signal" I assume you mean the signal on a line-out wire. I think some of those lines have phantom power enabled, so the voltage mean will not be zero, but some higher value - you could AC-couple them to get a proper signal.You could also use an analog comparator against a pre-set voltage instead of the ADC to sense when there are pulses of certain voltage present on the line. Then send the uC to sleep and use an interrupt routine to wakeup and do some processing?

author: AndyBeez
author_rank: Frequent Contributor
timestamp: May 08, 2023, 04:12:58 pm
content: The ADC uses "Window monitoring mode". This means the the AtoD results are compared to predefined thresholds and an event or other action is acted upon.See section 6 of this PDF:http://ww1.microchip.com/downloads/en/Appnotes/TB3209-Getting-Started-with-ADC-90003209A.pdf+section 10.1 of this PDF :https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-42645-ADC-Configurations-with-Examples_ApplicationNote_AT11481.pdf

author: drvtech
author_rank: Regular Contributor
timestamp: May 08, 2023, 04:25:59 pm
content: It is possible to use just a raw logic input provided that 1) it's protected against overvoltage (both +ve and -ve), 2) your "audio not present" signal is less than VinLo(max) and 3) your "audio present" signal is greater than VinHi(min). You'll have to look up those values in the datasheet for the chip. If you're coming straight in with a line level signal it won't work though, as the signal level will be too small.

author: Michaelaudio
author_rank: Regular Contributor
timestamp: May 10, 2023, 11:36:37 am
content: Yes, im using a Line audio signal. So for 1, 2 and 3 i guess i will have trouble then. VIL (min) is -0,5 but a Line Level would be -1,41 V (min). I wanted my audio present Signal to be around 50mV, but ViH min is 0,7V...So i guess i will have to usw the ADC then, but is it a Problem that my Signal gets -1,41V min? I have a pi Filter before the Signal gets into the tiny tho.So if i can use the ADC, i must be able to Set the comparator to Go high, when my Signal gets over 50mV and only gets Low when the signal is beyond 50mV for over 15mins, right?