Name 1:
Login: ee16a-
Name 2:
Login: ee16a-
"YOUR CODE HERE"
or "YOUR COMMENTS HERE"
.In the next two labs you will be introduced to two fundamental properties of circuits, resistance and capacitance, by actually building the touchscreens introduced in lecture! This week we will use the soldering skills we learned in Week 1 to make a touchscreen entirely out of resistors and write Arduino code to test the touchscreen. Next week we will switch gears and build a capacitive touch sensor, which will give us a better understanding of how modern touchscreens such as those found in cellphones, tablets, gaming devices, etc. are implemented.
The resistor is one of the most basic circuit elements, and you will become very familiar with them during this lab. Resistance ($R$) is determined by the following property:
$$R=\frac{\ell}{σA} = \frac{ρ\ell}{A}$$
The values of σ and ρ correspond to the conductivity and resistivity of the material respectively. The current-voltage relationship of a resistor is governed by Ohm's law:
$$v = iR$$
According to Ohm’s Law, the current flowing through a resistor is directly proportional to the voltage across it.
As explained in Lecture 11, the basic principle behind a touchscreen involves sensing changes in resistance corresponding to a user's touch input as shown below. Resistive touchscreens are comprised of two plates,and applying pressure causes the plate to touch and create a short circuit.
The change in resistance is converted to a change in voltage using the voltage divider circuit introduced in lecture:
The diagram above shows that we must apply a voltage across one set of resistors, while the other is used to read the voltage at a particular point. By applying KCL or KVL to solve the above circuit, we can determine the following relationships for touching a point along one axis of the circuit, where the "height" and width" correspond to the number of resistors along an axis:
As shown above we can only apply voltage across one axis (drive one axis) at a time, while sensing across the other. It is also important to note that this method requires one wire to be disconnected. In this lab we will begin by manually testing voltages using the multimeter, and afterwards use the Arduino to rapidly switch the drive and sense axes to get "real time" measurements of position along the X and Y axes. The figures below show a schematic of the actual circuit we will assemble to create a 3x3 resistive touchscreen.
We will be building a basic 3x3 touchscreen, providing 9 total contact points. The resistive touchscreens have two layers or ‘meshes’ of resistors, which we will label Top and Bottom accordingly. The Top mesh (clear plastic) has been provided for you; you will begin by assembling the bottom mesh, and then complete the touchscreen by attaching the top mesh and foam separators.
Using the Top mesh as a guide (ignore the foam blocks for now), solder the 1K$\Omega$ resistors on the blank PCB provided. This may take anywhere between 20 minutes and 1 hour, just be patient and do not rush! Your goal is to produce a PCB like the one below:
Helpful tips:
Hot glue
Once you have finished soldering the Bottom mesh, the next step is to attach it to the top mesh and add a flexible separator between the two. The pre-built top mesh has the same pattern as the bottom:
Position the Bottom mesh with its lead wires going East-West.
The resulting sandwich should resemble a ‘+’ symbol:
It’s time to test our touchscreen! First, to stay organized it is important that we define an origin to refer to. Orient your screen so that the solder-joint labeled A1 on the PCB is at the top-left; this will be our origin.
Given this orientation and origin, in order to sense a horizontal position which mesh (top / bottom) will be driven with a voltage source, and which mesh will we measure the voltage across?
For sensing a vertical position, which mesh (top / bottom) will be driven with a voltage source, and which mesh will we measure the voltage across?
Complete the table below with the voltages measured at each joint.
Joint | Top Mesh (V) | Bottom Mesh (V) |
A1 | ||
A2 | ||
A3 | ||
A4 | ||
A5 | ||
A6 | ||
A7 | ||
A8 | ||
A9 |
Ultimately, we want to be able to determine the precise location of our finger on the screen. While reading voltages off of the multimeter is good for testing purposes, it is slow and not practical for actual usage. We will now use the Arduino to automate this process.
Writing code for the Arduino requires using a different programming language more similar to C or C++ than Python. The major conceptual differences are outlined below:
int
for integers, float
for floating point values, etc).;
.{
) and the end of a function is marked by a close brace (}
). This cursory explanation should be all you need to complete this lab, more detailed language documentation can be found on the Arduino website.
Begin by connecting your Arduino to the computer via USB and connecting the touchscreen wires to the following ports on the Arduino:
Touchscreen Wire | Arduino Pin |
W (P1) | A0 |
E (P2) | A1 |
N | A2 |
S | A3 |
Next, load the file EE16A_Touchscreen_Week2.ino
in the Arduino IDE. Take a few minutes to walk through the code with your partner(s). Try to understand the purpose of each function. You can ignore the implementation of set_vdrive().
Fill in the two missing lines (39 & 40) marked YOUR CODE HERE
to convert voltage values x_voltage
and y_voltage
to the corresponding X or Y positions.
Test your code by making sure that the Arduino prints the correct location (A1-9) when you press that location on your touchscreen.
COM1
)n
at the prompt to keep the default value of v_drive
.Once you get your code working with the default v_drive, try different values for v_drive.
Congratulations, you have built a functioning touchscreen!