2025-01-09 12:53 AM
i have written a driver code to run 4 wire resistive touch panel. I use only 1 adc and change its adc channel during runtime. Like i set X+ and Y+ as output high by default and X- and Y- set as low by default and set X- and y- pull down to make ADC read 0 when not pressed. Basically, I have few functions that change the configuration such as X+ and X- to output, set Y+ to analog and Y- to input to set Y+ and Y- as an output, set X+ to analog and X- to input. read x voltage in previous case and read y voltage in later case. ADC is only one to switch the configuration during runtime and its resolution is 16 bit with 810.5 cycles sampling time.
ISSUES:
1- gpio output 3.3v and ground but its adc measuring voltage is from (0.7 to 1.15 for x axis) and (0.55 to 2.8 for y axis)
2- if i move the wires then its voltage ranges change.
Is this issue related with the firmware developed for running the 4-wire touch panel or hardware issue?
I have connected decoupling capacitors of 0.33uF across X+ AND X- and Y+ and Y- as well to stablize the 3.3v source from the mcu gpios.
Looking for your precious advice and solution!!!!
2025-01-09 07:41 AM - edited 2025-01-09 07:46 AM
@Embedded_12engr wrote:I have connected decoupling capacitors of 0.33uF across X+ AND X- and Y+ and Y- as well to stablize the 3.3v source from the mcu gpios.
I think this influences the reading. The foil has capacitance and resistance and you cannot read it too fast because of this. The voltage needs to stabilize. Adding additional capacitance will make it worse. Also you are adding capacitance on outputs which will load the pins. Remove the capacitors and try tweaking your sampling rate.
@Embedded_12engr wrote:ISSUES:
1- gpio output 3.3v and ground but its adc measuring voltage is from (0.7 to 1.15 for x axis) and (0.55 to 2.8 for y axis)
2- if i move the wires then its voltage ranges change.
You should not expect full range. You need to calibrate your measurement too.
Your measurement should produce 4 resistance values. One of them is the touch resistance which varies based on how hard you push.