I'm trying to have 3 touch sensitive buttons on an ATtiny48 device using Qtouch library.

The code was generated using the library wizard inside Atmel studio. I've only added a single condition to act when touch is sensed (only a single button is checked in this code).

int main( void )

    DDRD |= (1<<PD0);


        if (GET_SENSOR_STATE(0))
            PORTD |= (1<<PD0);
            PORTD &= ~(1<<PD0);

As for the hardware, I've used 10nF film cap. across the button outputs and the sense pad is connected using a 12k resistor. Please see below: enter image description here

I can see pulses on the sensing pins but nothing else. I'm not even sure how the generated code knows the system clock freq. for correct timer operation.

  • \$\begingroup\$ The init_system() call has most of the set-up code for the timers in use and setting up the system clock. \$\endgroup\$ – Ron Beyer Nov 1 '17 at 3:17
  • \$\begingroup\$ @RonBeyer Do you have any feedback for the hardware side? Layout or part selection? Something that would make the circuit not work? \$\endgroup\$ – user34920 Nov 1 '17 at 18:23
  • 1
    \$\begingroup\$ The hardware side is difficult to determine from pictures, an actual schematic would help significantly. Did you look through some of the Atmel QTouch demo board schematics? I have an Atmel UC3-A3 XPlained kit on my desk with QTouch, but haven't personally played around with that part of it. \$\endgroup\$ – Ron Beyer Nov 1 '17 at 18:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.