Design of optic sensor for hydrocarbon detection