DFREC Class
- ID: dfrec
- Name: Analog Electrical Conductivity (EC) Sensor
- Category: liquid
- Manufacturer: dfrobot
- Connection: analog uart
- Link: https://www.dfrobot.com/index.php?route=product/product&product_id=1123&search=DFR0300&description=true#.Vx49p-_n-M8
The driver was tested with the DFRobot EC Analog Sensor.
This device measure the electrical conductivity of an aqueous solution. The included probe is a K=1 model.
Calibration is somewhat complicated - see the DFRobot wiki for instructions on calibration. Functions are provided to supply the appropriate values. By default, the values used in the DFRobot arduino example are used.
wiki: https://www.dfrobot.com/wiki/index.php/Analog_EC_Meter_SKU:DFR0300
Item Index
Methods
DFREC
-
apin
-
uart_ow
-
device_idx
-
a_ref
DFREC object constructor
Parameters:
-
apin
NumberAnalog pin to use.
-
uart_ow
NumberThe UART that the ds10b20 temperature sensor is connected to.
-
device_idx
NumberThe device index of the ds18b20 sensor to use. If you only have 1 ds18b20 sensor on your DS one wire bus, you would pass 0 here.
-
a_ref
NumberThe analog reference voltage in use
Returns:
dfrec context
update
()
Read the sensor status and update internal state. dfrec_update() must have been called before calling any of the other get*() functions.
setOffset
-
offset
Set sensor offset. This offset is applied to the return EC value before scaling. Default is 0.0.
Parameters:
-
offset
NumberThe offset to apply.
setScale
-
scale
Set sensor scale. The return EC value is scaled by this value before the offset is applied. Default is 1.0.
Parameters:
-
scale
NumberThe scale to apply.
getEC
()
Number
Get computed EC (ms/cm) value from the sensor. update() must have been called prior to calling this function.
Returns:
EC value in ms/cm.
getVolts
()
Number
Get the measured volts from the sensor. update() must have been called prior to calling this function.
Returns:
The voltage measurement.
getNormalized
()
Number
Get the normalized ADC value from the sensor. update() must have been called prior to calling this function.
Returns:
The normalized ADC value.
getTemperature
()
Number
Get the measured temperature from the temperature sensor. The return value will be in Celsius.
Returns:
temperature read from the sensor in Celsius.
setThresholdMinMax
-
min
-
max
Set the global threshold min and max values. See the DFRobot wiki for details.
Parameters:
-
min
NumberMinimum threshold to be valid. Default 150.
-
max
NumberMaximum threshold to be valid. Default 3300.
setThreshold1
-
thres
-
scale
-
offset
Set the threshold 1 values. See the DFRobot wiki for details.
Parameters:
-
thres
NumberThreshold maximum for value section 1. Default 448.
-
scale
NumberScale for value section 1. Default 6.64.
-
offset
NumberOffset for value section 1. Default -64.32.
setThreshold2
-
thres
-
scale
-
offset
Set the threshold 2 values. See the DFRobot wiki for details.
Parameters:
-
thres
NumberThreshold maximum for value section 2. Default 1457.
-
scale
NumberScale for value section 2. Default 6.98.
-
offset
NumberOffset for value section 2. Default -127.0.
setThreshold3
-
scale
-
offset
Set the threshold 3 values. See the DFRobot wiki for details.
Parameters:
-
scale
NumberScale for value section 3. Default 5.3.
-
offset
NumberOffset for value section 3. Default 2278.