Photoelectric miniature sensor in place of optical fiber