1

We've got an Arduino KY-032 obstacle avoidance sensor, and have spent a decent time searching and researching to find a detailed data sheet/manual to figure out how it works; but there aren't any detailed information on the module.

Arduino KY-032

One of the few instructions here says that the potentiometers on the chip are used to adjust the distance, but I've tried all different settings and the maximum I can get is 10 centimeters. I've tried different surfaces with different reflectivity levels, but it doesn't really differ much.

Any idea how to increase the distance on this? Anything to do with the enable jumper?

Update: Here's the related code to the obstacle detection:

void loop() {
  // check the network connection once every 10 seconds:
  val = digitalRead (buttonpin) ;// digital interface will be assigned a value of 3 to read val
  if(full==1 && val==LOW) {
    Serial.print("Bin Full");
    delay(5000);
  } else {
    if (val == LOW) {
      // When the obstacle avoidance sensor detects a signal, LED flashes
      digitalWrite (Led, HIGH);
      delay(2000);
      if(digitalRead(buttonpin)==LOW) {
        delay(2000);
        if(digitalRead(buttonpin)==LOW) {
          full = 1;
        }
      }
      count++;
      //printCurrentNet();
      sendData();
    } else {
      digitalWrite (Led, LOW);
      if(full==1) {
          count = 0;
      }
      full = 0;
    }
  }
}
6
  • It could be code related. Can you add small snippet of your code (excluding anything unrelated to this issue)? Thanks! Mar 7, 2015 at 14:10
  • @AnnonomusPenguin There you go. (:
    – Neeku
    Mar 7, 2015 at 15:20
  • It may just be defective. Have you tested duplicate sensors? It may also just be low quality product. Have you tried contacting the manufacturer?
    – Paul
    May 16, 2015 at 3:22
  • How about this- test the sensor WITHOUT the Arduino Uno. May 19, 2015 at 15:12
  • 1
    @Pedro What do you mean how we connected it to Arduino? We were using an Intel Galileo board and programming it with Arduino. There are tutorials if you look up.
    – Neeku
    Jul 25, 2015 at 20:33

5 Answers 5

2

The IR sensor module incorporates an internal 38KHz bandpass filter. The pot near the GND pin fine tunes the frequency of that signal, which is used to illuminate the IR LED.

The other pot adjusts the duty cycle of the signal. This controls the brightness of the IR LED. Both adjustments effect the sensitivity and range of the device.

To achieve maximum sensitivity, it is absolutely necessary to use the 'EN' or 'Enable' pin. When used correctly, however, additional optical shielding of the IR LED is required. This can be done with a small cardboard tube commonly used as packing material or any of a variety of other materials.

If the Enable function is not used, the jumper must be installed on the board. The Enable pin cannot be used if the jumper is in place.

For more information, see: http://irsensor.wizecode.com/

3

The wizecode page has some nice info. However the R5 pot (near the EN jumper) does not change the duty cycle but directly the current to the IR LED - still affects the brightness though. Too much current seems to trigger false positives - depends on your additional optical shielding. I put some black heat shrink tubing over the sensor - with a hole punched in for the sensor to see though. Also the R6 pot does not really "fine tune" the frequency, more like "coarse tune" - even a small nudge can detune by a kHz, greatly reducing the sensitivity.

If you use the EN jumper, a suddenly appearing object gives a short pulse, but then the disturbance signal suppression kicks in turns sensitivity down and 'unsees' the object. Also slowly appearing objects are not recognized for that reason. Only very near objects (a few cm) give a strong enough signal to overcome that sensitivity attenuation.

What I found somewhat irritating: Setting EN to LOW lets the IR LED steady on instead of off, which I would have expected. That might irritate the sensor more than necessary. Also draws more power (maybe even a lot, depending on R5 current setting).

Funny enough, you can get a somewhat analog behaviour from this sensor if you measure how long it takes from activating the EN pin to the sensor output getting low. The nearer the object is, the faster it reacts. Near objects take ~190us, farther objects more than 400us. Not nearly a linear behaviour though. Also depends on distance, size, angle, IR reflectivity and IR LED power. However it can detect a person in more than 1m distance.

1

These Obstacle sensors don't always work as expected.I bought 3 of them, but only 2 worked properly.The other only worked to a distance of about 6-7cm.
By the way, the code seems to be fine, but there is no way to tell for sure without complete code.

1

Check This: http://irsensor.wizecode.com/

When the GREEN JUMPER is installed on the board (see picture), the IR LED will flicker continuously at 38kHz. If the Enable (EN) function will not be used, the jumper must be installed . When the jumper is removed, pin 4 of the 555 timer is held LOW (RESET) by R3, a 22K pull-down resistor. Then, if a HIGH condition is applied to the EN pin, the reset condition will be relieved and the 555 timer will begin to oscillate. The Enable function cannot be used if the GREEN JUMPER is in place. You must remove the jumper on the board in order to use the EN (Enable) pin.

0

Well, the range of the sensor should be: "2-40cm" I would suggest using the code below and changing the potentiometers to see if it makes any difference.

int Led = 13 ;// define LED Interface
int buttonpin = 3; // define the obstacle avoidance sensor interface

void setup ()
{
  pinMode (Led, OUTPUT) ;// define LED as output interface
  pinMode (buttonpin, INPUT) ;// define the obstacle avoidance sensor output interface
}
void loop ()
{
  if (digitalRead (buttonpin) == HIGH) // When the obstacle avoidance sensor detects a signal, LED goes on.
  {
    digitalWrite (Led, HIGH);
  }
  else
  {
    digitalWrite (Led, LOW);
  }
}
2
  • I wouldn't think that's required, it's very likely that the Sensor is malfunctioning. May 19, 2015 at 15:08
  • @Mathsman100 But it is a way to prove so?
    – Paul
    May 19, 2015 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.