Does that mean i got 2 keep tweaking it for different liquids as well???So every liquid got to be held at a fixed angle at which it works?????
That is a possibility, but you have not characterized the problem well enough to say with certainty. That is not a criticism, only a fact.
First off, from the nature of this and related threads, I gained the impression that the most important aspect of the project was the programming and electronic aspects. The requirements specified in the problem with respect to using IR and reflection did not leave a lot of room for experimentation and change, e.g., using TOF. With respect to the programming, it appears you are almost finished.
As for the problems you are having with reflection, I suspect you have studied Snell's Law and know that the angle of the light rays relative to the normal will change dependent on the refractive index of the liquid. If not, see here:
**broken link removed**
In sum, with an IR-opaque material like your white liquid or hard surface, you detect reflection from the surface only and the apparatus works. If the liquid is not opaque, you are getting reflections from other surfaces/interfaces and your measured values vary. If you trace some hypothetical light rays,
you will see how your results could vary with different container dimensions and liquid refractive indices. In fact, with a little design and use of a slit, you could probably use your detector to measure refractive index.
Suggestions:
1) Talk with the lecturer/professor and describe what you are observing. Find out whether the apparatus is actually supposed to work or whether the programming and electronic part is all you need to get done.
2) If it must work, then find out whether a "floater" would violate the rules. I mentioned on another forum that I think a plate will work better than ping pong balls.
3) If it must work, and you cannot use a floater, then play with the geometry. Do some pencil and paper drawings or use one of the programs on the Internet for ray tracing. My guess is that you may be able to get it to function by defining a minimum diameter for the vessel and placing the IR-emitter and detector further apart. That may not be practical because of the unitized construction of your detector. However, you still might be able to use your current detector, if you add some front-surface mirrors. For example, you could bounce the beam obliquely off the liquid surface to get total reflection within a range of reasonable values of refractive index, THEN use one or more front-surface mirror(s) to reflect the beam back to the detector side of the module. As a rough guess, one mirror would be virtually on the opposite side of the small tank and the others would reflect the beam from that mirror to the detector.
In any event, #3 is clearly the most difficult option and may not be necessary, if the lecturer agrees with #1 or #2.
John