Remarks
Capacitive | |
---|---|
Status | |
Source code | GitHub |
NuGet package |
Capacitive Soil Moisture sensor is a simple breakout for measuring the moisture in soil and similar materials. This sensor measures moisture levels by capacitive sensing, rather then resistive sensing like other types of moisture sensor such as the FC-28.
Capacitive sensing means measuring the dielectrum that is formed by the soil and the water is the most important factor that forms the dielectrum. Even though this kind of sensor might be a little pricier, it is made of corrosion resistant material giving it a longer service of life than a resistive sensor.
The following example shows how read the soil moisture every second:
public class MeadowApp : App<F7Micro, MeadowApp>
{
Capacitive _Capacitive;
public MeadowApp()
{
// create a new Capacitive sensor object connected to analog pin A01
_Capacitive = new Capacitive(Device.Pins.A01);
Run();
}
async Task Run()
{
while (true)
{
float moisture = await _Capacitive.Read();
Console.WriteLine($"Moisture: {0}", moisture);
Thread.Sleep(1000);
}
}
}
Sample projects available on GitHub
Code Example
Capacitive capacitive;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
capacitive = new Capacitive(
Device.Pins.A00,
minimumVoltageCalibration: new Voltage(2.84f),
maximumVoltageCalibration: new Voltage(1.63f)
);
// Example that uses an IObservable subscription to only be notified when the moisture changes by filter defined.
var consumer = Capacitive.CreateObserver(
handler: result =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Subscribed - " +
$"new: {result.New}, " +
$"old: {oldValue}");
},
filter: null
);
capacitive.Subscribe(consumer);
// classical .NET events can also be used:
capacitive.MoistureUpdated += (sender, result) =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Updated - New: {result.New}, Old: {oldValue}");
};
//==== One-off reading use case/pattern
ReadSensor().Wait();
capacitive.StartUpdating(TimeSpan.FromMilliseconds(1000));
return Task.CompletedTask;
}
protected async Task ReadSensor()
{
var moisture = await capacitive.Read();
Resolver.Log.Info($"Initial moisture: {moisture:n2}");
}
Sample project(s) available on GitHub
Wiring Example
Syntax
public class Capacitive : SamplingSensorBase<double>, IObservable<IChangeResult<double>>, IMoistureSensor, ISamplingSensor<double>, ISensor<double>, IDisposable
Constructors
Capacitive(IAnalogInputPort, Voltage?, Voltage?)
Creates a Capacitive soil moisture sensor object with the specified AnalogInputPort
Declaration
public Capacitive(IAnalogInputPort analogInputPort, Voltage? minimumVoltageCalibration, Voltage? maximumVoltageCalibration)
Parameters
Type | Name | Description |
---|---|---|
IAnalogInputPort | analogInputPort | The port for the analog input pin |
Voltage? | minimumVoltageCalibration | Minimum calibration voltage |
Voltage? | maximumVoltageCalibration | Maximum calibration voltage |
Remarks
Capacitive | |
---|---|
Status | |
Source code | GitHub |
NuGet package |
Capacitive Soil Moisture sensor is a simple breakout for measuring the moisture in soil and similar materials. This sensor measures moisture levels by capacitive sensing, rather then resistive sensing like other types of moisture sensor such as the FC-28.
Capacitive sensing means measuring the dielectrum that is formed by the soil and the water is the most important factor that forms the dielectrum. Even though this kind of sensor might be a little pricier, it is made of corrosion resistant material giving it a longer service of life than a resistive sensor.
The following example shows how read the soil moisture every second:
public class MeadowApp : App<F7Micro, MeadowApp>
{
Capacitive _Capacitive;
public MeadowApp()
{
// create a new Capacitive sensor object connected to analog pin A01
_Capacitive = new Capacitive(Device.Pins.A01);
Run();
}
async Task Run()
{
while (true)
{
float moisture = await _Capacitive.Read();
Console.WriteLine($"Moisture: {0}", moisture);
Thread.Sleep(1000);
}
}
}
Sample projects available on GitHub
Code Example
Capacitive capacitive;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
capacitive = new Capacitive(
Device.Pins.A00,
minimumVoltageCalibration: new Voltage(2.84f),
maximumVoltageCalibration: new Voltage(1.63f)
);
// Example that uses an IObservable subscription to only be notified when the moisture changes by filter defined.
var consumer = Capacitive.CreateObserver(
handler: result =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Subscribed - " +
$"new: {result.New}, " +
$"old: {oldValue}");
},
filter: null
);
capacitive.Subscribe(consumer);
// classical .NET events can also be used:
capacitive.MoistureUpdated += (sender, result) =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Updated - New: {result.New}, Old: {oldValue}");
};
//==== One-off reading use case/pattern
ReadSensor().Wait();
capacitive.StartUpdating(TimeSpan.FromMilliseconds(1000));
return Task.CompletedTask;
}
protected async Task ReadSensor()
{
var moisture = await capacitive.Read();
Resolver.Log.Info($"Initial moisture: {moisture:n2}");
}
Sample project(s) available on GitHub
Wiring Example
Capacitive(IPin, Voltage?, Voltage?, int, TimeSpan?)
Creates a Capacitive soil moisture sensor object with the specified analog pin and a IO device
Declaration
public Capacitive(IPin analogInputPin, Voltage? minimumVoltageCalibration, Voltage? maximumVoltageCalibration, int sampleCount = 5, TimeSpan? sampleInterval = null)
Parameters
Type | Name | Description |
---|---|---|
IPin | analogInputPin | Analog pin the temperature sensor is connected to |
Voltage? | minimumVoltageCalibration | Minimum calibration voltage |
Voltage? | maximumVoltageCalibration | Maximum calibration voltage |
int | sampleCount | How many samples to take during a given reading |
TimeSpan? | sampleInterval | The time, to wait in between samples during a reading |
Remarks
Capacitive | |
---|---|
Status | |
Source code | GitHub |
NuGet package |
Capacitive Soil Moisture sensor is a simple breakout for measuring the moisture in soil and similar materials. This sensor measures moisture levels by capacitive sensing, rather then resistive sensing like other types of moisture sensor such as the FC-28.
Capacitive sensing means measuring the dielectrum that is formed by the soil and the water is the most important factor that forms the dielectrum. Even though this kind of sensor might be a little pricier, it is made of corrosion resistant material giving it a longer service of life than a resistive sensor.
The following example shows how read the soil moisture every second:
public class MeadowApp : App<F7Micro, MeadowApp>
{
Capacitive _Capacitive;
public MeadowApp()
{
// create a new Capacitive sensor object connected to analog pin A01
_Capacitive = new Capacitive(Device.Pins.A01);
Run();
}
async Task Run()
{
while (true)
{
float moisture = await _Capacitive.Read();
Console.WriteLine($"Moisture: {0}", moisture);
Thread.Sleep(1000);
}
}
}
Sample projects available on GitHub
Code Example
Capacitive capacitive;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
capacitive = new Capacitive(
Device.Pins.A00,
minimumVoltageCalibration: new Voltage(2.84f),
maximumVoltageCalibration: new Voltage(1.63f)
);
// Example that uses an IObservable subscription to only be notified when the moisture changes by filter defined.
var consumer = Capacitive.CreateObserver(
handler: result =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Subscribed - " +
$"new: {result.New}, " +
$"old: {oldValue}");
},
filter: null
);
capacitive.Subscribe(consumer);
// classical .NET events can also be used:
capacitive.MoistureUpdated += (sender, result) =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Updated - New: {result.New}, Old: {oldValue}");
};
//==== One-off reading use case/pattern
ReadSensor().Wait();
capacitive.StartUpdating(TimeSpan.FromMilliseconds(1000));
return Task.CompletedTask;
}
protected async Task ReadSensor()
{
var moisture = await capacitive.Read();
Resolver.Log.Info($"Initial moisture: {moisture:n2}");
}
Sample project(s) available on GitHub
Wiring Example
Properties
AnalogInputPort
Returns the analog input port
Declaration
protected IAnalogInputPort AnalogInputPort { get; }
Property Value
Type | Description |
---|---|
IAnalogInputPort |
Remarks
Capacitive | |
---|---|
Status | |
Source code | GitHub |
NuGet package |
Capacitive Soil Moisture sensor is a simple breakout for measuring the moisture in soil and similar materials. This sensor measures moisture levels by capacitive sensing, rather then resistive sensing like other types of moisture sensor such as the FC-28.
Capacitive sensing means measuring the dielectrum that is formed by the soil and the water is the most important factor that forms the dielectrum. Even though this kind of sensor might be a little pricier, it is made of corrosion resistant material giving it a longer service of life than a resistive sensor.
The following example shows how read the soil moisture every second:
public class MeadowApp : App<F7Micro, MeadowApp>
{
Capacitive _Capacitive;
public MeadowApp()
{
// create a new Capacitive sensor object connected to analog pin A01
_Capacitive = new Capacitive(Device.Pins.A01);
Run();
}
async Task Run()
{
while (true)
{
float moisture = await _Capacitive.Read();
Console.WriteLine($"Moisture: {0}", moisture);
Thread.Sleep(1000);
}
}
}
Sample projects available on GitHub
Code Example
Capacitive capacitive;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
capacitive = new Capacitive(
Device.Pins.A00,
minimumVoltageCalibration: new Voltage(2.84f),
maximumVoltageCalibration: new Voltage(1.63f)
);
// Example that uses an IObservable subscription to only be notified when the moisture changes by filter defined.
var consumer = Capacitive.CreateObserver(
handler: result =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Subscribed - " +
$"new: {result.New}, " +
$"old: {oldValue}");
},
filter: null
);
capacitive.Subscribe(consumer);
// classical .NET events can also be used:
capacitive.MoistureUpdated += (sender, result) =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Updated - New: {result.New}, Old: {oldValue}");
};
//==== One-off reading use case/pattern
ReadSensor().Wait();
capacitive.StartUpdating(TimeSpan.FromMilliseconds(1000));
return Task.CompletedTask;
}
protected async Task ReadSensor()
{
var moisture = await capacitive.Read();
Resolver.Log.Info($"Initial moisture: {moisture:n2}");
}
Sample project(s) available on GitHub
Wiring Example
IsDisposed
Is the object disposed
Declaration
public bool IsDisposed { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
Capacitive | |
---|---|
Status | |
Source code | GitHub |
NuGet package |
Capacitive Soil Moisture sensor is a simple breakout for measuring the moisture in soil and similar materials. This sensor measures moisture levels by capacitive sensing, rather then resistive sensing like other types of moisture sensor such as the FC-28.
Capacitive sensing means measuring the dielectrum that is formed by the soil and the water is the most important factor that forms the dielectrum. Even though this kind of sensor might be a little pricier, it is made of corrosion resistant material giving it a longer service of life than a resistive sensor.
The following example shows how read the soil moisture every second:
public class MeadowApp : App<F7Micro, MeadowApp>
{
Capacitive _Capacitive;
public MeadowApp()
{
// create a new Capacitive sensor object connected to analog pin A01
_Capacitive = new Capacitive(Device.Pins.A01);
Run();
}
async Task Run()
{
while (true)
{
float moisture = await _Capacitive.Read();
Console.WriteLine($"Moisture: {0}", moisture);
Thread.Sleep(1000);
}
}
}
Sample projects available on GitHub
Code Example
Capacitive capacitive;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
capacitive = new Capacitive(
Device.Pins.A00,
minimumVoltageCalibration: new Voltage(2.84f),
maximumVoltageCalibration: new Voltage(1.63f)
);
// Example that uses an IObservable subscription to only be notified when the moisture changes by filter defined.
var consumer = Capacitive.CreateObserver(
handler: result =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Subscribed - " +
$"new: {result.New}, " +
$"old: {oldValue}");
},
filter: null
);
capacitive.Subscribe(consumer);
// classical .NET events can also be used:
capacitive.MoistureUpdated += (sender, result) =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Updated - New: {result.New}, Old: {oldValue}");
};
//==== One-off reading use case/pattern
ReadSensor().Wait();
capacitive.StartUpdating(TimeSpan.FromMilliseconds(1000));
return Task.CompletedTask;
}
protected async Task ReadSensor()
{
var moisture = await capacitive.Read();
Resolver.Log.Info($"Initial moisture: {moisture:n2}");
}
Sample project(s) available on GitHub
Wiring Example
MaximumVoltageCalibration
Voltage value of most moist soil - default of 3.3V
Declaration
public Voltage MaximumVoltageCalibration { get; set; }
Property Value
Type | Description |
---|---|
Voltage |
Remarks
Capacitive | |
---|---|
Status | |
Source code | GitHub |
NuGet package |
Capacitive Soil Moisture sensor is a simple breakout for measuring the moisture in soil and similar materials. This sensor measures moisture levels by capacitive sensing, rather then resistive sensing like other types of moisture sensor such as the FC-28.
Capacitive sensing means measuring the dielectrum that is formed by the soil and the water is the most important factor that forms the dielectrum. Even though this kind of sensor might be a little pricier, it is made of corrosion resistant material giving it a longer service of life than a resistive sensor.
The following example shows how read the soil moisture every second:
public class MeadowApp : App<F7Micro, MeadowApp>
{
Capacitive _Capacitive;
public MeadowApp()
{
// create a new Capacitive sensor object connected to analog pin A01
_Capacitive = new Capacitive(Device.Pins.A01);
Run();
}
async Task Run()
{
while (true)
{
float moisture = await _Capacitive.Read();
Console.WriteLine($"Moisture: {0}", moisture);
Thread.Sleep(1000);
}
}
}
Sample projects available on GitHub
Code Example
Capacitive capacitive;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
capacitive = new Capacitive(
Device.Pins.A00,
minimumVoltageCalibration: new Voltage(2.84f),
maximumVoltageCalibration: new Voltage(1.63f)
);
// Example that uses an IObservable subscription to only be notified when the moisture changes by filter defined.
var consumer = Capacitive.CreateObserver(
handler: result =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Subscribed - " +
$"new: {result.New}, " +
$"old: {oldValue}");
},
filter: null
);
capacitive.Subscribe(consumer);
// classical .NET events can also be used:
capacitive.MoistureUpdated += (sender, result) =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Updated - New: {result.New}, Old: {oldValue}");
};
//==== One-off reading use case/pattern
ReadSensor().Wait();
capacitive.StartUpdating(TimeSpan.FromMilliseconds(1000));
return Task.CompletedTask;
}
protected async Task ReadSensor()
{
var moisture = await capacitive.Read();
Resolver.Log.Info($"Initial moisture: {moisture:n2}");
}
Sample project(s) available on GitHub
Wiring Example
MinimumVoltageCalibration
Voltage value of most dry soil - default is 0 volts
Declaration
public Voltage MinimumVoltageCalibration { get; set; }
Property Value
Type | Description |
---|---|
Voltage |
Remarks
Capacitive | |
---|---|
Status | |
Source code | GitHub |
NuGet package |
Capacitive Soil Moisture sensor is a simple breakout for measuring the moisture in soil and similar materials. This sensor measures moisture levels by capacitive sensing, rather then resistive sensing like other types of moisture sensor such as the FC-28.
Capacitive sensing means measuring the dielectrum that is formed by the soil and the water is the most important factor that forms the dielectrum. Even though this kind of sensor might be a little pricier, it is made of corrosion resistant material giving it a longer service of life than a resistive sensor.
The following example shows how read the soil moisture every second:
public class MeadowApp : App<F7Micro, MeadowApp>
{
Capacitive _Capacitive;
public MeadowApp()
{
// create a new Capacitive sensor object connected to analog pin A01
_Capacitive = new Capacitive(Device.Pins.A01);
Run();
}
async Task Run()
{
while (true)
{
float moisture = await _Capacitive.Read();
Console.WriteLine($"Moisture: {0}", moisture);
Thread.Sleep(1000);
}
}
}
Sample projects available on GitHub
Code Example
Capacitive capacitive;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
capacitive = new Capacitive(
Device.Pins.A00,
minimumVoltageCalibration: new Voltage(2.84f),
maximumVoltageCalibration: new Voltage(1.63f)
);
// Example that uses an IObservable subscription to only be notified when the moisture changes by filter defined.
var consumer = Capacitive.CreateObserver(
handler: result =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Subscribed - " +
$"new: {result.New}, " +
$"old: {oldValue}");
},
filter: null
);
capacitive.Subscribe(consumer);
// classical .NET events can also be used:
capacitive.MoistureUpdated += (sender, result) =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Updated - New: {result.New}, Old: {oldValue}");
};
//==== One-off reading use case/pattern
ReadSensor().Wait();
capacitive.StartUpdating(TimeSpan.FromMilliseconds(1000));
return Task.CompletedTask;
}
protected async Task ReadSensor()
{
var moisture = await capacitive.Read();
Resolver.Log.Info($"Initial moisture: {moisture:n2}");
}
Sample project(s) available on GitHub
Wiring Example
Moisture
Last value read from the moisture sensor
Declaration
public double? Moisture { get; protected set; }
Property Value
Type | Description |
---|---|
double? |
Remarks
Capacitive | |
---|---|
Status | |
Source code | GitHub |
NuGet package |
Capacitive Soil Moisture sensor is a simple breakout for measuring the moisture in soil and similar materials. This sensor measures moisture levels by capacitive sensing, rather then resistive sensing like other types of moisture sensor such as the FC-28.
Capacitive sensing means measuring the dielectrum that is formed by the soil and the water is the most important factor that forms the dielectrum. Even though this kind of sensor might be a little pricier, it is made of corrosion resistant material giving it a longer service of life than a resistive sensor.
The following example shows how read the soil moisture every second:
public class MeadowApp : App<F7Micro, MeadowApp>
{
Capacitive _Capacitive;
public MeadowApp()
{
// create a new Capacitive sensor object connected to analog pin A01
_Capacitive = new Capacitive(Device.Pins.A01);
Run();
}
async Task Run()
{
while (true)
{
float moisture = await _Capacitive.Read();
Console.WriteLine($"Moisture: {0}", moisture);
Thread.Sleep(1000);
}
}
}
Sample projects available on GitHub
Code Example
Capacitive capacitive;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
capacitive = new Capacitive(
Device.Pins.A00,
minimumVoltageCalibration: new Voltage(2.84f),
maximumVoltageCalibration: new Voltage(1.63f)
);
// Example that uses an IObservable subscription to only be notified when the moisture changes by filter defined.
var consumer = Capacitive.CreateObserver(
handler: result =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Subscribed - " +
$"new: {result.New}, " +
$"old: {oldValue}");
},
filter: null
);
capacitive.Subscribe(consumer);
// classical .NET events can also be used:
capacitive.MoistureUpdated += (sender, result) =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Updated - New: {result.New}, Old: {oldValue}");
};
//==== One-off reading use case/pattern
ReadSensor().Wait();
capacitive.StartUpdating(TimeSpan.FromMilliseconds(1000));
return Task.CompletedTask;
}
protected async Task ReadSensor()
{
var moisture = await capacitive.Read();
Resolver.Log.Info($"Initial moisture: {moisture:n2}");
}
Sample project(s) available on GitHub
Wiring Example
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Remarks
Capacitive | |
---|---|
Status | |
Source code | GitHub |
NuGet package |
Capacitive Soil Moisture sensor is a simple breakout for measuring the moisture in soil and similar materials. This sensor measures moisture levels by capacitive sensing, rather then resistive sensing like other types of moisture sensor such as the FC-28.
Capacitive sensing means measuring the dielectrum that is formed by the soil and the water is the most important factor that forms the dielectrum. Even though this kind of sensor might be a little pricier, it is made of corrosion resistant material giving it a longer service of life than a resistive sensor.
The following example shows how read the soil moisture every second:
public class MeadowApp : App<F7Micro, MeadowApp>
{
Capacitive _Capacitive;
public MeadowApp()
{
// create a new Capacitive sensor object connected to analog pin A01
_Capacitive = new Capacitive(Device.Pins.A01);
Run();
}
async Task Run()
{
while (true)
{
float moisture = await _Capacitive.Read();
Console.WriteLine($"Moisture: {0}", moisture);
Thread.Sleep(1000);
}
}
}
Sample projects available on GitHub
Code Example
Capacitive capacitive;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
capacitive = new Capacitive(
Device.Pins.A00,
minimumVoltageCalibration: new Voltage(2.84f),
maximumVoltageCalibration: new Voltage(1.63f)
);
// Example that uses an IObservable subscription to only be notified when the moisture changes by filter defined.
var consumer = Capacitive.CreateObserver(
handler: result =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Subscribed - " +
$"new: {result.New}, " +
$"old: {oldValue}");
},
filter: null
);
capacitive.Subscribe(consumer);
// classical .NET events can also be used:
capacitive.MoistureUpdated += (sender, result) =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Updated - New: {result.New}, Old: {oldValue}");
};
//==== One-off reading use case/pattern
ReadSensor().Wait();
capacitive.StartUpdating(TimeSpan.FromMilliseconds(1000));
return Task.CompletedTask;
}
protected async Task ReadSensor()
{
var moisture = await capacitive.Read();
Resolver.Log.Info($"Initial moisture: {moisture:n2}");
}
Sample project(s) available on GitHub
Wiring Example
Dispose(bool)
Dispose of the object
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | Is disposing |
Remarks
Capacitive | |
---|---|
Status | |
Source code | GitHub |
NuGet package |
Capacitive Soil Moisture sensor is a simple breakout for measuring the moisture in soil and similar materials. This sensor measures moisture levels by capacitive sensing, rather then resistive sensing like other types of moisture sensor such as the FC-28.
Capacitive sensing means measuring the dielectrum that is formed by the soil and the water is the most important factor that forms the dielectrum. Even though this kind of sensor might be a little pricier, it is made of corrosion resistant material giving it a longer service of life than a resistive sensor.
The following example shows how read the soil moisture every second:
public class MeadowApp : App<F7Micro, MeadowApp>
{
Capacitive _Capacitive;
public MeadowApp()
{
// create a new Capacitive sensor object connected to analog pin A01
_Capacitive = new Capacitive(Device.Pins.A01);
Run();
}
async Task Run()
{
while (true)
{
float moisture = await _Capacitive.Read();
Console.WriteLine($"Moisture: {0}", moisture);
Thread.Sleep(1000);
}
}
}
Sample projects available on GitHub
Code Example
Capacitive capacitive;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
capacitive = new Capacitive(
Device.Pins.A00,
minimumVoltageCalibration: new Voltage(2.84f),
maximumVoltageCalibration: new Voltage(1.63f)
);
// Example that uses an IObservable subscription to only be notified when the moisture changes by filter defined.
var consumer = Capacitive.CreateObserver(
handler: result =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Subscribed - " +
$"new: {result.New}, " +
$"old: {oldValue}");
},
filter: null
);
capacitive.Subscribe(consumer);
// classical .NET events can also be used:
capacitive.MoistureUpdated += (sender, result) =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Updated - New: {result.New}, Old: {oldValue}");
};
//==== One-off reading use case/pattern
ReadSensor().Wait();
capacitive.StartUpdating(TimeSpan.FromMilliseconds(1000));
return Task.CompletedTask;
}
protected async Task ReadSensor()
{
var moisture = await capacitive.Read();
Resolver.Log.Info($"Initial moisture: {moisture:n2}");
}
Sample project(s) available on GitHub
Wiring Example
RaiseEventsAndNotify(IChangeResult<double>)
Raise change events for subscribers
Declaration
protected override void RaiseEventsAndNotify(IChangeResult<double> changeResult)
Parameters
Type | Name | Description |
---|---|---|
IChangeResult<double> | changeResult | The change result with the current sensor data |
Overrides
Remarks
Capacitive | |
---|---|
Status | |
Source code | GitHub |
NuGet package |
Capacitive Soil Moisture sensor is a simple breakout for measuring the moisture in soil and similar materials. This sensor measures moisture levels by capacitive sensing, rather then resistive sensing like other types of moisture sensor such as the FC-28.
Capacitive sensing means measuring the dielectrum that is formed by the soil and the water is the most important factor that forms the dielectrum. Even though this kind of sensor might be a little pricier, it is made of corrosion resistant material giving it a longer service of life than a resistive sensor.
The following example shows how read the soil moisture every second:
public class MeadowApp : App<F7Micro, MeadowApp>
{
Capacitive _Capacitive;
public MeadowApp()
{
// create a new Capacitive sensor object connected to analog pin A01
_Capacitive = new Capacitive(Device.Pins.A01);
Run();
}
async Task Run()
{
while (true)
{
float moisture = await _Capacitive.Read();
Console.WriteLine($"Moisture: {0}", moisture);
Thread.Sleep(1000);
}
}
}
Sample projects available on GitHub
Code Example
Capacitive capacitive;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
capacitive = new Capacitive(
Device.Pins.A00,
minimumVoltageCalibration: new Voltage(2.84f),
maximumVoltageCalibration: new Voltage(1.63f)
);
// Example that uses an IObservable subscription to only be notified when the moisture changes by filter defined.
var consumer = Capacitive.CreateObserver(
handler: result =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Subscribed - " +
$"new: {result.New}, " +
$"old: {oldValue}");
},
filter: null
);
capacitive.Subscribe(consumer);
// classical .NET events can also be used:
capacitive.MoistureUpdated += (sender, result) =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Updated - New: {result.New}, Old: {oldValue}");
};
//==== One-off reading use case/pattern
ReadSensor().Wait();
capacitive.StartUpdating(TimeSpan.FromMilliseconds(1000));
return Task.CompletedTask;
}
protected async Task ReadSensor()
{
var moisture = await capacitive.Read();
Resolver.Log.Info($"Initial moisture: {moisture:n2}");
}
Sample project(s) available on GitHub
Wiring Example
ReadSensor()
Reads data from the sensor
Declaration
protected override Task<double> ReadSensor()
Returns
Type | Description |
---|---|
Task<double> | The latest sensor reading |
Overrides
Remarks
Capacitive | |
---|---|
Status | |
Source code | GitHub |
NuGet package |
Capacitive Soil Moisture sensor is a simple breakout for measuring the moisture in soil and similar materials. This sensor measures moisture levels by capacitive sensing, rather then resistive sensing like other types of moisture sensor such as the FC-28.
Capacitive sensing means measuring the dielectrum that is formed by the soil and the water is the most important factor that forms the dielectrum. Even though this kind of sensor might be a little pricier, it is made of corrosion resistant material giving it a longer service of life than a resistive sensor.
The following example shows how read the soil moisture every second:
public class MeadowApp : App<F7Micro, MeadowApp>
{
Capacitive _Capacitive;
public MeadowApp()
{
// create a new Capacitive sensor object connected to analog pin A01
_Capacitive = new Capacitive(Device.Pins.A01);
Run();
}
async Task Run()
{
while (true)
{
float moisture = await _Capacitive.Read();
Console.WriteLine($"Moisture: {0}", moisture);
Thread.Sleep(1000);
}
}
}
Sample projects available on GitHub
Code Example
Capacitive capacitive;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
capacitive = new Capacitive(
Device.Pins.A00,
minimumVoltageCalibration: new Voltage(2.84f),
maximumVoltageCalibration: new Voltage(1.63f)
);
// Example that uses an IObservable subscription to only be notified when the moisture changes by filter defined.
var consumer = Capacitive.CreateObserver(
handler: result =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Subscribed - " +
$"new: {result.New}, " +
$"old: {oldValue}");
},
filter: null
);
capacitive.Subscribe(consumer);
// classical .NET events can also be used:
capacitive.MoistureUpdated += (sender, result) =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Updated - New: {result.New}, Old: {oldValue}");
};
//==== One-off reading use case/pattern
ReadSensor().Wait();
capacitive.StartUpdating(TimeSpan.FromMilliseconds(1000));
return Task.CompletedTask;
}
protected async Task ReadSensor()
{
var moisture = await capacitive.Read();
Resolver.Log.Info($"Initial moisture: {moisture:n2}");
}
Sample project(s) available on GitHub
Wiring Example
StartUpdating(TimeSpan?)
Starts continuously sampling the sensor
Declaration
public override void StartUpdating(TimeSpan? updateInterval)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan? | updateInterval |
Overrides
Remarks
Capacitive | |
---|---|
Status | |
Source code | GitHub |
NuGet package |
Capacitive Soil Moisture sensor is a simple breakout for measuring the moisture in soil and similar materials. This sensor measures moisture levels by capacitive sensing, rather then resistive sensing like other types of moisture sensor such as the FC-28.
Capacitive sensing means measuring the dielectrum that is formed by the soil and the water is the most important factor that forms the dielectrum. Even though this kind of sensor might be a little pricier, it is made of corrosion resistant material giving it a longer service of life than a resistive sensor.
The following example shows how read the soil moisture every second:
public class MeadowApp : App<F7Micro, MeadowApp>
{
Capacitive _Capacitive;
public MeadowApp()
{
// create a new Capacitive sensor object connected to analog pin A01
_Capacitive = new Capacitive(Device.Pins.A01);
Run();
}
async Task Run()
{
while (true)
{
float moisture = await _Capacitive.Read();
Console.WriteLine($"Moisture: {0}", moisture);
Thread.Sleep(1000);
}
}
}
Sample projects available on GitHub
Code Example
Capacitive capacitive;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
capacitive = new Capacitive(
Device.Pins.A00,
minimumVoltageCalibration: new Voltage(2.84f),
maximumVoltageCalibration: new Voltage(1.63f)
);
// Example that uses an IObservable subscription to only be notified when the moisture changes by filter defined.
var consumer = Capacitive.CreateObserver(
handler: result =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Subscribed - " +
$"new: {result.New}, " +
$"old: {oldValue}");
},
filter: null
);
capacitive.Subscribe(consumer);
// classical .NET events can also be used:
capacitive.MoistureUpdated += (sender, result) =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Updated - New: {result.New}, Old: {oldValue}");
};
//==== One-off reading use case/pattern
ReadSensor().Wait();
capacitive.StartUpdating(TimeSpan.FromMilliseconds(1000));
return Task.CompletedTask;
}
protected async Task ReadSensor()
{
var moisture = await capacitive.Read();
Resolver.Log.Info($"Initial moisture: {moisture:n2}");
}
Sample project(s) available on GitHub
Wiring Example
StopUpdating()
Stops sampling the sensor
Declaration
public override void StopUpdating()
Overrides
Remarks
Capacitive | |
---|---|
Status | |
Source code | GitHub |
NuGet package |
Capacitive Soil Moisture sensor is a simple breakout for measuring the moisture in soil and similar materials. This sensor measures moisture levels by capacitive sensing, rather then resistive sensing like other types of moisture sensor such as the FC-28.
Capacitive sensing means measuring the dielectrum that is formed by the soil and the water is the most important factor that forms the dielectrum. Even though this kind of sensor might be a little pricier, it is made of corrosion resistant material giving it a longer service of life than a resistive sensor.
The following example shows how read the soil moisture every second:
public class MeadowApp : App<F7Micro, MeadowApp>
{
Capacitive _Capacitive;
public MeadowApp()
{
// create a new Capacitive sensor object connected to analog pin A01
_Capacitive = new Capacitive(Device.Pins.A01);
Run();
}
async Task Run()
{
while (true)
{
float moisture = await _Capacitive.Read();
Console.WriteLine($"Moisture: {0}", moisture);
Thread.Sleep(1000);
}
}
}
Sample projects available on GitHub
Code Example
Capacitive capacitive;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
capacitive = new Capacitive(
Device.Pins.A00,
minimumVoltageCalibration: new Voltage(2.84f),
maximumVoltageCalibration: new Voltage(1.63f)
);
// Example that uses an IObservable subscription to only be notified when the moisture changes by filter defined.
var consumer = Capacitive.CreateObserver(
handler: result =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Subscribed - " +
$"new: {result.New}, " +
$"old: {oldValue}");
},
filter: null
);
capacitive.Subscribe(consumer);
// classical .NET events can also be used:
capacitive.MoistureUpdated += (sender, result) =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Updated - New: {result.New}, Old: {oldValue}");
};
//==== One-off reading use case/pattern
ReadSensor().Wait();
capacitive.StartUpdating(TimeSpan.FromMilliseconds(1000));
return Task.CompletedTask;
}
protected async Task ReadSensor()
{
var moisture = await capacitive.Read();
Resolver.Log.Info($"Initial moisture: {moisture:n2}");
}
Sample project(s) available on GitHub
Wiring Example
VoltageToMoisture(Voltage)
Converts voltage to moisture value, ranging from 0 (most dry) to 1 (most wet)
Declaration
protected double VoltageToMoisture(Voltage voltage)
Parameters
Type | Name | Description |
---|---|---|
Voltage | voltage |
Returns
Type | Description |
---|---|
double |
Remarks
Capacitive | |
---|---|
Status | |
Source code | GitHub |
NuGet package |
Capacitive Soil Moisture sensor is a simple breakout for measuring the moisture in soil and similar materials. This sensor measures moisture levels by capacitive sensing, rather then resistive sensing like other types of moisture sensor such as the FC-28.
Capacitive sensing means measuring the dielectrum that is formed by the soil and the water is the most important factor that forms the dielectrum. Even though this kind of sensor might be a little pricier, it is made of corrosion resistant material giving it a longer service of life than a resistive sensor.
The following example shows how read the soil moisture every second:
public class MeadowApp : App<F7Micro, MeadowApp>
{
Capacitive _Capacitive;
public MeadowApp()
{
// create a new Capacitive sensor object connected to analog pin A01
_Capacitive = new Capacitive(Device.Pins.A01);
Run();
}
async Task Run()
{
while (true)
{
float moisture = await _Capacitive.Read();
Console.WriteLine($"Moisture: {0}", moisture);
Thread.Sleep(1000);
}
}
}
Sample projects available on GitHub
Code Example
Capacitive capacitive;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
capacitive = new Capacitive(
Device.Pins.A00,
minimumVoltageCalibration: new Voltage(2.84f),
maximumVoltageCalibration: new Voltage(1.63f)
);
// Example that uses an IObservable subscription to only be notified when the moisture changes by filter defined.
var consumer = Capacitive.CreateObserver(
handler: result =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Subscribed - " +
$"new: {result.New}, " +
$"old: {oldValue}");
},
filter: null
);
capacitive.Subscribe(consumer);
// classical .NET events can also be used:
capacitive.MoistureUpdated += (sender, result) =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Updated - New: {result.New}, Old: {oldValue}");
};
//==== One-off reading use case/pattern
ReadSensor().Wait();
capacitive.StartUpdating(TimeSpan.FromMilliseconds(1000));
return Task.CompletedTask;
}
protected async Task ReadSensor()
{
var moisture = await capacitive.Read();
Resolver.Log.Info($"Initial moisture: {moisture:n2}");
}
Sample project(s) available on GitHub
Wiring Example
Events
MoistureUpdated
Raised when a new sensor reading has been made
Declaration
public event EventHandler<IChangeResult<double>> MoistureUpdated
Event Type
Type | Description |
---|---|
EventHandler<IChangeResult<double>> |
Remarks
Capacitive | |
---|---|
Status | |
Source code | GitHub |
NuGet package |
Capacitive Soil Moisture sensor is a simple breakout for measuring the moisture in soil and similar materials. This sensor measures moisture levels by capacitive sensing, rather then resistive sensing like other types of moisture sensor such as the FC-28.
Capacitive sensing means measuring the dielectrum that is formed by the soil and the water is the most important factor that forms the dielectrum. Even though this kind of sensor might be a little pricier, it is made of corrosion resistant material giving it a longer service of life than a resistive sensor.
The following example shows how read the soil moisture every second:
public class MeadowApp : App<F7Micro, MeadowApp>
{
Capacitive _Capacitive;
public MeadowApp()
{
// create a new Capacitive sensor object connected to analog pin A01
_Capacitive = new Capacitive(Device.Pins.A01);
Run();
}
async Task Run()
{
while (true)
{
float moisture = await _Capacitive.Read();
Console.WriteLine($"Moisture: {0}", moisture);
Thread.Sleep(1000);
}
}
}
Sample projects available on GitHub
Code Example
Capacitive capacitive;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
capacitive = new Capacitive(
Device.Pins.A00,
minimumVoltageCalibration: new Voltage(2.84f),
maximumVoltageCalibration: new Voltage(1.63f)
);
// Example that uses an IObservable subscription to only be notified when the moisture changes by filter defined.
var consumer = Capacitive.CreateObserver(
handler: result =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Subscribed - " +
$"new: {result.New}, " +
$"old: {oldValue}");
},
filter: null
);
capacitive.Subscribe(consumer);
// classical .NET events can also be used:
capacitive.MoistureUpdated += (sender, result) =>
{
string oldValue = (result.Old is { } old) ? $"{old:n2}" : "n/a";
Resolver.Log.Info($"Updated - New: {result.New}, Old: {oldValue}");
};
//==== One-off reading use case/pattern
ReadSensor().Wait();
capacitive.StartUpdating(TimeSpan.FromMilliseconds(1000));
return Task.CompletedTask;
}
protected async Task ReadSensor()
{
var moisture = await capacitive.Read();
Resolver.Log.Info($"Initial moisture: {moisture:n2}");
}
Sample project(s) available on GitHub