An update on the project.
I have the sensor up and working with the correct formula.
The temp sensor performs according to specs over the range that I have tested and that range in not too much different than the anticipated operating range. I will use the on board temp sensor.
The only real "trick" is to get the offset. That is, you want the very small difference between the Vgas output in clean air (no CO) and Vref. You can actually just use 0, but I have done a lot of testing on this issue. One thing I learned is that a breadboard circuit and those plug leads are a little flakey for millivolt A2D values. Nevertheless, I have that down and it is about .03-.05 or so. As long as clean air values are less than 1 ppm, I am ok. I am getting +/- .3 so that is ok.
I have also tested averaging 10 values for a read and that seems to increase stability. I can force negative values up to values as high as .5 ppm to zero - I am ok with that. In practice, I only care to display whole numbers. The thing about CO is...
any is bad and none is best. I really want to be notified about >1 ppm.
Moving on...the display.
At first, I thought that I would use one of these 0.91 inch, 128 x 32 mono OLEDs that use an SSD1306 controller. They are cheap and I have used them before. You can get two lines of text/numbers, but it is tiny.
Instead, I went with one of these.
It was just a few bucks....it uses an ST7335S controller and (as though I just can't learn my lesson), they are poorly documented and you can expect to spend more than a few hours getting a driver up and running. But, they are a nice little display for my purpose.
I had given up using a promini or other slow Arduino clone and went with a Teensy LC - a decent board. Their "teensyduino" interface software (lets you use the Arduino IDE) comes with an optimized version of the Adafruit 7735 library which also uses the familiar Adafruit GFX library.
Of course, there is no initialization options for this display...you are pretty much on your own for that. I decided to modify the ST7735_t3.cpp driver file (yes, of course I saved a copy of the original). To make a long story short, I had to figure out and change CASET and RASET and change some starting x/y values - and I did this working off of the existing INITR_MINI160x80 options because that initialization code is closest for what I needed (but it is not that close).
Then, I had to uses options for inversion and rotation. Oh yeah, and one more thing, I had to convert the 5-6-5 RGB colors to BGR, e.g.
Code:
#define ST7735I_ORANGE 0x041f // 0000010000011111 was 0xFC00
On this point, I would say to anybody who is listening - if what I have written makes no sense, then just buy a board that is supported by the driver. Yes, it is more rewarding to buy a dirt cheap display and get it to work, but.....I spent a lot of time on it AND, the right way would have been to write a custom initialization just for this board. Frankly, I just didn't want to do that, although I probably could. So, the display that I used cost US$3.45 including shipping and I bought two of them. The comparable Adafruit board is US$14.95 not including shipping. Yes, there is a difference, but how much is your time worth?
In any event, the driver is working as far as for what I need so I worked on some displays:
and when we are above the lowest threshold, we have a "yellow" alert (up to 1.5 ppm right now)...
...and at 2 ppm on up we have...
In testing, I am happy with the SPI display speed with the Teensy LC.
The display only uses 20 mA and the sensor is very low power. Feeding the Teensy 5V gives me a regulated 3.3V pin out at 100 mA, so I am good even after adding an alarm.
So, onward...need an alarm...move it of the enclosure...test it in real life...enclosure (ugh).
At this point, I want to state up front that this is a project for my own experimentation. With ANY sensor, calibration is necessary. You have to validate your measure with a standard if you want accuracy. Now, this sensor comes with a coded calibration factor for each individual sensor. That is good, but it is not a replacement for actual calibration of the end product.
I don't know how far I will go with that. A few years ago, I would have bugged someone to test it out in "their" calibration chamber - I don't have that capability so easily now. You can buy calibration gas standards and I will see where it goes. My first test, when it is finished, is to see what it reads at some distance from a known CO source (like an engine exhaust).
Remember (if you are reading this and thinking of building your own) CO is some bad stuff, so be mindful and careful.