IR LED sensor design

Need to make an object detection system, and while using a classic IR obstacle avoid sensor, I get what I want. But, I wanted to make it more compact, so I designed a PCB with smaller LEDs while using the Waveshare schematic:

The idea is to set the threshold with a pot so there is an LED just like in the original schematic. What I get is, it does not work, as when I turn the pot, it lights the LED in a lower position without any object in front. But I can not make it detect any object no matter the pot position. I printed the 3D housing to separate two LEDs, but no luck. LEDs are positioned some 1mm next to each other, but I separated them with a 4mm height of a 3D printed housing.

This is my schematic and components:

Can someone point me out what I did wrong?

Thanks

Can you show the schematic of the module you used as a template for your design ?

Can you measure the voltage across LED4. It should probably be between about 1.2v and 1.6v depending on the light source.

The LM393 is an open collector output. You will need a pull up resistor to observe a change at the output.

Additionally some hysteresis may help too.

Let us know how you get on :slight_smile:

It is in the first post. The link to Waveshare. I will check the voltage tomorrow.

Waveshare does not use it, and it works.

But, I am all ears.

So it is. Sorry. But you appear to have used a LED (LED4) in place a phototransistor (Q1) :

Show also the code that you are using. It may be that you have enabled the internal pin pull up resistor.

The '393 output is :slight_smile:
image
That output transistor can sink current or not sink current. For a change of state to be detected there needs to be some load. Typically a pull up resistor, but could be something else of course; LED or another transistor.
How is the output of the comparator monitored in the Waveshare schematic? Sticking a 'oscope probe, for example, on that output will not see any significant change. You may see a few mV only due to leakage,

No, LED4 is a photodiode. The one from the above link. U2 is IR LED.

There is no code as there is no MCU. I just want to get LED attached on ch0 ON or OFF. That OUTA should go HIGH if INA- and INA+ are in correlation with the pot and IR Receiver (photodiode).

My bad, I missed the LED from the schematic when I crop it. Sorry.
There is an LED on ch0. That one should be ON when there is the detection of IR. On a PCB there are only those components, and two wires to a bench power supply. Nothing else. It should turn the LED ON when there is detection. The distance should be set with the pot.
I double-checked if I soldered them wrong. Not sure what else to check.
How to see if the IR transmits? To eliminate one thing.

Phone camera. Older cheeper phones tend to have weaker IR filter so they see IR better.

1 Like

Back to the "IR receiver", that is the component labeled Q1 on the Waveshare circuit and LED4 on your circuit. Q1 appears, from the symbol used, to be a photo transistor. LED4 appears, again from the symbol, to be a photo diode.
A photo transistor and a photo diode behave differently from each other and require different circuits. The photo transistor conducts in the presence of light and, in that circuit, will tend to pull INA+ of the comparator down. The photo diode (or indeed an IR LED) generates a small voltage (photovoltaic effect) in the presence of light and, in that circuit, will allow INA+ of the comparator to be pulled up.
What is the part number of your LED4 ?

I get your point, but...

With this:

and this:

In the same schematic, it works.

You asked for the LED4 part number. I was 100% sure I posted this link, too:

I just tried on LCSC, but couldn't find a phototransistor. Not sure what else to type in the search box. I must try to use this Waveshare sensor to check my design, by covering the photo receiver. To try to receive the IR from one to another board. Just to eliminate one thing.

This phototransistor appears to be available on LCSC: TEMT1020
Your circuit may work with using a photo diode (or even an IR LED which also responds to IR light) but then the resistor is probably too low. Maybe it would be more responsive with 100k. You'd also have to accept the inversion (or swap the positions of the resistor and the diode).

Edit
This, which you have quoted, is called a photo transistor in parts of the data sheet:

Be aware that a photo transistor and a photo diode have different schematic symbols and it will cause confusion if the wrong one is used.

As it is much easier to get new components than to order new PCB, I will get a few of those:

They fit on 1206 footprint on PCB.

Meanwhile, any suggestions on what can I do with the current design and components?

I am back to this issue.

I did some tests just to try to trace the problem

So what I did?
I have a few of those IR line-tracking modules (https://www.aliexpress.com/item/32607777515.html).
I tried to "see" with my phone camera does the IR emits light. On those modules, it is clear that it is lit. The light from my IR LED (https://www.lcsc.com/product-detail/Infrared-IR-LEDs_XINGLIGHT-XL-3216HIRC-850_C965891.html) can not be seen on my phone, although it is 1206.

The next experiment...
I just put tape on the IR LED of the module and try to see if it can "catch" the IR light from this small IR LED of my design. Nothing.

Then I tried vice versa. Nothing.

As I mentioned earlier, there is no MCU here, only an LED to see if it works. But it doesn't.

Any suggestion on what should I do? Any suggestion to try another design? If so, please point me to which one. I need this in a smaller form factor, but for a range of a few centimeters.

I will try this one tomorrow.

Here are two approaches.

The phototransistor:

The photodiode:

In terms of the photodiode, my schematic is wrong. The IR Receiver (photodiode) should be placed opposite.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.