Making a capacitive sensor for the Trinket mini 3.3V

Adafruit's tiny microcontroller platform. Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
apllike
 
Posts: 15
Joined: Fri Jul 11, 2014 7:18 pm

Making a capacitive sensor for the Trinket mini 3.3V

Post by apllike »

Hello,

I'm trying to make the Trinket mini 3.3V light up 3 Led sequins in series when a user touches a conductive material connected to the board. When I researched how to acheive it, I found Capacitive Sensor Library (https://github.com/PaulStoffregen/CapacitiveSensor) and this tutorial (http://www.instructables.com/id/Arduino ... 2-Minutes/) for Arduino Uno. I tried this tutorial with the 3 LED sequins and confirmed it works. The code that I used for the testing is here below (provided by KonstantinDimitrov).

#include <CapacitiveSensor.h>

CapacitiveSensor cs_4_8 = CapacitiveSensor(4,8); // 1M resistor between pins 4 & 8, pin 8 is sensor pin, add a wire and or foil

void setup()
{
cs_4_8.set_CS_AutocaL_Millis(0xFFFFFFFF);// turn off autocalibrate on channel 1 - just as an example
Serial.begin(9600);
pinMode(7,OUTPUT);
}

void loop()
{
long sensor1 = cs_4_8.capacitiveSensor(50);

Serial.println(sensor1); // print sensor output
if(sensor1 >= 1000)
{
digitalWrite(7,HIGH);
}
else{
digitalWrite(7,LOW);
}
}

My question is that what kind of resistor should I use to achieve the same thing with Trinket mini 3.3V? 1mohm resistor used with the Arduino Uno in the testing did not work with Trinket mini 3.3V. I changed the sensing value (if(sensor1 >= 1000)) in the code from 1000 to 100 and 5000, I still didn't work. Could you please give me any advice on this?

Locked
Please be positive and constructive with your questions and comments.

Return to “Trinket ATTiny, Trinket M0”