A differential optical sensor for long-term monitoring of chemicals