this is hands down one of my favorite sensors, and it can be used to levitate magnets. in this episode we will merely be showing you the code to detect a magnetic field with the hall sensor in arduino!
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
AI Generated·May contain errors
Alright folks, welcome to Arduino for Beginners. This is Arduino 101.
Alright, today we are looking at HW492. Now this is a Hall Sensor. Now a Hall Sensor is a sensor
that picks up a magnetic field. So when a magnetic field enters the sensor's perception area,
it will light up this little LED light right here. So I have some code already typed up on
the screen here. You can see it. I know I'm covering some of the comments, but you don't
really need those. Go ahead and get that code copied over to Arduino. Pause the video and just
type it all up and then come right back. What we're going to do is we're going to use this sensor
and we're going to be using three jumper wires to wire this in. And actually it only needs two,
I think. So we're going to have two female to male because they're going to go on these plugs.
No, it is three. It is three. Okay, so three female to male jumper wires, the Hall Sensor
itself, your Arduino unit, and this code right here. So let me get things wired up.
And I have mine unplugged so it shouldn't be too difficult. I can see immediately
that I'm using the LED pin and the sensor pin. So that means that the other pin is going to
be my ground. That is the negative pin. We'll go ahead and hook that into a ground.
And then we will grab, in my code here, I'm using 13 for the LED, which should be positive,
and then three for the sensor. So I don't know why those equal signs on that look,
they are equal. That is not a minus. That is an equal sign. It looks funky on my recording here,
but it does the same thing down here. So make sure you put an equal sign in there.
Then we're going to hook the positive, which would be the LED to 13, which is on our digital side.
And we'll go ahead and hook the sensor into number three. Now I do have a sketch from the
previous video on here, so it might do something funky with my sensor, but it shouldn't really do
anything. Let's get this laid out flat here, and we will show you what it does. So let's go ahead
and push our sketch. It's a simple sketch. It's basically saying that when it gets a digital read
from that sensor, meaning the sensor is picking something up, then it's going to turn on the
light. So this is going to let us know if a magnetic field is entering the area. And I do
happen to have a magnet here, and you can see it light up. So let me hold it down. Maybe you can
see a little bit better. When the magnet approaches that little tiny piece right there, the red light
comes on. Now this isn't a very strong magnet, and it is really only magnetic on the one point.
I mean, if I get really close to, like, touching it, it picks up more magnetic field. But the
stronger the magnet, the further it'll detect it. So that is a pretty cool little trick. This can
actually be used in some applications to cause things to levitate and things like that. We're
not going to get into that in this video because it is a little bit more complex than just the
sensor itself, but I will show you that eventually down the road with a project that we have in mind.
For now, that's going to be it for the Hall sensor. Stay tuned for the next one where we'll
be going over another sensor. And as always, if you would like to get a hold of this bundle
or a large bundle of sensors for super cheap, check out the affiliate links in the description
below. I'll have some down there from Banggood, and they are super cheap, but good quality. So
very, very nice stuff. I'll see you in the next video.
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.