Detecting coins using optical sensing