Coldframe monitoring with an ESP8266 (2)

In an earlier post, I described a Coldframe that was being monitored by an ESP8266. Though I was quite happy with the result, I did learn a few things that I would do different with a new ColdFrame, which I now have built.
I made the following changes:
I ditched the HTU21D sensor as I found it unreliable. I replaced it with a DS18B20. I defaulted on measuring the humidity as it did not add much value as it is usually pretty high.

I replaced the PCF8591 with an ADS1015 because it has a much faster conversion time. The ADS1015 works a bit different from the PCF8591. The PCF is an 8 bit ADC. If you feed it with 3.3Volts then the max readout of 256 is 3.3Volt. If you feed it with 5Volt, a readout of 256 means 5 Volt.
That is not how the ADS1015 works. It is a 12 bit ADC so the max analog reading is 4096, but that does not represent the Vcc. In it’s default state a reading of 4096 means 4.096 Volts, regardless whether the Vcc is 3V3 or 5Volt. The problem I faced with this is that the datasheet is rather unclear on this point. The datasheet claims that in its default state the max reading is 4.096 Volt, but that the LSB is 2mV. However, if the max analog reading is 4096 (the max 12 bit number) and that represents 4.096 Volt, the LSB should be 1mV. The description in the Sparkfun library examples makes it even more obscure as it says:

*at default gain setting of 1 (and 3.3V VCC), 0-2V will read 0-2047.
*anything greater than 2V will read 2047

This seems rather odd and illogical and also contradictory to what they claim in another example. Sure it fits with the ‘2mV/LSB’ but why would it not read any voltage over 2 Volt? A quick test setup shows that with 3V3 as Vcc and as input, the ADC reading is 1655, which would suggest indeed a 2mV/LSB, but that also means that the max reading of 2047 for 2 Volt is not correct and that the reading still can indicate more than 2 Volt. If I set the programmable gain at 2/3, then according to the datasheet is 3mV/LSB. My test setup showed a reading of 1100 for 3v3, which is indeed a 3mV/LSB, but a full 12Bit reading should be 12.288Volt, not 6.144 Volt as the datasheet says. Mind you though that input on the ADC should never exceed the Vcc.

I did away with the fan that could blow air out and replaced it with a fan that would just use for an internal air-stream. I have hesitated to put any control buttons on the interface and maybe go for all automatic. Especially the fan that now has become an internal fan would be best to always leave on as airflow is good for plants under any circumstance.
I have added a fan to blow air through an underground pipe, to get rid of hot air during the day and pull out warm air during the night, and perhaps that is best handled automatic also. I also added a heater, to keep the temperature above zero degrees if necessary, and perhaps that is best left fully automatic as well.
That leaves the lid opener. It functions pretty well in all it’s simplicity, but as the now added heatsink, appears to manage keeping the temperature below 20 degrees centigrade (=68 F), I ditched it.