Capacitive touch buttons with Atmel’s AT42QT1070 chip

 pin configuration

Comms_mode

Standalone_mode

Since in my project microcontroller is used, I chose to control chip via I2C, Comms mode. In this mode the schematics very simple, only few additional parts is required. The control of this Atmel chip also is very simple. So lets look closer at Comms mode schematics.
Four control lines can be used: SCL, SDA, CHANGE and RESET. SCL and SDA is standard I2C protocol control lines. Chip works in I2C slave mode, up to 400kHz. Chip address is 0x1B. CHANGE pin becomes active (goes from high to low), if any button is pressed. So this signal can be used to generate microcontroller’s interrupt. But also key statuses can be read from internal chip registers. RESET pin is input pin, chip will go to reset state if this pin will be connected to ground (active low). This pin also can be not used, because user can reset chip via internal registers. So, in many cases only two control pins is enough: SDA and SCL.

So thats how shematics can look like:

four channel timer TIMER

You see that schematics is really simple and it is worth to discard these mechanical buttons. And one more thing: mechanical buttons has effect, called “bouncing”. This is bad thing which must be “debounced”. This can be done with the help of microcontroller’s software or additional hardware parts. With the schematics above the “debouncing” is done in the U1 chip, so you don’t need to think about it anymore. But there is and one drawback: user needs feedback when button is activated. You can feel with your finger mechanical button movement when it is pressed. But touchbuttons do not have any movement, so the touch can be indicated with light or sound. For example touch can be indicated with piezo buzzer which beeps shortly after button touch. Or LED for short time can be turned on an off indicating the touch.

AT42QT1070 internal registers:

registers1-bmp
registers2-bmp
 

The most registers for users are Detection status (address 2), Key status register (3), NTHR key0-key6 (32-38) and Reset (57).

Touch bit in Detection status register is set if any key is pressed. Bits 0 to 6 in Key status register indicate which keys are in detection, if any. Touched keys report as 1, untouched or disabled keys report as 0. In the NTHR register you can adjust keys sensitivity, default value or each key is 20. If you need to reset device, you can write to Reset register value, bigger than 0, and chip will reset.

touch_buttons-rear

touch_buttons_front

And at the end some recommendations of the manufacturer:

Atmel recommends not to use ground plane in the QT1047 chip and touchbuttons area. Ground plane may reduce the sensitivity of the buttons, and maybe even buttons with groundplane will not fuction. If there is a big noise near the chip, a hatched groundplane can be used.

At the beginning of my project for unknown reasons after powering-up the AT42QT1070 my microcontroller program sometimes stucked for unknown reasons. After several hours of searching i found that program was always stucking when it tried to read buttons statuses from register 3. Then i carefully read the datasheet one more time and found that “Power-up delay to operate/calibration time” in the timing specifications table is <230ms (typical value). So i deicided to insert 1 second pause after power-up and only then to read buttons statuses. After this problem magically dissapeared and QT1070 started to work properly. I did not tried smaller pauses because 1 second pause did not make any difficulties for my program. In this case reset right after power-up helps, after reset the chip is working properly.

Best option is the all parts of the scheme and touch-sensitive areas to do on the same printed circuit board. After this PCB can be glued to the front panel of your device. Panel can be made from many materials except metal or coated with paint which have metal particles. Here is a short video about touch buttons:

Datasheet and application notes of the AT42QT1070 you can download here.

2 Comments

  1. Xavier

    Hi!, I can’t see any ring buffer as the datasheet recomends. Did you experience any trouble because of this? I mean, are you readings stable?

    Reply
    1. automateaqua (Post author)

      Are you are talking about ring which must protect IC from external electromagnetic pulses? If so, i did not use it. I have noticed that powerfull electromagnetic pulses (especially from the motors or bigger solenoid) easily creates false input signals – the chip thinks that button touch occured despite of that i did not touch the copper area. There was my first testing version of the board. Using the board in the electromangetically noise environment touchbuttons board must be improved: some groundplane must be added or all board must be separated with the grounded metal plate.

      Reply

Leave a Comment

Your email address will not be published. Required fields are marked *