Medium sensor