Infrared Obstacle Avoidance Sensor Tutorial for Arduino / ESP32

Поделиться
HTML-код
  • Опубликовано: 13 июл 2024
  • During the current Coronavirus pandemic we're all being encouraged to reduce the number of shared surfaces that we touch in order to reduce the risk of virus transmission. So, this is the first video in a new series in which I'll be considering various methods that can be used to replace a traditional Arduino button input with a touch-free interface instead, requiring no physical contact. This is just one possible consideration of how you can make an escape room (or any other public-facing Arduino interface) more "Covid-secure".
    In this first part I'll be looking at an FC-51 "Infrared Obstacle Avoidance Sensor" component, which can be easily purchased online for only a dollar or so. It's a cheap, readily-available module that's easy to wire and code on an Arduino, ESP32, or other Microprocessor, using only a single digital input pin, and it's capable of simulating when a button is pressed, held, or released.
    You can buy this sensor from, e.g. www.banggood.com/custlink/3KG...
    Timings
    ---
    00:00:00-00:01:03 Introduction
    00:01:04-00:06:45 Demonstration
    00:06:46-00:07:11 Hardware Wiring
    00:07:12-00:16:08 Arduino Code Listing
    00:16:09-00:16:58 Summary
    Code & Wiring Downloads
    ---
    If you'd like to support me making more video tutorials explaining how to use tech in escape rooms and other playful settings, please check out my Patreon at / playfultech , where you can also find code downloads, wiring diagrams, and additional resources for this and all my other tech projects.
  • НаукаНаука

Комментарии • 34

  • @michaelbluecastlestudio665
    @michaelbluecastlestudio665 3 года назад

    Pretty well explained…as always. Thanks for sharing😎

  • @superconfort
    @superconfort 3 года назад

    Thanks Alister you are very inspirational

  • @ifell3
    @ifell3 3 года назад

    Great stuff, you could also place two opposite of each other, and sketch a if not detected do something, might get a bit more range.

  • @mfx1
    @mfx1 3 года назад +1

    BTW newer versions of that IR module have smaller LED's that are mounted at right angles and also have a plastic separator between them, obviously they work in exactly the same way but I don't know if there is a significant range difference although the separator may enable longer ranges by reducing crosstalk.

  • @bibel2k
    @bibel2k 3 года назад

    thank you for another great video.
    It is so clear on your face and the way you speak you enjoy making these films so much.
    Maybe this is why your channel is so loved by my students.
    I must say I disagree and this is really one of the worst detectors ever..
    Every camera flash, direct sunlight or sometimes even heat can really disturb it and cause false readings.
    There is another version similar to this one with a 555ne timer built in that produces a square wave which is detected, therefore it is not just a regular ir but instead specific signal.
    I will share this as always with my my students as an example how to use an operational amplifier and a use of of the phototransistor.
    Thank's again keep up the great videos!

    • @PlayfulTechnology
      @PlayfulTechnology  3 года назад +1

      You're absolutely correct that this module is limited in many ways, but I still think it has uses (and it is very cheap!). I wanted to start this series of videos with "simple" but flawed modules, and I'm going to progress onto slightly more advanced modules which address some of the issues you mentioned.

    • @bibel2k
      @bibel2k 3 года назад

      @@PlayfulTechnology
      Thanks.
      So much fun to receive an answer.
      Keep filming and publishing!
      Already got a notification about other videos you uploaded in the series..
      When do you have the time?

  • @physicist137
    @physicist137 3 года назад +4

    I think the potentiometer sets the threshold for the comparator IC, not for the IR LED current.
    Btw, you can use just an IR LED with a resistor and an IR photo-transistor in combination with the internal pull-up resistor on an analog input pin to do the same with a much smaller footprint.

  • @mfx1
    @mfx1 3 года назад +1

    You can also use the analogue output from the sensor to give the Arduino control of the trigger point which could enable longer range and also allow for tracking, so slow changes in level won't trigger it, only fast changes will, useful for cases where ambient light may be an issue.

    • @emiltoteb
      @emiltoteb 3 года назад

      The sensor he had in the video only had 3 pins - vcc, grd & out, so no analog out to use here, but I guess this was meant to be used in cases where you may not necessary need an arduino (you can hoot it up directly to a relay for instance). I think in a video he did quite long ago he had a photosensor (light level) and used the analog pin to set a baseline, just like you suggest.

    • @mfx1
      @mfx1 3 года назад +1

      @@emiltoteb See my other reply, the newer versions do have it, I thought the older ones did as well but maybe it's only on some versions.

    • @mfx1
      @mfx1 3 года назад +3

      Another minor point is the potentiometer doesn't alter the LED brightness as stated in the video it alters the comparator reference voltage on the detector, in real terms that's kind of nit-picky but the result isn't exactly the same, a better sensor would use a modulated IR source (40kHz is fairly standard for IR remote controls) that makes them more immune to ambient light pickup so better for outdoor use.

    • @PlayfulTechnology
      @PlayfulTechnology  3 года назад

      You're absolutely right - I explained that wrong - my apologies. I was also somewhat surprised to find that these modules don't modulate the IR source either (I don't know whether it's a region-specific thing, but I think 38kHz is more common here than 40kHz) - but it really is just a simple IR LED in this case. In later videos I'm going to be looking at some more "advanced" alternatives, so it was a deliberate choice to start with a simple module, even if it is somewhat limited!

    • @mfx1
      @mfx1 3 года назад

      @@PlayfulTechnology Sorry you're right, 38kHz, it's a LONG time since I've needed to do any IR hacking and that was mostly Sony who use 40kHz (also 40kHz is common for ultrasonics which I use a fair bit), rounding error :-).

  • @Ahmed_Elhaddad
    @Ahmed_Elhaddad 2 года назад

    Hi! is it possible to identify if an object is a metal or non-metal? will there be any tweaks to the code?

  • @davelopez9161
    @davelopez9161 2 года назад +3

    Error in your description. At 3:30 you state that the pot increases the intensity of the emitter.
    This, in fact, is not the case.
    The pot adjusts the threshold of the comparator which, in effect, increases or decreases the amount of light that has to be detected before the output triggers.
    At least that is how it is on the units that I received.
    Here is the schematic that I found: www.pcbway.com/project/shareproject/FC_51___IR_Sensor.html
    BTW: The "large signal response time, of the comparator, is about 300ns. Standard response time is about 1.3us.
    I still need to get the datasheets for the ir emitter and detector.
    At 3:30 you state that the pot increases the intensity of the emitter. But then, at 4:16 you state the pot adjusts sensitivity. It can't do both. In fact, it doesn't do either.
    The "sensitivity of the detector is fixed as is the intensity of the emitter.
    The pot merely changes the voltage (based on the amount of current flowing through the detector) at which the output, of the comparator, changes polarity.
    I am not understanding, at the moment, the usefulness of the pot. Unless, it is as you demonstrated. It adjusts for spurious input from the emitter???
    For my application I'm going to use two boards. One for emitting and one for detection. I hoping to get about 2ft of operational space between them.

    • @PlayfulTechnology
      @PlayfulTechnology  2 года назад

      Yes, you're correct - that's what I get for not writing a script and relying on the translation of a datasheet which interchangeably described the pot as "sensitivity"/"intensity"/"calibration" adjustment!

    • @davelopez9161
      @davelopez9161 2 года назад +1

      @@PlayfulTechnology datasheets are sometimes not accurate or comprehensive.
      Something else I found out is that when the output is "ON" as indicated by the LED, the output of the comparator(input to the arduino) is actually low.
      I am constructing a speed checker for golf discs. I have the emitter mounted about 12inches away from the detector and I throw the disc between them.

  • @xno_elysiumx3744
    @xno_elysiumx3744 2 года назад

    Is water reflecting ir signals? I need a sensor to distinguish between ground and water for a robot project.

  • @maulanawahyudi7127
    @maulanawahyudi7127 3 года назад

    why can't I get a stable measuring distance? even though I have used an external source or VCC from Arduino

  • @daanwel4987
    @daanwel4987 2 года назад

    Hello sir, is it true that the sensor can not detect clear glass, or clear substances such as water?

  • @jadelaossa
    @jadelaossa 3 года назад

    sensorPin should be initialized as a digital input, shouldn't be?
    Thanks for sharing!

  • @cnsisow
    @cnsisow 2 года назад

    How to we increase the range of sensation?

  • @mungsmemekitchen6277
    @mungsmemekitchen6277 2 года назад

    Hey, I have an issue: I'm connecting this sensor to a robot and not using an Arduino at all. Instead, I have the out pin tied to the gate of a bs170 transistor (which drives a motor). When I power on the circuit, the object detection LED on the IR sensor turns on regardless of what's in front of it, but the gate of my transistor reads a zero voltage. When I unplug the OUT wire, the LED reads normally. Any advice?

    • @PlayfulTechnology
      @PlayfulTechnology  2 года назад

      I can't see anything obviously wrong with what you're describing.... do you need to add a pull-up/down resistor to the transistor gate?

    • @mungsmemekitchen6277
      @mungsmemekitchen6277 2 года назад +1

      @@PlayfulTechnology Yeah I ended up using a pulldown resistor on the mosfet gate and that fixed it

  • @davelopez9161
    @davelopez9161 2 года назад

    I'm wonder what the response time of the infrared device is.
    For instance would it be able to detect a golf disc travelling at 70mph? 60mph? 50mph
    I just read that the detection distance is only 30cm???? Do you think that would improve if the device was enclosed in a box with a very reflective surface on the opposite side?
    what's the beam angle of the emitter? can it be collimated?
    OR, could I mount the detector on the far end (about 2ft) so it is getting light directly from the emitter and not the reflection?
    I'm looking for a way to measure the speed of a golf disc without having to shell out 100's of dollars for a radar gun.
    go ahead. call me cheap. i'ts been done before.
    Besides. this arduino stuff is a kick.

    • @PlayfulTechnology
      @PlayfulTechnology  2 года назад

      The "response time" is, essentially, instantaneous - the sensor is just an IR photodiode that is sensitive to IR light of the same wavelength as that emitted by the IR LED. But that IR light can be emitted from any source - so if you shine a light that gets reflected off your golf disc back at the sensor, the resistance and output voltage will change immediately in proportion to the amount of light received.

  • @mariohouston1
    @mariohouston1 Год назад

    Hello sir can you contact me as soon as you can I have a very serious question about your sensor