Touchscreen Lab 3: Capacitive Touchscreen

EECS 16A: Designing Information Devices and Systems I, Spring 2015

Name 1:

Login: ee16a-

Name 2:

Login: ee16a-


  • Complete this lab by filling in all of the required sections, marked with "YOUR CODE HERE" or "YOUR ANSWER HERE".
  • When you finish notify your GSI to get get checked off for this lab. Be ready to answer a few questions to show your understanding of each section.
  • Labs will be graded based on completion for teams of 2 students


The resistive touchscreen you built last week is well-suited for devices using stylus because the screen has to be a little deformed. In this lab, we will build a touchscreen that is most common today that does not require a stylus - the capacitive touchscreen.

Touch Mechanism


The diagram above shows the typical way capacitive touchscreens are implemented. One of the lines are driven to a certain voltage while another line parallel to it is grounded. When a finger (which is also grounded) comes near the lines, it takes away some of the electric field between the lines, thus reducing the capacitance between the lines.

Today we will be implementing a system that is similar to this, but instead of putting the lines next to each other we will stack them up at a particular point and measure the capacitance there. Since we stack the lines up, bringing your finger near the lines will not change the capacitance between the lines. Instead, we add another capacitance between the top line and your finger (ground), resulting in two capacitors in parallel. As we have learned, parallel capacitances add up, so we can measure this increase in capacitance.

Although we can build a multi-touch touchscreen, we will only build a single-touch touchpad today because of the complexity of the sensing circuit. We will later see how to extend your touchpad to a screen.

Task 1: The Touchpad


  • Microscope glass slide
  • Copper strips
  • Scotch tape
  • Wires

Let's first build a capacitive touchpad from copper strips and glass. We also need a material to separate the two copper strips; the dielectric material we will be using is... Scotch tape! Build the first layer like the image below, making sure that all of the copper strip is covered with tape except the regions near the edge of the glass plate. Then add the second layer, again making sure that almost all of the surface of the copper strip is covered with tape except near the edges of the glass plate. Then tape in copper wires in the exposed copper area as shown below.

Use the multimeter to measure the capacitance of the touchpad. How does it change when you touch it?


Task 2a: Understanding Charge-sharing

Since capacitors store charge based on the capacitance ($Q=CV$) and touching the pad changes its capacitance, all we need to do is measure how much charge it contains. After we disconnect the voltage source, the charge is retained in the equivalent capacitor. If we let some of the charge to flow to another capacitor $C_{ref}$, we create yet another pair of parallel capacitors, increasing the total capacitance. However, the charge stays constant since we did not let any charge flow in or out, so the voltage across the total capacitance must change. For this lab we will be controlling the charging and discharging of the capacitors with a series of switches. The process is outlined below:

1. Make sure both capacitors are discharged.

We begin by connecting the Clean switch to GND to make sure both capacitors are completely discharged.

2. Disconnect the short to GND used for discharging.

Now that the capacitors are completely discharged, we can remove the connection to ground.

3. Charge the $C_{touchscreen}$ capacitor to 5V.

Next we connect the capacitor to a voltage source and charge it to 5V.

4. Share charge between $C_{touchscreen}$ and $C_{ref}$. Measure the voltage change to determine if the screen was touched.

How much charge is on $C_{touchscreen}$ in step 4? When the switch is closed after $C_{touchscreen}$ is charged, how much total charge $Q$ is available to the system?


Assuming the steps above are performed in order, calculate the output voltage (connected to the op amp) at the end of step 4 for $C_{touchscreen} = 22pF$.


As explained above we can model a touch as placing an additional capacitor $C_{finger}$ also connected to ground, in parallel with $C_{touchscreen}$. Calculate the output voltage (connected to the op amp) at the end of step 4 for $C_{touchscreen} = C_{finger} = 22pF$. How do you expect the output voltage to change when you touch the screen?


Task 2b: Automatic Switching


  • Touchpad
  • Breadboard
  • 22pF capacitor
  • 1 CD4053BM switch
  • Power supply (Agilent E3631A)
  • Wires
  • Oscilloscope
  • Arduino

The capacitors in this circuit will discharge within a few milliseconds, therefore we need to automate the switching process for the touchscreen to work. In order to change the switches rapidly we will use the CD4053BM integrated circuit (IC). This chip contains 3 voltage controlled switches. The CD4053BM integrated circuit (IC) is usually used as a multiplexer, but can also be treated as a three-terminal switch controlled by a fourth terminal. We can use the Arduino to rapidly change this control voltage to turn the switch on and off.

When the control is a high voltage (near 5V), the Y terminal is shorted (connected)to the output and X is left disconnected. When the control voltage is low (near 0V), X is connected to the output and Y is left disconnected. Since we always have a conduction path (the OUT pin is always connected to something), we can also view this switch as a two-state switch:

The CD4053 IC contains three of these voltage controlled switches in a packaging, but we will only need two of them for the full touchscreen circuit as shown above. Below is a table of how the pins of the chip are related to the switches.

Additional details:

On top of these, pin 6 is the inhibit signal, which should always be grounded for the circuit; pins 7 and 8 are the negative power supply pins, which should also be grounded in this circuit; and pin 16 is the positive power supply pin, which should be connected to 5V.


If you want to read more about this IC, here is the datasheet.

1. Connect 5V from the +25V output of the power supply to VDD (pin 16) and GND to INH (pin 6), VSS (pin 7), and VEE (pin 8). Set the current limits on the power supply to 100mA.
Make sure the IC is oriented correctly. The small indentation on one side or corner of the chip marks the top. The top left pin is always numbered 1, and the numbers increase counterclockwise around the chip.

2. Next build the circuit shown below using any of the 3 switches on the CD4053BM chip. Note that $C_{touchscreen}$ refers to the touchpad from Task 1.

3. Connect pin 12 of the Arduino to the control pin of the switch you chose, and connect one of the Arduino's ground pins to the the ground of the power supply. Upload the switch_test.ino program to the Arduino.

4. Use the oscilloscope to measure the voltage across $C_{2}$ and zoom in to see the capacitor discharging. Does a touch give you the same behavior you solved for in Task 2a?.

Task 2c: Finishing the Circuit


  • Touchpad
  • Breadboard
  • 22pF capacitor
  • 1 CD4053BM switch
  • Power supply (Agilent E3631A)
  • Wires
  • 1 LMC6482 operational amplifier

The output of the charge sharing circuit should be connected to an op amp. The LMC6482 contains two separate op amps as well as pins for power and ground:

Additional details:

Build the remainder of the circuit shown in Task 2a but do not turn it on yet. Use the +6V supply for the tunable reference voltage V1. Do not forget to set the current limits on the power supply to around 100mA.

Leakage current and parasitic capacitances

All we are building are good to work in theory. However, due to imperfect components and breadboard, we get additional resistances and capacitances that changes the measurements we need. Luckily, our target is just to determine the voltage difference between an untouched and a touched pad. As we have discussed before, the reference voltage $V_{ref}$ needs to be tuned to the threshold voltage between the touched and untouched voltage. The voltage at the positive input terminal of the op-amp, however is not a constant voltage. Due to internal resistance and capacitances, it actually decays exponentially. To remedy this, we let a couple milliseconds pass so the output readings are cleaner. This will be reflected in the Arduino control code.

Task 3: Arduino Control and Sensing


  • Circuit
  • Arduino Uno
  • Wires

We need to control the switches and read the output at A0 (in the schematic) using the Arduino connected to your PC. To do this, we have provided you with a skeleton code for the Arduino control, single_touch.ino. Go back to the list of steps to cycle through and adapt it to the circuit you have, controlling the switch connected to 5V from pin 12 (drive) and the switch connected to GND from pin 11 (clean). The skeleton code will guide you through the cycle. To turn an output high (5V) or low (0V), use the digitalWrite function.

Once you have checked the code, compile it and upload it to the Arduino, then connect the Arduino’s ground to your circuit ground. Also connect P12, P11 and A0 to the corresponding places in the breadboard. Run the Serial Monitor from Tools > Serial Monitor to see the readings from A0. Adjust $V_{ref}$ so that the output reading changes from below 2.5V when the touchpad is untouched and above 2.5V when the touchpad is touched. This may require precise tuning of $V_{ref}$ down to tens of millivolts.

To make the readings even more robust, we read multiple times and average the results before outputting any result; this ensures that we are not outputting results based on bad data. You can read through the code provided to see how it works. Note that the onboard LED is also set to turn on when a touch is detected.

Show the final circuit and output to your GSI.

To Infinity and Beyond

Congratulations on your single-cell capacitive touchpad! As you know, a real capacitive touchscreen requires a lot more than a touch sensor. We can build replicate the circuit and build arrays of these capacitances and measure the capacitance at each point using similar techniques. To do this, we need to activate the cells one by one by using an arbiter, then sense the capacitances at each point one-by-one. We can employ algorithms that interpolate signals for positions between cells to predict whether any point in the touchpad is being touched.

The charge-sharing circuit we built is a simple sensing circuit, but in commercial touchscreens other circuits and sensing methods are used to measure the capacitance. A common circuit used involves oscillations, which you will study when you learn about the behavior of capacitors when they interact with resistors.