Components required:-
1.Arduino Uno:-
2.Touch sensor:-
3. 7-segment LED display:-
Touch sensor
It is a tectonic device which detects the physical touch and generates output in digital form ,means it will generate output 0 when no touch is detected and generates output 1 when touch is detected.
Working of TOUCH SENSOR
The plate of the touch sensor is connected to one terminal of a capacitor and the other terminal of the capacitor is directly connected to an IC which detects movement of charge. When someone touches the plate of Touch sensor, charge start to moves across the capacitor which is detected by IC and thus gives a digital signal of logic 1 on OUTPUT pin.
TOUCH SENSOR PINOUT
GND PIN- connected to GND pin of Arduino.
VCC PIN- connected to VCC pin of Arduino.
SIGNAL PIN – it is an output pin : Connect it to A0 pin of Arduino.
SEVEN SEGMENT DISPLAY LED PIN-OUTS(common cathode)
1. Alphabet 'e'
2. Alphabet 'd'
3.GND
4.Alphabet 'c'
5.decimal point
6.Alphabet 'b'
7.Alphabet 'a'
8.GND
9.Alphabet 'f'
10.Alphabet 'g'
INTERFACING WITH ARDUINO SEVEN SEGMENT LED DISPLAY AND TOUCH SENSOR
1.Connect VCC and GND pin of touch sensor to VCC and GND pin of Arduino.
2.Connect the output pin of touch sensor to 9th pin of Arduino.
3.Now connect the 7-segment LED display in which COM pin of 7 segment is grounded with Arduino through 330 ohm Resistor.
4.Then connect 'a' letter pin out of the 7-segment LED display to 2nd pin of Arduino, similarly connect 'b' pin of the 7-segment display led to 3rd pin of Arduino and repeat the same for other pin outs.
ARDUINO CODE
_____________________________________
#define a 2
#define b 3
#define c 4
#define d 5
#define e 6
#define f 7
#define g 8
int number = 0, pins = 0, touch = 9;
void setup() {
pinMode(touch, INPUT);
for (pins = 2; pins < 9; pins++)
{
pinMode(pins, OUTPUT);
}
}
void loop()
{
if (digitalRead(touch) == HIGH)
{
number = random(1, 7);
for (pins = 2; pins < 9; pins++)
{
digitalWrite(pins, LOW);
}
}
while (digitalRead(touch) != LOW)
{
}
if (number == 1)
{
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
}
else if (number == 2)
{
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(g, HIGH);
}
else if (number == 3)
{
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(g, HIGH);
}
else if (number == 4)
{
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
}
else if (number == 5)
{
digitalWrite(a, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
}
else if (number == 6)
{
digitalWrite(a, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
}
}
__________________________________
To understand this project in more detail, click here or on this image to watch on YouTube.
Comments
Post a Comment