Introduction: Basic Touching Control Using Sensors

this is a really fundamental touching detect powered by a sensor and a AtTiny 85 board which i just got from my pal.

hope you enjoy it.

Step 1: To Prepare a Suitable Board and Download Its Pinout

i got a AtTiny 85 board occasionally from my friend, it is very very tiny, as shown in the picture with a red light on. but the pity is that it hasn't got that many pinout, not enough to make a temperature control board.

you could see how its pins work and then go to the next step.

Step 2: Sensor Is Needed to Detect Touching Event

this is a touching sensor, which is also pretty mini. so it matches the size of the AtTiny 85 board well.The light that alarms touching event is the LED on the AtTiny 85.

Step 3: The Code Part

int buttonState = 0;

// the setup routine runs once when you press reset:

void setup() {

// initialize the digital pin as an output.

pinMode(0, INPUT);

pinMode(1, OUTPUT); //LED on Model A OK

}

// the loop routine runs over and over again forever:

void loop() {

int i;

buttonState = digitalRead(0);

// check if the pushbutton is pressed.

// if it is, the buttonState is HIGH:

if (buttonState == HIGH) {

// turn LED on:

digitalWrite(1, HIGH);

}

else {

// turn LED off:

digitalWrite(1, LOW);

}

}

well, this is the code. And almost forget that the function of the sensor is : when touched(touch event detected) ,SIG output a 1, and when the object moves out of its range, output 0,the code above is to connect it with the pin,(PB0).

Step 4: The Result

that's it, a basic touching detect powered by sensor and AtTiny 85 (of course the code), you could see that once the hand is on the sensor, the light is on, and when nothing above, it is off. thanks for watching guys.