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.