Capacitor Touch switch with QTouch

avrcapacitivepower electronicstouchscreen

I have been working on QTouch Implementation for ATmega32 Micro controller.
I have taken reference from here. I'm facing issue with grounding Problem.
For debugging process I am displaying the result of ADC channel on UART terminal. I have used 125Khz ADC Prescalper and AVCC as REF voltage with 0.1uf cap on AREF pin.

When my ATmega16 is connected to My laptop with AVR USB programer and USB-TTL converter, Result varies from 400-550 on terminal without touch. when touch is perform it goes upto 580-620. I have code to blink LED when it touched (i.e. ADC value goes upto 580+). It blinks when touched an stay off when no touch.

but when I give external supply voltage from an adapter and remove USB programmer and TTL-USB converter, it starts blinking without touch.

When I have measured voltage of VCC in first case (i.e. Without adapter), it is ~4.56V. When I connect external Adapter VCC is ~4.95V.

when I have connected external adapter with the ATmega16 (~4.95 VCC), and USB-TTL for debugging(USB AVR Programmer disconnected). when there is no touch ,ADC Valu goes up to 528. when It touched , ADC value goes to 530+.

I have again code to blink LED when it touched(i.e. ADC value goes up to 531+). it works but when I remove USB-TTL from ATmega16, LED blinks without touching capacitor sensor.

It is grounding issue clearly. but how to get it solved? I have put 1M Rs sense resistor between ATmega ADC0 and Capsense.
here is a schematic of circuit I used.
enter image description here
here 0.1uf on power rail is not shown but it is exists on board.
I have a development board with take 12V and used LM7805 for 5V regulator.
I have used 5V 3A supply directly on VCC-GND of Atmega16, though same result.
I am not getting where the problem is?
I am seeking a direction please throw light on my path.

Wait for Positive response. 🙂
tanks in advance

Best Answer

It's possibly a dirty noisy power supply. If the same happens with a different supply, it could be that the analog circuit of your at mega is simply finicky. Atmel recommends a LC circuit to decouple the Analog side from the DC side. You need an inductor and capacitor filter, in addition to the typical decoupling cap on the Digital VCC. An extra filter cap 1000 uF on the power input might help too.