Hello!
This is just a thought swapping topic really, no real circuitry or code problems.
I've been working on a basic coin detector using IR. Probably not the smartest move.
So I started with a IR Tx and Photodiode behind a misted lense to get the value of IF light that each coin blocked. Worked well for some coins depending on where the IR Tx was positioned - eg it could detect larger coins but not the smaller ones. Changed that Tx position to be lower down, it would detect the smaller coins but then all the larger ones had a bit of an IR shadow and all blurred into similar readings. Also here in the UK we have some coins which are dirty and others that look brand new which reflect more IR light and thus lower the amount the photodiode can see.
So I tried going by timings to see how long it took each coin to roll past. This initially looked promising though I did have a little gotcha with variables that didn't seem to want to update, once I got that worked out I then noticed that the larger coins that we have (2p, 50p, £2 for instance) were still having similar time readings and worse, frequently they would swap around - a coin that had a higher reading would then have the lowest reading.
So, I've now switched to two pairs of IR gates with the IR being passed through small holes of 2mm instead of the default 5mm that the diode packages come in. They are 6cm apart and yet I am still seeing the same problem. A small 5p coin can take more or less time than the largest £2 coin which is a little annoying to say the least! Given that I'm seeing this problem and that the numbers vary so wildly (eg sometimes 160ms and other 380) I don't see interrupts really solving this very well for me or the use of micros(). I suspect the photdiode reaction times simply aren't quick enough.
I know that commercial coin acceptors use light beams and magnetic fields to determine speed and material density to identify the coins and so I'm not completely surprised that similar sized coins have similar results and figured that the magnetic field readings is the next reliable way to differentiate between them after size - in other words, size rules out the wrong coins leaving the remaining ones to be ruled out by magnetic readings.
Problem is I have no coils or old speakers to take enamelled wire from and no real idea of how to go about this without a scope either!
So, are there any other simple tricks I can use with IR to determine the size of my coins which work around reflections and timing inaccuracies? - or any other similar techniques using simple to find materials / sensors that I might have laying about?