Connecting a IR break-beam sensor (SEN0503) with a micro:bit

------Question for SEN0503 Please Put your question below------

Hi there, community
I am a STEM teacher trying to help my students with their individual projects. Electronics is not my strongest field – I’m a biologist. So I’d be very happy for some support of some professionals out there.

One of my students want to build a modell soccer goal (10cm wide) which detects a miniature ball that passes the goal line. We work with micro:bits and alternatively mBot(1) microcomputer.

ChatGPT adviced me to use a combination of hall sensors (and put magnets in the ball) and IR break beam sensors. I’ve ordered the latter here at DigiKey. Unfortunately, the micro:bit doesn’t seem to read the signal of the sensor properly. I checked all the connections, the sender is working adn emits IR light, but still it doesn’t work.
Can anybody give me a hint how to proceed?

Thanks a lot,
Beda

Additional information:

I use:
IR break beam sensor (SEN0503)
Micro:bit
Grove shield for micro:bit

Greetings,

The sensor would appear to have what’s known as an open-collector output. These are capable only of sinking or sourcing current depending on type (NPN/PNP) with the result that use of a pull-(up/down) resistor is necessary in order to achieve logic high/low levels at the output. The advantage of this approach is that it simplifies interfacing between devices that may be operating from different power supply voltages.

Try connecting a resistance (most anything between about 1K to 100K will likely suffice) between the output of the sensor and the logic-high reference (typically positive power supply) of your microcontroller platform. Note that many such devices also incorporate this “weak pull up” function internally as an option that can be enabled via software.

Dear Rick
In February you were so friendly to answer to my question.
I had to put my project on hold for some time. Now I try to get back to it.

Since I’m not much into electronics, I’m a little bit lost in the field.

I understand your advice. But I find it difficult to proceed further now. I would have to get such a resistor. Where do I get it? And how to I put it in between the output of the sensor and the power supply? Why is the sensor not equipped with such a resistor in the first place?!

How would other people probably use it? Can you make me an example?

Greetings from Switzerland,
Beda

Entering “Resistor” in the DigiKey search bar is a good first step. Hobby/educational applications tend to prefer the through-hole variety. CF14JT10K0CT-ND would be one among many examples of a reasonable selection.

That’s a choice left to the user. Options might include soldering it in at some convenient place, incorporating it into a wiring harness, using a breadboard/prototype board of some sort, etc.

As mentioned above, an advantage of the technique is simplified interconnection between devices using different supply voltages.

This post discusses the topic, and a search for “open collector” on the engine of your choice should yield numerous results also.