Hi! welcome to nor doing a tutorial for Robojax. in this video we are going to test and see this
in JK 5000 to see hull magnetic sensor closer will turn on we're going to turn
on and off an AC bulk using magnetic field detection you can get the code for this by
clicking at the link of the description which is below the video and will she will take you
to Robojax.com/learn/arduino let's get started with this
this is the hull Sanford and the model number is in JK 5002 C finally we are getting something from
EB and an early expressed that has a model number and internally this has a howl sensor the job of
health sensor is to detect magnetic field when magnetic field or a magnet is close to this it
detects it and we'll send low signal this also has a light here when it detects it this can operate
between five to thirty six volts a draws around 10 milliampere very low current any magnet or
magnetic field that approaches at this point this will detect it so it can have multiple application
and robotics and production line and automation that it detects position of either object that
has magnet so what you do is you will either put magnetic actual magnet on the other piece
or electromagnet that attached to the arm or to the element that is getting close to this
one or maybe the other piece is stationary and this is attached to something that moves so you
will have a you will have a magnet of certain position and when it approaches get closer this
will turn on and it has ends of this wire is 112 centimeter or 44 inches the module weighs 40 grams
a diameter is eleven point seven millimeter this nut is sixteen point five millimeter the length
of this sensor up to this point F thirty one point eight millimeter also this LED will turn
on where the text magnetic field close to it I've got these pin headers which I'm going to attach
to this these wires this will be connected to 5 volts this will be connected to the ground this
is the output from this with the load trigger I'm in it in the code and the diagram and here
this has just not and also briefly explaining you the relay the relay has three pins here these two
pins are normally open and this one is normally closed whatever wiring you do you always want have
your one wire at the middle and the other will be either here we should be normally closed and
here which will be normally open but it means if when the signal comes to the relay these two wires
will connect this side we have VCC which will be connected to 5 volts ground will be connected to
the ground and n will be connected to the input of your Arduino which is pin 8 this green light
will turn on when it receives signal and relief energized LED will turn on when you connect the
relate to 5 volts when you're using a relay pay attention to the current rating of a relay for
example this is a very tiny really and the current rating is 2 ampere for 30 volts 0.5
amperes 400 volts and 0.6 ampere 425 volts this is the amount of current that it can
handle this can handle 10 ampere at 28 volts and 10 appear at all voltages 120 and 250 and
30 volts so to understand how my DIF can handle in North America the voltages 120 volts 10 times
10 ampere is 1200 watt or 1.2 kilowatt if you're in Asia and Europe the voltages let's say 220 or
240 volts for 220 times 10 is 2200 watts or 2.2 kilowatt this relay can handle and the same way
this one you are after also multiply the voltage times the current to get the power and the same
way this is a 12 volt relay but the rating is 10 ampere for majority of the voltages to avoid fire
and overheating do not allow the current above the rated current to pass through this relay
set up and diagram that I've done the positive five volts this is 5 volts connected to the VCC
and to the hull sensor and as a ground or negative is also connected to the ground of
this relay and to this sensor and this black wire is connected to the end of this relay and my load
is also connected to the bulb so this is my ball now and this is connected an easy load and magnet
B symmetry of this sensor this is an AC desktop bulb and this is a power plug that I connected to
the wall and 120 volts which will turn on and off now at this point I've cut one of these two wires
at this point and twisted it and saw that it can be connected to relay job of relay is to connect
this and the AC bulb is on or AC load whatever fan you have and disconnected to turn it off so I will
be connecting these two to the relay my easy bulb now if a load is connected to this relay and not
touching it and this is a sensor and if I put the North Pole of the magnet it will not be triggered
so the position of the sensor inside is such that it will be triggered only with the South
Pole and here is a slight and also you will see it there so it's you can have electromagnet or
whatever way of magnet but the polarity is very important because this will not work so not well
from leaving this distance so you have to be very close and it will not work from the side
because the metal is blocking the path of electro magnetic field
from the sensors we have the three wires the brown is connected to five volts blue
is connected to the ground and the black is connected to pin 2 for the relay VCC
for the relay this VCC is connected to 5 volts the metal one is connected to the
ground and then the last one which is the end the or anyone connected to pin 8 the
two wires of the EC bolt that I shown you are connected through these two pin of this relay
let me now explain the code we first defined a sensor pan-pan - there is no semicolon or
anything so you can use any digital pin that you want to use make sure it's available and
this is a real a pin 8 we will use this pin to connected really and this weight variable
of type integer is 3000 millisecond or 3 second this is the amount of time that when the switch
turns on the relay you want to wait this amount of time if you wanted this one to be real time
just make it zero as soon as the switch is off the relay will be off it's up to you inside the setup
which starts from here to here this code will run only once we use pin mode we say pin modes and a
certain which we have defined here a pin - this is as if we type 2 here and we say input pull
up because this sensor needs a pull up resistor I've explained it a separate video in this link
you can watch it so it just eliminates usage of external resistor and then we go pin mode this
time we relate and define the delay pin as an output this was as an input this is an output
and we initialize the serial monitor with 9600 baud so we can print this text for us here and
this must match the 9600 baud on this side must match this number in order to be able to read
it inside the loop which starts from here to here this will run continuously we do the digital read
sense pin we are reading pin 2 and the result of this either if it's sensed or not will be
stored in the sense sensed integer because the sense is either 0 or 1 so we are storing it in
a integer so 0 or 1 and Arduino means low or high then we say F sensed equal equal load this
equality is used for comparison 1 equal is for assignment we assign value but here we compare
we say a sense is equal equal or if it's low the we planned this on the screen it will show
it like this and then digital read relay pin low this goes to pan it and sets it to low because my
relay is low trigger I put low if you release the front put high so turn on mean but it too
low and also wait for the amount of things that you said above and if there is no weight or the
weight is zero it just go immediately after that and if it's not low the sense is not load then we
you go to the elf and we say digital right relay pan high this now turns off the relay again as
the above if you are reversing this if this is high this must be low if this is low this must
be high so changing change it accordingly in my case it's just high and then I just print this
one to plan this - I didn't say sense or anything to show that there is something it did not detect
anything 300 millisecond is the weight to avoid has two resistors or continuous connection and
disconnection so you can play with this but my experimental a hundred milliseconds was good
let me now demonstrate this is a serial monitors the reliefs connected this is my AC bulb here
and the proximity sensor is here now if I put this closer will turn on and also you can see
it she's sensed it needs to be very aligned a little distance will not work even like
this it will not work so the pole must be on this side and also you can see the light the
LED will turn on here if I put the other Pole the North Pole will not work magnetic field
now goes like this it must be within this area if I'm holding it just continuously
shows frenched the amount of time that is running at the moment was zero so if I make
this 3 second now this has set at 3 second if I remove it within terrific and it's on stealth
if I said if I said this zero and if you want to respond but this one which is 300 millisecond
if I make this zero now pay attention with the zero that delay the main delay
so you will not get that results because it'll be too quick connect and disconnect I
will suggest play with this to find an optimal time my experience was 300 but maybe Melissa
Caen 300 meter per second and maybe in your application you need hundred millisecond or
less or more thank you for watching this was how to use this in JK 5 zero zero to see how
the sensor if you like and learn something from this video please thumb up if you have
question or comment please post it in the comment section I'll try to answer and reply
and please don't forget to subscribe so you can get updates of my upcoming cool videos
you