Nonlinear dynamics of a resonant gas sensor