 This is a capacitive touch sensor, and this is its big brother, the capacitive touch matrix, which we're going to be doing in the next video. So we don't need that for today. The capacitive touch sensor has the ability to detect a finger when it's touch again. It's used for the same idea as a button or a switch, but works completely differently. In today's video, we're going to go over exactly how it works, how to wire it up to your favorite microcontroller, and how to write some super simple code to make it work and integrate it into your own projects. If you want to support this content and enjoy these type of sensor videos, all you got to do is subscribe to the channel so you get notified when I put out a new video. Let's get started. A capacitive touch sensor works a bit like an invisible magic button. Imagine you have a balloon, and when you put your hand over the balloon, even though you're not touching it, you start to feel a little bit of tingling in your fingers. That's static electricity. Your fingers actually attract electricity because they're able to store an electrical charge. A capacitive touch sensor works very similarly. A capacitive touch sensor works similar to this balloon example that I'm giving it. Inside the sensor, there's a material that can store a tiny bit of electrical charge, just like the balloon. Normally, this charge stays the same and consistent even, but when you bring your finger onto it or something that can hold an electrical charge, the electrical charge on that sensor drops drastically because something else is storing that electricity, and that's how it senses when something is touching it like a finger. So the sensor notices that change, and then whatever it's connected to, it lets it know, and that's how you sense it, and that's how you use it for your project. This is similar technology to what we have in smartphones and any type of smart watch, smart TV that's touch. Even the screens in the cars that are touch screen, they use capacitive technology. One thing I would love to do in a future video is get one of those big capacitive touch glass screens, but there's no actual like LCD on the back. It's just a piece of glass that you could detect where your finger is, and then we put that over something that isn't touch screen, like let's say a microwave or whatever it is. For the demo, all you're going to need is your capacitive touch sensor, some basic cables, and whatever microcontroller you want to use. For the capacitive touch sensor, it's really simple. It has three cables, one for ground, one for five volts or three volts, and one as a signal cable that goes to your board. We're going to be plugging in our power cable into five volts on the Arduino. We're going to be plugging in our ground into ground, and then our signal into digital port seven. Then we're just going to plug the Arduino into the computer, and we can get started with the code. For the code, the first thing we're going to do is go to the top and declare the variable where we plugged in our sensor, which is digital port seven. Then in the setup, we're going to declare serial dot begin so we can read things in the serial monitor. And then we're going to do two different things, which is pin mode, touch pin input, and LED built-in output. Our touch pin input is the pin that we're using as a signal cable. We're saying it's an input cable because we're going to be receiving information from the capacitor sensor, or sorry, capacitive touch sensor. Then LED built-in output is specific for Arduino. If you don't have an Arduino, you don't have to write this line. All it's going to do is let you use the built-in LED on the Arduino, which sits right up here. And we're declaring it as an output, because we're going to be turning it on and turning it off, depending on if our finger is on the switch or not. Then in our loop, we're going to do two different things. We're going to declare our state, which is going to be digital read touch pin. So if the pin is being touched, it's going to say one. If it's not being touched, it's going to say zero. One being high and zero being low. And then here, we're going to declare our LED to state, which is just saying that if the button is being clicked and it's saying high, put the LED to high, which is on. Then if you don't have an Arduino, you could just do this line right here, which is serial dot print line state, just so you could see if the sensor is reading information and what kind of information it's giving you. So we're going to select our board. We're going to upload that to the board. And then I'm going to open up the serial monitor. You can see it's printing super fast. I'm just going to put a delay of half a second on there. Just to slow it down a little bit. Going to go in the serial monitor one more time. We're going to clear it out. And I want to bring the Arduino close to the camera so you could see the sensor. Now I'm just going to put my finger super lightly over it. And you can see the LED is turning on the Arduino and turning off. The reason it seems delayed is because of that half second delay. Otherwise it would be instant. And you could see the serial monitor on the left is showing zero or one depending if my finger is on it or not. One with my finger on it, zero with my finger off of it. Now if I put my finger super lightly over but I don't touch it, the LED will flicker on and off. And one cool thing is if you flip it all around the back, you could see the metal side of this material, which is also very sensitive to your finger touch. See the LED turning on and off. And this is with the back of the sensor. So one thing I like doing since it has a bunch of electronics sticking out and I don't really want my project having electronics sticking out. I'll flip it back and then put it flush against whatever I'm 3D printing around it. And then I just have this metal piece that I could put my finger on and off of. In the next video, we're going to be going over this capacitive touch matrix, which is the same thing, but instead of one, it uses 16. And I want to show you exactly how this works because this ties into the technology that we use today for smartphones and any touchscreen devices. If you want to support these videos out, all you got to do is subscribe to the channel and give the video a like to let YouTube know that you enjoy the stuff you're watching so they recommend more of it. If there's anything you want to see in future videos, let me know in the comments. If you have any questions about this project, anything you want to help with, either go to the comments or join the Discord where we have people that can help you out with your electronics problems. We'll be doing this one in the next video, so I guess I'll see you there.