HyperPixel Touchscreen Calibration Issue

It’s a calibration issue, but not the sort of calibration you can change yourself.

We looked into it in quite some depth and found some low-level noise being induced on the bottom electrode. This over-saturates it, so that the built-in logic that the touch-controller uses assumes your finger is right at the bottom, rather than part way between two electrodes.

The software on the touch-controller itself can’t be changed or calibrated, but what we can do to fix this is read the raw electrode data and write our own multi-touch driver.

Unfortunately, that’s really hard. But it’s on our to-do list. Hopefully such a driver will also bring with it better multi-touch recognition and perhaps even some low-level gesture support. But first let’s walk before we start running.

Fortunately, the touch screen is already leagues ahead of some of the unusably awful resitive ones out there :D But we believe we can make it… BETTER!

To see all the magic behind your touch-screen, try this (which should scroll all the X and Y electrode values with a little noise suppression applied):

#!/usr/bin/env python
import time
import sys
import smbus

ADDR = 0x5c

bus = smbus.SMBus(3)

def read_byte(address, delay=0):
    return bus.read_byte_data(0x5c,address)

def smbus_read_touch():
    raw_adc = bus.read_i2c_block_data(ADDR, 0x00, 32) + bus.read_i2c_block_data(ADDR, 0x20, 12)
    adc_out = []

    for x in range(0,len(raw_adc),2):
        val = (raw_adc[x] << 8) | raw_adc[x+1]
        val -= 100
        val = max(0,int(val))
        adc_out.append(val)

    touch_x = reversed(adc_out[8:])
    touch_y = adc_out[:8]

    print("y: " + " ".join([str(x).rjust(4,' ') for x in touch_y]) + " | x: " + " ".join([str(x).rjust(4,' ') for x in touch_x]))

def smbus_config_touch():
    bus.write_byte_data(0x5c,0x6e,0b00001110)

if __name__ == "__main__":
    smbus_config_touch()

    while True:
        smbus_read_touch()

        time.sleep(0.001)
2 Likes