vibration sensor for arduino! great for detecting movement, this sensor had a lot of uses. today we will hook it up to the uno, and play around with it, running some arduino code to detect a knock. enjoy! and dont forget to subscribe!
Like and Subscribe!
Affiliate links for arduino sensors! Large Arduino Kit (Recommended) includes various sensors, a couple breadboards, loose components, pcb board, jumper wires, soldering iron AND more: https://www.banggood.com/custlink/mmKhdf9Si8
Want to send me something? Technivorous 902 n Hughes Blunt Sd 57522
All right folks, welcome to Arduino for Beginners. This is Arduino 101.
Let's take a look at this motion detecting sensor, also known as a knock sensor. Now if you look at
this, it is a clear plastic cube, well not a cube, excuse me, it's a box with a long spring inside it
and a couple of wires. So you can see I have mine wired up to this led here
and when it bangs on something or that little spring is vibrated,
it sends a signal and activates the light. So this light's wired up the same way as the last
time through that 220 ohm resistor, I just switched it out with the green one.
The code we're looking at is two integers, it's a vibe pin and led pin. So the vibe pin
is your signal that goes into number seven and the led pin is your output to whatever you're
trying to power with that knock. So in this case we've got it going out to our resistor,
then through our led and then returning to ground and the negative and positive
are to ground and five volt respectively. So pretty self-explanatory. We're going to go into
setup. We're going to set up two pin modes for both of the pins that we just entered and the
vibration pin is going to be input, the led pin is again going to be output. So very similar to
last time as is the loop. We're going to get a value, we're going to set it down here this time
and we're going to instantiate it here I mean and then we're going to set it right here to
read the pin and if that value is low, we are going to turn the digital right on to
led pin high and then set a delay of half a second. If we don't set that delay,
it will immediately go back to being off and it'll just flash for a second. So you can change
that delay. It looks pretty good between a half a second and a second which is 500 to 1000 as far
as letting you know that the device is working. You can see it light up pretty well there. Let
me see if I can fix the lighting a little bit, make it a little easier to see here. There we go
and there it is. It's also lighting up the led that I'm using the output on the
the UNO board itself. So then we are going to go to else and digital right low. Pretty
self-explanatory stuff. There are tons of applications you can use this guy for
other than just detecting motion or detecting knocking but this is about as far as we're
going to go into this sensor. It's pretty simple and pretty self-explanatory. I mean
you could place them if you wanted to know if somebody was entering an area and have it set
off a light in another area just kind of as an alarm system or something like that among several
other possible applications. So that's going to be it for this one guys. Stay tuned for the next
sensor. We will be right back. Well that's it guys. That's going to wrap up this video. If you've
noticed a shirt, the merch is available. Go ahead and check out the Teespring merch link down below.
It won't be available on a channel store until I reach 10,000 subscribers and so far I am just
about to hit 5,000. So it'll be a little while, a couple more months before you see this on the
actual channel but they are available now. I have a couple other designs. Feel free to pop over there
and check them out and know that any purchase through the Teespring site definitely helps to
promote our site here and increase the channel's ability to make videos in the future. So we
appreciate all your support. Don't forget to check out the Teespring link. Check out our Patreon
link. Leave a like on this video and hit that subscribe button because we have a lot more
coming at you in the coming days.