winkj / arduino-sflow

Unoffical arduino driver for Sensirion flow sensors
3 stars 3 forks source link

Switchin Sensor Calibration Fields #5

Open elitortu opened 7 years ago

elitortu commented 7 years ago

I have been successfully using this library for the sensor LG16- 0150D. Referring to the datasheet I realised it is calibrated with both water and isopropanol (IPA), but to get such data the calibration field needs to be changed from CF0 to CF1. " this has to be changed using the Sensirion Viewer Software or using digital commands via the I2C or RS485 interface" according to the datasheet, but I can't seem to figure out how. I am wondering if this has been explored somewhere you can refer or know if it's actually possible (using Arduino). Thanks!

winkj commented 7 years ago

Great timing. We just recently published some more arduino sample code: https://github.com/Sensirion/arduino-liquid-flow-snippets/

There's one which is covering the calibration fields: https://github.com/Sensirion/arduino-liquid-flow-snippets/blob/master/example_10_calibration_field/example_10_calibration_field.ino

Changing lines 108 & 109 to send CF1 should give you the isopropanol calibration.

elitortu commented 7 years ago

That is great, thank you! I can see that the sensor is initialised differently, as I was using flow.init(); and flow.readSample(); from the sensirionflow.h library. Is it possible to still use these and combine with the new coding or would I be better off just replacing/redoing everything? I initially tried to use the sensor with regular I2C commands but couldn't make it work until I found this thread. But I'll se what I can do. Thanks again for pointing in the right direction.

NEWS: So I used the code to read from CF1, and then the original code with flow.init(); and flow.readSample();. It turns out it's now reading correctly for IPA up to 100uL/min. So great news is I can still use my old code after running this one.