Obstacle avoidance sensor module (HCMODU0006)

Modules for various types of sensors including accelerometers. gyro's, IR motion, etc
Post Reply
admin
Site Admin
Posts: 866
Joined: Sun Aug 05, 2012 4:02 pm

Obstacle avoidance sensor module (HCMODU0006)

Post by admin » Sat Jun 21, 2014 8:16 am

Image

Description:

Allows for sensing of solid objects within a fixed range (adjustable with on-board potentiometer) of approximately 5 to 45cm. Ideal for robotic applications.

Pinout:

PIN 1: GND
PIN 2: DATA OUT (LOW = Object detected)
PIN 3: +5V (VCC)
PIN 4: ENABLE (REMOVE JUMPER EN BEFORE USING)


Example Arduino Sketch:

Code: Select all

/* FILE: ARD_Obstacle_Avoidance_Sensor_Module_HMODU0006_Example
 DATE: 04/06/13
 VERSION: 0.1

This is a simple example of how to use the Hobby Components obstacle avoidance sensor 
module (HCMODU0006). It is a very simple module that requires only one DIO
pin (defined as an input) to operate. When the sensor detects a reflective object 
in close proximity it will pull a connected DIO pin LOW. A non reflective or no object
in close proximity will cause the DIO pin to go high.

PINOUT:
PIN 1: GND
PIN 2: DATA OUT 
PIN 3: +5V
PIN 4: ENABLE (NOT CONNECTED)

You may copy, alter and reuse this code in any way you like, but please leave 
reference to HobbyComponents.com in your comments if you redistribute this code. 
This software may not be used directly for the purpose of selling products that 
directly compete with Hobby Components Ltd's own range of products. 

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER 
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES, 
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY 
REASON WHATSOEVER.

*/


/* Define the DIO pin that will be used to communicate with the sensor */
#define SENS_DIO 2

/* Initialise serial and DIO */
void setup()
{
 /* Setup the serial port for displaying the status of the sensor */
 Serial.begin(9600);

 /* Configure the DIO pin the sensor will be connected to as an input */
 pinMode(SENS_DIO, INPUT); 
}


/* Main program loop */
void loop()
{
 /* If the DIO pin is pulled low then an object has been detected */
 if (!digitalRead(SENS_DIO))
 Serial.println("Object detected !");

}

FAQ:

How do I adjust the range of the sensor?

With the pin header facing towards you the left pot will adjust the sensitivity of the sensor, and the right pot adjusts the brightness of the IR LED. Turning the the left pot Anti (counter) clockwise will increase the sensors sensitivity. Turning the right pot clockwise will increase the intensity of the IR LED. Increasing the sensitivity of the sensor or intensity of the IR LED will increase the range of the sensor.


How do I set up the sensor to get the maximum range?

Firstly adjust both potentiometers to to their maximum (fully anti-clockwise for the sensitivity and fully clockwise for the IR LED intensity).

When setting up the sensor for maximum range make sure it's pointing away from any solid objects. You will need to adjust the two potentiometers (see above) to find the sensors sweet-spot. For the pot that sets the IR intensity you can usually get away with setting this to maximum brightness (fully clockwise) however the IR light may then be bright enough to bleed directly across to the sensor. If the sensor is permanently triggered (SLED remains illuminated) even when the sensitivity is reduced then just reduce the intensity of the IR pot a little.

Next reduce the sensitivity pot until the LED marked SLED turns off. You should then be close to it's maximum range although as mentioned before you may still need to adjust them slightly to find the sweet-spot.



I've adjusted the sensor as suggested above but I'm still not getting the maximum range. Why is this?

Maximum range is not only dependent on finding the ideal positions of the two potentiometers (see above). The following can also effect range:

Ambient light and infra-red levels in the room. This will dictate the maximum sensitivity that the sensitivity potentiometer can be set to. If the sensor is in a well lit room with lots of natural daylight then this will reduce it's maximum sensitivity.

IR reflectiveness of the of the object to be sensed. For the sensor to detect the object there must be a sufficient amount of IR light reflected back from the IR LED to the sensor. An object with a flat surface perpendicular to the sensor will reflect more light back compared to a object with a uneven surface or a surface pointing away from the sensor. Also, an object that is good at reflecting visible light may not necessarily be good and reflecting IR light. When setting up the sensor we recommend using a piece of folded white paper.

Position of the IR LED and sensor. The LED and sensor should be positioned so that light can reflect directly back from the LED to the sensor. It is possible for these components to be moved out of their ideal position during transit. Make sure they are both pointing in the correct direction by very carefully adjusting the position of the components.

Finally make sure there are no objects near the sensor that may be reflecting some of the IR light emitted by the LED directly back into the sensor.



Disclaimer: Libraries, example code, and diagrams are provided as an additional free service by Hobby Components and are not sold as part of this product. We do not provide any guarantees or warranties as to their accuracy or fitness for purpose. Diagrams are for illustration purposes only and may not be to scale.

Copyright notice: Descriptions and diagrams on this page are copyright Hobby Components Ltd and may not be reproduced without permission.

hc1
Posts: 2
Joined: Sun Jun 22, 2014 7:13 pm

Re: Obstacle avoidance sensor module (HCMODU0006)

Post by hc1 » Sun Jun 22, 2014 7:16 pm

Is there a schematic available for this module? I can trace the circuit out but it would be quicker if a diagram was already available.

Thanks.

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: Obstacle avoidance sensor module (HCMODU0006)

Post by andrew » Mon Jun 23, 2014 11:15 am

I've just contacted the factory and I'm afraid a schematic is not available for this module.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

hc1
Posts: 2
Joined: Sun Jun 22, 2014 7:13 pm

Re: Obstacle avoidance sensor module (HCMODU0006)

Post by hc1 » Sat Jun 28, 2014 10:43 am

I have drawn up a schematic here:

Image

The design would benefit from a few modifications since the current to the IR emitter is not very well controlled and the pulse width is very narrow.

Changing RV1 to 1K and putting 390R in place of the EN link to limit the current to the emitter would be better. This is a worthwhile improvement.

Whilst setting the duty cycle of the emitter drive waveform to 50:50 improves the range the receiver can become saturated due to the close proximity of the emitter. Changing RV2 to 22K and R2 to 1K will allow a waveform of closer to 50:50. RV2 can then be set to give 38kHz on pin 7 of U2. I would not recommend this change unless you are going to better isolate the emitter from the receiver. You will also need some method of measuring the frequency to set it up.

I have found that making both sets of modifications as well as placing a long heat shrink 'hood' over the emitter gives best performance. Using some reflective tape on the surface to be detected gives excellent range, about 1 metre. This makes an excellent optical tacho on a rotating item.

celticJedi
Posts: 4
Joined: Tue Jan 20, 2015 11:16 pm

Re: Obstacle avoidance sensor module (HCMODU0006)

Post by celticJedi » Tue Jan 20, 2015 11:23 pm

Hi, I have just received this module (thanks for the speedy shipment btw) however the GND and EN pins are labelled the opposite way to your photo.
It seems to be a different manufacturer (irBeady I think).
Should I assume the pinout is reversed?
Thanks

admin
Site Admin
Posts: 866
Joined: Sun Aug 05, 2012 4:02 pm

Re: Obstacle avoidance sensor module (HCMODU0006)

Post by admin » Wed Jan 21, 2015 9:04 am

Sorry about this, we switched supplier. The screen print on the module is correct. I've updated the image and pinout in the first post image reflect this.

celticJedi
Posts: 4
Joined: Tue Jan 20, 2015 11:16 pm

Re: Obstacle avoidance sensor module (HCMODU0006)

Post by celticJedi » Wed Jan 21, 2015 9:22 am

excellent, thank you

Scuba_2
Posts: 6
Joined: Thu Dec 11, 2014 7:41 pm

Re: Obstacle avoidance sensor module (HCMODU0006)

Post by Scuba_2 » Thu Dec 15, 2016 12:35 am

I'm lost with my module
How do you set the pots?
I assume one turned up the led brightness ?
Only seem to be able to,detect things one inch away.

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: Obstacle avoidance sensor module (HCMODU0006)

Post by andrew » Thu Dec 15, 2016 11:34 am

I've just added an FAQ to the first post that will give you more information on how to set up the sensor. This includes a suggestion on how to set it up to get the maximum range. Under normal conditions you should defiantly be getting a much greater distance than 1 inch.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

Post Reply

Return to “Sensors”