DIY Sensor Touchpad
Sensors are fascinating; they are the eyes, ears, nose, and sense of touch of our computers and microcontrollers. But a homemade sensor—now that’s something!
As a teenager, I built myself an electronic “piano” with a keyboard made of pencil graphite that detects the different resistances. Basically, it was a homemade potentiometer attached to a sound generator.
This touchpad itself is very cheap: 0.15€/sensor (1g).
Maybe not very precisely, but let's give it a try.
Supplies
- 3D print conductive Filament (PLA) ~30€/200g
- Inkjet Film (Printable film for overhead projectors, heat resistant)
- XIAO ESP32-C6 (or any other compatible Arduino microcontroller)
- OLED display 128 x 64
- wires and soldering iron
Layout of the Conductive Traces
There are several ways to create a sensor grid. Basically, you need two wires placed side by side that are short-circuited at specific points. You can use multiple layers and different materials. But I want to try using a grid printed entirely in 3D. These sensors work on the same principle, namely by establishing an electrical connection between two conductors through skin contact.
All we need to do now is determine exactly where on the array this contact occurs, so that we can assign coordinates.
Design 1 is what you see on the following images. A few bridges of filament must be installed manually. Design 2 is only 3D printed but with longer wires.
Width & Height of the Conductor Traces
I’ve set the track width to 1mm so that the grid doesn’t get too big. Don’t forget the spacing!
After conducting several tests, I have found that the ideal layer thickness is 0.4 mm. 0.2 mm could also work, but the resistance of the tracks is higher.
Print Settings
I had to carry out a few tests here as well. The filament obviously needs to be printed on a base. I tried using wood. It’s sturdy, but unfortunately too porous and ‘absorbs’ some of the filament, which makes the structure uneven.
Heat-resistant printing film for overhead projectors has proved useful. The substrate is reasonably sturdy yet flexible at the same time. The film is attached to the printing plate using adhesive tape. You’ll have to try it out for yourself to see whether you need to add an offset to the Z-coordinate. (I added 0.1 mm)
Attention: Set the plate temperature down to warm (30°C in my case)
Temperature: 250°C
Plate: 30°C
Speed: 25 mm/s
Offset (z): 0.1 mm (for the film)
Measuring the Resistances
Note down the resistance values in the top-left and bottom-right corners. Enter these values into the program under resMin and resMax.
The microcontroller measures the resistance and maps the value to a coordinate on the sensor, which it then displays on the OLED display.
Interpretation of the Data As Specific Coordinates
The difference between the starting and ending values is divided (here) into 7 lines, and each measured value can then be easily assigned to a line (y-value).
Within a line, the measured value is assigned an x-value ranging from 1 to 127 (display width).
Using the map command, we map each resistance value in a row to a column value
I have set the point on the display so that it remains visible until a new coordinate is entered. Of course, the point can also be deleted if there is ‘no signal’
The software is measuring the resistance every 10ms and is assigning the data to a specific coordinate. We have .... lines in our grid, starting from the left upper corner like our OLED display does.
Complete Software & Transfer of Coordinates to the Display