Making Your Own Touchpad With PWM And Rust

The modern touchpads are incredible feats of engineering, with everything from complex signal processing for noise and tremendous economies of scale driving prices low. So [Kevin] decided to see if he could make his own touchpad. Partially out of curiosity of what makes one touchpad better than another, but also because he was curious if he could. Using an STM32 and a custom PCB, he was off to the races in an incredibly cost-effective way.

After writing some quick firmware in Rust, he was reporting the values read by the PWM channels. Using python, he could get a good idea of the raw values that were being written over USB and visualized. So rather than implement filtering in hardware or firmware, he elected to do the filtering and processing on the host computer side in Python. We suspect this gave him much shorter iteration cycles.

If you like the idea of making your own touchpad but perhaps are dreaming a little bigger, why not make a tablecloth-sized touchpad?

9 thoughts on “Making Your Own Touchpad With PWM And Rust

  1. Why does my finger feel burning on my laptop’s touchpad sometimes? It’s not thermally hot, and I don’t feel a shock like static, but there’s something going on there. I think it happens more in winter when my skin is dry.

    I don’t think of these things as using that much power, but I don’t have a good sense of how that power is coupled into the body to actually perform the detection.

    1. Is your laptop grounded? Does the power supply have 3 prongs?

      I remember a time I was in a place with poor electrical grounding and I was pretty sure I was conducting charge from my laptop case/touchpad to ground.

      Try experimenting with battery power or plugged in and sitting on different surfaces.

    2. You probably have an SMPS power adapter without ground pin, so the ground of your laptop is actually floating at half the mains supply voltage (at very low current) through some filter capacitors. You can try measuring with multimeter in AC voltage between the laptop and the outlet ground pin.

      Way to fix it is to ground the laptop somehow. Some laptops (especially Macbooks) come with two plugs, one without ground and a bulkier cable with ground. One option is also to make a ground clip cable out of an old USB cable and use it for grounding.

  2. He was wondering where the lower-frequency noise signal came from. My guess is that it’s the 50/60hz signal your body picks up from the electrical supply wires that are everywhere.

  3. The author wants to measure the peak-to-peak amplitude, and subtract off the DC bias. This could be done digitally by fast sampling and subtracting the minimum. An analog solution would be a low pass filter to generate an average voltage, then using that average voltage to correct the bias on the original signal. Look up DC offset removal with a low pass filter…

Leave a Reply to Francis Esmonde-WhiteCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.