ไม่สามารถเล่นวิดีโอนี้
ขออภัยในความไม่สะดวก

How to use a 12 Volt Proximity Sensor with an Arduino

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 ส.ค. 2024
  • Learn a simple way to use a 12 volt proximity sensor with an Arduino. This method works for capacitive and inductive sensors regardless if they are NPN or PNP sensors.
    My Object Detecting Lawnmower:
    • Object Detecting Lawn ...

ความคิดเห็น • 50

  • @kwacz
    @kwacz 2 ปีที่แล้ว +7

    instead of the relay you can just use a voltage divider as a level shifter to get the voltage down to the proper voltage for the arduino digital input pin 5 or 3.3 volt depending in which arduino you use.

  • @meloconza7718
    @meloconza7718 3 ปีที่แล้ว +2

    this input_pullup function was new to me, verry usefull , thanks a lot

    • @DuctTapeMechanic
      @DuctTapeMechanic  3 ปีที่แล้ว

      Yes its a great function. Before I knew about it, I used to use actual pullup resistors to achieve this. Thanks for watching!

  • @AlexPrivett
    @AlexPrivett 3 ปีที่แล้ว

    I am designing and building a laser cutter, this was exactly what I was looking for, thanks for uploading.

  • @etiennedejager5821
    @etiennedejager5821 2 ปีที่แล้ว +1

    Very well explained. Thanks. I just bought an arduino uno and a proximity sensor. I would like the buzzer however to only go off when something passed by the sensor every say third time. Basically have the arduino count the amount of times the sensor is triggered and buzz when it reaches the set amount like with every third item. Is that possible and how would you do that? Would you do a video on that for us?

  • @alo1236546
    @alo1236546 2 ปีที่แล้ว

    Npn sensor will pull ground when activate. Direct connet pull up input arduino.

  • @markmeme28
    @markmeme28 ปีที่แล้ว +2

    thank you
    I have a small question
    what should i do to make a counter to count the number of metals ?

    • @DuctTapeMechanic
      @DuctTapeMechanic  ปีที่แล้ว

      Check out my video "Speed bag punch counter" in which I use this same sensor in a counting application

    • @markmeme28
      @markmeme28 ปีที่แล้ว

      @@DuctTapeMechanic thank you 🙏🏻

  • @jawadmazher5621
    @jawadmazher5621 4 ปีที่แล้ว +5

    That's really cool! What do we do if we want the sensor to beep before the object gets too close, do we just get a stronger sensor or can this be controlled with Arduino code?

    • @DuctTapeMechanic
      @DuctTapeMechanic  4 ปีที่แล้ว

      Thanks. This sensor has a screw on the top which allows for some variation of the sensitivity but a better sensor would be the way to go.

  • @scottbechdolt6586
    @scottbechdolt6586 9 หลายเดือนก่อน

    Hi, I don't understand what you meant by connecting to the anode if you want the relay to do the opposite. Anode of what? . Does a coil have an anode?

  • @DevilFreakShow
    @DevilFreakShow ปีที่แล้ว

    If i want to take count of pulses of a rotating shaft of motor and show or store it on my server what can i do should i use something else ?

  • @JimBeshears
    @JimBeshears ปีที่แล้ว +2

    Be careful with cheap sensors unless the application isn't critical. They usually have EMC and temperature drift problems.

    • @DuctTapeMechanic
      @DuctTapeMechanic  ปีที่แล้ว +1

      Thanks for the heads up. I mostly use them for non vital "fun" projects

    • @JimBeshears
      @JimBeshears ปีที่แล้ว +1

      @@DuctTapeMechanic nice job on the video also!

  • @justlutfi2890
    @justlutfi2890 3 ปีที่แล้ว +1

    you can simplify using BC547

    • @DuctTapeMechanic
      @DuctTapeMechanic  3 ปีที่แล้ว

      Yes that will probably work. I recommend us pc817 for an alternative way to do this

  • @qqmayakashi
    @qqmayakashi ปีที่แล้ว +1

    Is there a way to control the sensitivity of the proximity sensor using arduino code? if not what should i find to be able to do it?

    • @DuctTapeMechanic
      @DuctTapeMechanic  ปีที่แล้ว

      You can adjust the sensitivity on the sensor itself using the set screw

  • @sye7969
    @sye7969 2 ปีที่แล้ว

    have you also connected the arduino board to laptop/pc along with the battery ? does it cause any harm ?

  • @BigBang11n70
    @BigBang11n70 ปีที่แล้ว

    Hi Man,
    nice video!
    Does it work the same way for a 24v light barrier sensor if you get a 24V relais? Cheers

  • @thomas3236
    @thomas3236 3 ปีที่แล้ว

    Thanks, that was really helpful.

  • @fadelcmd9969
    @fadelcmd9969 3 ปีที่แล้ว +1

    Hi, can you tell me what kind of part that you use or maybe you can send me the link to buy that part. Cause I need that so much, I need to connect my capacitive sensor to the arduino. Btw thank you for making the videos, it helps me a lot.

    • @DuctTapeMechanic
      @DuctTapeMechanic  3 ปีที่แล้ว +1

      Its called a 12v dpdt relay. Thank you for watching. www.amazon.com/Electromagnetic-Socket-Mechanical-Indicator-LY2N-J/dp/B07SYYP41M/ref=mp_s_a_1_7?dchild=1&keywords=DPDT%2BRelay&qid=1604236771&sr=8-7&th=1&psc=1

  • @toddmaggio2032
    @toddmaggio2032 2 ปีที่แล้ว

    Thank you for sharing your knowledge. My question is whether it is possible for a sensor to reverse the current in a circuit any time it detects a target. And if so how can it be done?

    • @DuctTapeMechanic
      @DuctTapeMechanic  2 ปีที่แล้ว

      Just hook up the dpdt relay with a cross pattern this will reverse polarity when something is detected. You don't even need an Arduino. Just go from sensor to dpdt relay to dc motor (I presume)

  • @farahnasir5023
    @farahnasir5023 4 ปีที่แล้ว +2

    😎 cool

  • @kevinpiot7317
    @kevinpiot7317 ปีที่แล้ว +1

    What is the relay for?

    • @DuctTapeMechanic
      @DuctTapeMechanic  ปีที่แล้ว

      Just a rudimentary way to interface the 12 volt sensor with the arduino a PC817 optocoupler would be a more elegant choice

  • @mftest100
    @mftest100 2 ปีที่แล้ว +1

    Hey, great video - I've missed this, (I am a total beginner) what is the purpose of building in the relay ? Hope you can enlighten me :-)

    • @DuctTapeMechanic
      @DuctTapeMechanic  2 ปีที่แล้ว

      Good question. The relay acts as a switch. Basically when the sensor is triggered (something is detected) it "turns on" the relay which in turn grounds out the arduino pin. And the pin going to ground can be coded for (i.e. sensed by the arduino). The relay helps integrate the sensor with the arduino while keeping them electrically isolated, a more elegant (more proper) way to do this would be to use a PC817 optcoupler instead of a relay (but this does work). I was kind of working with what I had at the moment.

    • @mftest100
      @mftest100 2 ปีที่แล้ว

      @@DuctTapeMechanic Tx very much - I had thought of the PC817, because I have seen that on other project - much obliged for your very relevant feedback - Michael

  • @iamax8307
    @iamax8307 2 ปีที่แล้ว

    How can I use this to make the buzzer louder as object gets closer? Welp

  • @mohammedkhallaf6478
    @mohammedkhallaf6478 4 ปีที่แล้ว +2

    What if I want to use an analog sensor?

    • @DuctTapeMechanic
      @DuctTapeMechanic  4 ปีที่แล้ว

      Perhaps you could try using a optocoupler pc817

    • @DuctTapeMechanic
      @DuctTapeMechanic  4 ปีที่แล้ว

      Dividing the voltage with resistors would work as well

  • @nizarfahimi
    @nizarfahimi 7 หลายเดือนก่อน

    What is the function of the relay in this project?

    • @DuctTapeMechanic
      @DuctTapeMechanic  7 หลายเดือนก่อน

      In a nutshell, it serves as a voltage isolation mechanism. There are probably a lot of better ways to do it. Just what I thought of at the time.

    • @nizarfahimi
      @nizarfahimi 7 หลายเดือนก่อน

      ​@@DuctTapeMechanicwhen connecting the output of the sensor does the voltage need to be stepped down?

    • @nizarfahimi
      @nizarfahimi 7 หลายเดือนก่อน

      ​@@DuctTapeMechanicwhat power source did you use in the video?

  • @jaredyuri3884
    @jaredyuri3884 3 ปีที่แล้ว

    hi, I have a retroreflective NPN sensor and have the same diagram like yours proximity sensor , but after many attempts it doesn't work at all

    • @DuctTapeMechanic
      @DuctTapeMechanic  3 ปีที่แล้ว +1

      If you get me the part number maybe I can look up the wiring schematic to get a better idea of your problem.

    • @jaredyuri3884
      @jaredyuri3884 3 ปีที่แล้ว

      @@DuctTapeMechanic for first Thank you for your answer and the part number is : Omron e3jk-rn12

  • @rajarshigiri1664
    @rajarshigiri1664 2 ปีที่แล้ว

    I am trying to build a proximity sensor project where if you are too far away from your ba while travellin it buzzes or sends a notification. will this be possible in audrino or I need rasberry and what kind of proximity sensor should i use for that?

  • @Erkontekservices
    @Erkontekservices 3 ปีที่แล้ว +1

    great job can you send me a code sir