Thursday 16 June 2016

Calibrating DS18B20 sensors to show the same

I have a weather station in our summer house. It currently has a radiation shield made from plastic plates for the thermometer. It's "common knowledge" that if you have more air flow through you sensors it reflects more accurately ambient temperature. So forced airflow with a fan would more likely be better.

I want to test how much better. For this I need thermometers that show exactly the same value in the same temperature. So I'm going to put three sensors in salt water that's heated to about 40 degrees Celsius and then let it cool down to about -20°. Reading sensor values every minute should give a reasonable calibration table.

Motor in the top is for circulating water so I get more accurate results. It's a bit ugly setup but I only plan on using this for one time so I didn't bother with anything fancy.



Or at least that was the plan. 40° -> 20° went well but after I put the whole thing in the freezer all the DS18B20 sensors stopped working. I'm guessing some moisture related problem. I took the setup out of the freezer and let it heat from about -3° that it had cooled to room temperature. I'm probably not going to leave the test running for the winter so that range should be enough.

I used screen to read the values from serial "screen -L /dev/ttyUSB1". As cat seems to stop when arduino takes it's time to boot.

Data is in a Google spreadsheet DS18B20 calibration data.

There are three sensors A, B and C. Here are their maximum differences, and average differences.
A-B A-C B-C
Max difference 0.4375 0.3125 0.2500
Avg difference 0.0537 0.0353 0.0433

I'm thinking that the differences are not that big and I shouldn't worry about them. And some of it is most likely because I put a different amount of hotglue to the sensors to shield them.

Code used can be found in github https://github.com/mika-koivusaari/read_all_ds18b20


Thursday 9 June 2016

Arduino counter

I needed a way to read pulses from our house and geothermal heat pumps electricity meters. Of course there are many pulse counters all ready, but I had make my own:) Just a simple sketch that counts pulses from pins 2 and 3 reports them on the usb serial when asked.


Main meter is read optically with a TSL257 and the geothermal pump meter is directly connect to the meter.

Code in github https://github.com/mika-koivusaari/read_kwh_pulse

I use a python daemon to relay the data to MySql, code again in github https://github.com/mika-koivusaari/read_pulse_mysql