Assuming this is really short-range stuff, I am genuinely surprised that you can't get a little break-beam to work.
Black tubing will be almost useless with high ambient background light.
Though this depends on the absolute distances involved.
Many blacks appear white to an infra-red sensor.
And, regardless, there will be a lot of internal reflections with a simple tube.
I have shown a better way of shielding below using
baffles.
This method is commonly used in refractor
telescopes.
NOTE: That a plastic Photo-transistor will have to be shielded ALL THE WAY ROUND the back from ambient light.
In this diagram, washers (as in nuts & bolts) can be used as
baffles in a fatter tube.
Some matte black aerosol spray paint is a good near-IR absorber.
I found rough matte black anodising very good, but a little tricky for this
If you still have problems with ambient light, here are a couple of points:-
1. Photo-diodes have a much greater dynamic range than photo-transistors.
Photo-transistors saturate easily, so, for high ambient light apps, always use photo-Ds.
They will still need shielding/shrouding to get the best SIGNAL:NOISE ratio - as that is what you are after.
Modulating/demodulating is by far the best.
It is easier to 'pick out' an AC signal sitting on a DC (ambient), rather than a tiny change in DC (i.e. a signal sitting on ambient).
This would, however, require a bit more electronics to make effective, so maybe a little OTT for this little app.
But, for simple, very short range stuff, where shrouding/shieldng is easy then photo-tr should be perfectly good.
2. Using a pukka receiver module.
This is the most convenient as it will have the photo-DIODE (note), demod, amp and o/p stage all in a neat box.
Be aware, they tend to be wide-angle reception with AGC, so will need shrouding,sheilding too.
Why? To improve S/N and also to stop your signal 'creeping around the edges' or bounced off things.
I daresay, for
thin card, that if you have your LED too bright then the AGC may be high enough to
see it through the card. This WILL require some experimenatation by you. So, if it does then increase the Res to your LED. It may be fine but jut
remember this point.
Yes, as said, you will need a secondary supplier to produce the 38kHz LED 'carrier' signal.
I, too, would try a 555 or similar astable (if on a budget) to provide it.
No modulation of that carrier would be needed here I ASSUME. It is simple on/off yes??
Right, that's your homework done, whats next