> > Would you be upset if we'll start again from the begining with the > > measuring principle ? Of course not! > > The gas sensor is a two-port (four pins) device. I presume > yours too. Actually, mine has 3 pins heater, common, and output. It is like a potentiometer, and it actually varies its resistance with gas concentration. > > There are two major problems (as you pointed): > > 1. the voltage applied to the sensor is not equal with the > voltage you > > may generate from the PIC PWM with full resolution > > > > You have to add hardware (OP AMP) to generate 200-900mV on > the sensor > > with a PWM output of 0-5V (in 1024 or 256 step depending > the requested > > resolution, assuming you still want doing that using the > PWM) Don't > > expect this may be done with one transistor (you've tested already). I wanted to keep the circuit as simple as it is now, but that's not a mandate. What I certanly don't want to do is to make a circuit that has very low efficiency, since it will have to run on batteries > > 2. the voltage generated by the sensor is *not* compatible with the > > full range of the PIC ADC (full ADC resolution) > > > > Again you need maybe a differential amplifier and a reference > > (assuming the sensor has a DC offset) to change the > sensor's signal > > into full ADC range signal. That's not a problem actually. I'm using a 2.5V reference and the accuracy of the measurement is good enough. > > If the problem above are solved, I think you may forget > your parabolic > > equation (which I still don't understand it, what is the "ton" ?). The vrms value of a square wave is given by the square root of the division between the active pulse and the period, all that multiplied by the peak value of the wave. Ton is the "on time" of the signal, the high time, or whatever you'd like to call it. In my system, the PIC measures the peak voltage at the sensor (given by the battery level at the colector of the transistor) and then adjust Ton to give a 0.9 Vrms square wave. That's way I calculate Ton and that's what Ton is. Its actually the duty cicle. > > BTW, why the sensor will react different if polarised with > VRMS than > > polarised with Vpp (peak to peak voltage)? No, it won't. polarizing it with VRMS is a way to keep the efficency higher. I asume that by vpp you mean a DC signal of 0.9 V, right? Regards, Mauricio -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist