4
\$\begingroup\$

The gist of my problem is that I have a resistive touchscreen and a Raspberry Pi, and I need to make one talk to the other using a single ADC of some kind.

I have worked with an Arduino and I also know the basic concept behind a resistive touchscreen. However, I'm having some problems planning out how to attach it to the raspberry pi and I don't want to commit too much to parts unless I know how I'm going to do it. Basically, I need to put voltage across the x+ and x- leads, while measuring the y+ lead using the ADC, right? But then I have to switch leads and put voltage across the y+ and y- leads, and measure the x+ lead.

On an Arduino it's obvious how to do that, because the analog input pins can also serve as digital outputs. But I have no such luck with the Pi. I can wire up an ADC to the pi but I'm not really sure what ADC will do the job, since it seems to have to provide digital outputs as well. I'm looking at basic ADCs like the MCP3008 right now. Is it possible to control a resistive touchscreen with such a chip, and if so how? If not, what ICs do I need?

Also if you're going to suggest an IC, please stick to ones that can be found in PDIP packages. I know that's REALLY restrictive (a lot of the "touchscreen digitizer ADCs" I've seen are TSSOP/QFN only) but this is a small hobby for me, I'm working on a breadboard, and I don't really have the tools to use other packages.

\$\endgroup\$
4
\$\begingroup\$

Well you do measurement same way as on Arduino. The MCP3008 has 8 channels, so you can easily do 8 measurements. You'd normally connect two channels of the ADC to the X+ and Y+ leads. The connectors of the ADC are in high-impedance input mode, so you can treat them as disconnected as far as power supply is concerned.

Then you also need to connect two GPIO pins of the Raspberry Pi to the X+ and Y+ connectors and connect the X- and Y- connectors to GND pins on the Raspberry Pi.

When you want to do measurement for X axis, you'd set the Y+ pin to float, X+ pin to high and then use the ADC on the Y+ channel. Same way goes when measuring Y axis.

Now about the ADC: Well since ADC is analog to digital converter, it must have digital outputs. All ADCs have digital outputs, that's how the communicate with the rest of the system. The digital output pins are separate from analog input pins, so there won't be any communication problems.

The particular ADC you linked to uses SPI. On Raspberry Pi, you can use hardware SPI port or use GPIO pins for software SPI. Do note that ADC requires SPI clock even when there is no data transfer going on in order to be able to run conversion.

Here are two relatively nice articles with a little bit of info about MCP3008 on Raspberry Pi: MCP3008 with hardware SPI, MCP3008 with software SPI.

\$\endgroup\$
  • \$\begingroup\$ Hmm I was thinking about putting the GPIO outputs and ADC inputs on the same pins. My practical experience with both the ADC and the platform is kind of limited at the moment so I figured there would be some kind of interference going on in there. Anyway I'm glad to hear that works! Thanks for your quick response! \$\endgroup\$ – tummychow Jan 31 '13 at 0:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.