I picture a hole at the bottom of the bin, large enough for the largest pill when a sliding cover permits.
Below is a cup to contain the smallest pill, yet the largest pill can sit on the top edge.
The cup is too small to contain two pills.
The cup is held up on a pedestal or a wire. A clear cup allows you to detect optically whether the cup contains a pill.
If you create the right clearances, only one pill drops through the hole, then the cover returns into place. If a second pill drops, it falls off the pedestal. leaving only one pill in the cup.