New sensor could help prevent food waste