Core Electronics Forum

Using ADA2168 5mm Break Beam Leds

I have been experimentling with a PIR and have made a project that takes a photo on my Nikon when movement is detected.

My next project is get my Nikon to takes photo’s when wildlife breaks an infra red beam.

I recently purchased a couple of pairs of those 5mm Infra Red Break Beam sensors from you.
I have written a simple bit of code for a Raspberry Pi using mainly GPIO Zero to get them to work by simply connecting them across 5volts and ground and the data pin of the receiver to a GPIO. Eureka it works.

But for the life of me I cannot get them to work with a Raspberry Pico.
No matter what I do I can’t get the GPIO to detect a state of change.

I surrender. It would have been nice to have used a Pico for my project but a Pi will suffice. Any help or a simple bit of code for a Pico would be welcome.


Hello Dean,

Sounds like a great project!

You mentioned connecting the sensor to 5 volts when using it with the Pi Zero. As you know that your code is working on the Pi Zero, maybe try the sensor on the Pi Zero at 3 volts. If that works, you could then try it on the Pico as you would be supplying around 3 volts as well.

I noticed that on the product page Adafruit suggested it would be better to run it at 5 volts. Perhaps you could use a 5v micro-controller instead?

Hope this helps! :slightly_smiling_face:


Hi Dean,

Hmm, this should be no problem at all. You should be able to power the LED with 5V for more brightness, then use your receiver at 3.3V with an internal or external pull-up resistor on the Pico.

Any chance you could show us what your setup looks like so far?

Keen to help you get to the bottom of this!


Hi Jaden and James, Thanks for the offer of help.
I have managed to get it working.
I am new to Pico and have been following the Button examples in the Raspberry Pico beginners book.
The early button examples did not use the following line but they worked okay.

beamrx.irq(trigger=machine.Pin.IRQ_RISING, handler=beamrx_handler)

Later button examples in the book do use this IRQ line.
So naturally being an old bugger I was confused.

Anyway my code isn’t the best but !
I have my Nikon DSLR taking pictures when the Beam is broken.
I have two GPIO outputs from the Pico that feed a dual Opto Isolator.
One output wakes the camera up, the other after a slight delay takes the picture.

I think you have a really good company in Core Electronics.
The Shop, Customer Service and delivery is excellent.
The website is amazing for information and a great place for learning.
Forums are pretty good too.
Cheers Dean