Component: Grove Water Sensor (101020018) (Grove)

From Flowcode Help
Jump to navigationJump to search


Author Matrix Ltd
Version 1.0 (Release)
Category Grove


Image Grove Water Sensor (101020018) component

The water sensor uses a 1M ohm pull-up resistor. The resistor will pull the sensor trace value high until a drop of water shorts the sensor trace to the ground trace. You can use it with an analog input pin to detect the amount of water in contact between the grounded and sensor traces. It indicates whether the sensor is dry, damp, or completely submerged in water by measuring conductivity.

There are two different macros in order to get the reading as a floating point or as a whole integer. Also, make sure that the water sensor is connected to the right channel in flowcode.

Examples

No additional examples


Downloadable macro reference

GetIntValue

Returns the analog reading as an integer value.

Parameters

This macro has no parameters


Return value

INT


GetFloatValue

Reads the analog value as a floating point value between 0 and 100

Parameters

This macro has no parameters


Return value

FLOAT


Simulation macro reference

This component does not contain any simulation macros


Property reference

Tang Color

This property is of type Color picker and can be referenced with the variable name tang_col.

Colour of the moving part of the slider.

Marker Color

This property is of type Color picker and can be referenced with the variable name mark_col.

Colour of the marker line across the slider tang.

Scope Traces

This property is of type True or false and can be referenced with the variable name ScopeTraces.

Selects if the scope traces are automatically generated or not

Channel

This property is of type Single analog pin and can be referenced with the variable name channel.

Analogue input channel - which pin is the analogue input conected to?

VRef voltage

This property is of type Signed integer and can be referenced with the variable name vrefvol.

Used by the GetVoltage or GetString component macros to take an ADC reading and convert it into a Voltage.

+VRef voltage x 10mV

Default 500 = 5.0V

VRef option

This property is of type Fixed list of ints and can be referenced with the variable name vrefop.

Defines what is used as the ADC maximum reference. ADC Range = GND to VRef Voltage.

VDD - Defines the microcontrollers power supply pin as the max reference,

VREF+ Pin - Dedicated pin on the microcontroller to allow for a variable reference voltage.

Conversion speed

This property is of type Fixed list of ints and can be referenced with the variable name convspd.

Clock setting to select how fast the ADC peripheral will perform an ADC conversion.

The FRC setting is based on a RC time base and so will vary with temperature and pressure.

Other settings are generally based on divisions of the master clock.

Aquisition cycles

This property is of type Signed integer and can be referenced with the variable name actime.

Number of micro seconds to wait for the ACD input to charge before starting the analogue sample.

Bit Depth

This property is of type Signed integer and can be referenced with the variable name bits.

Maximum number of digital bits the ADC can sample.

8 bit = ADC range 0 - 255

10 bit = ADC range 0 - 1023

12 bit = ADC range 0 - 4095