Remarks
ADXL362 | |
---|---|
Status | Not Tested |
Source code | GitHub |
NuGet package | Not published |
ADXL362 is an ultra-low power, 3-axis MEMS accelerometer that consumes less than 2 μA at a 100 Hz output data rate and 270 nA when in motion triggered wake-up mode.
The ADXL362 is controlled via I2C.
Sample projects available on GitHub
Purchasing
The ADXL362 is available on a small breakout board:
Usage
The ADXL362 can operating in interrupt and polling mode. Polling applications are responsible for determining when a sensor is read. Interrupt applications will be notified when the sensor reading changes by + / - a threshold value.
Wiring Example
Characteristic | Locus |
---|---|
Inheritance | System.Object FilterableChangeObservableBase<AccelerationConditionChangeResult, AccelerationConditions> > Adxl362 |
Implements | System.IObservable<AccelerationConditionChangeResult> IAccelerometer |
Inherited Members | FilterableChangeObservableBase<AccelerationConditionChangeResult, AccelerationConditions>._observers FilterableChangeObservableBase<AccelerationConditionChangeResult, AccelerationConditions>.NotifyObservers(AccelerationConditionChangeResult) FilterableChangeObservableBase<AccelerationConditionChangeResult, AccelerationConditions>.Subscribe(IObserver<AccelerationConditionChangeResult>) System.Object.ToString() System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.ReferenceEquals(System.Object, System.Object) System.Object.GetHashCode() System.Object.GetType() System.Object.MemberwiseClone() |
Namespace | Meadow.Foundation.Sensors.Motion |
Assembly | Adxl362.dll |
Syntax
public class Adxl362 : FilterableChangeObservableBase<AccelerationConditionChangeResult, AccelerationConditions>, IObservable<AccelerationConditionChangeResult>, IAccelerometer
Constructors
Adxl362(IIODevice, ISpiBus, IPin)
Create a new ADXL362 object using the specified SPI module.
Declaration
public Adxl362(IIODevice device, ISpiBus spiBus, IPin chipSelect)
Parameters
Type | Name | Description |
---|---|---|
IIODevice | device | |
ISpiBus | spiBus | Spi Bus object |
IPin | chipSelect | Chip select pin. |
Fields
_adxl362
ADXL362 sensor object.
Declaration
protected readonly ISpiPeripheral _adxl362
Field Value
Type | Description |
---|---|
ISpiPeripheral |
Properties
ActivityDetected
Indicate if any activity has been detected over the specified threshold.
Declaration
public bool ActivityDetected { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
ActivityInactivityControl
Activity / Inactivity control register (see page 29 of the data sheet).
Declaration
public byte ActivityInactivityControl { get; set; }
Property Value
Type | Description |
---|---|
System.Byte |
Awake
Indicate if the sensor is awake or inactive.
Declaration
public bool Awake { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Conditions
Declaration
public AccelerationConditions Conditions { get; protected set; }
Property Value
Type | Description |
---|---|
AccelerationConditions |
DataReady
Indicate of data is ready to be read.
Declaration
public bool DataReady { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
DeviceID
Read the device ID, MEMS ID, Part ID and silicon revision ID and encode the value in a 32-bit integer.
Declaration
public int DeviceID { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
FIFOOverrun
Indicate if the FIFO buffer has overrun (newly generated data is overwriting data already stored in the FIFO buffer.
Declaration
public bool FIFOOverrun { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
FIFOReady
Indicate if there is any data in the FIFO buffer.
Declaration
public bool FIFOReady { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
FIFOWatermark
Indicate if there are at least the desired number of samples in the FIFO buffer.
Declaration
public bool FIFOWatermark { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
FilterControl
Get / set the filter control register (see page 33 of the data sheet).
Declaration
public byte FilterControl { get; set; }
Property Value
Type | Description |
---|---|
System.Byte |
InactivityDetected
Indicate if the sensor has detected inactivity or a free fall condition.
Declaration
public bool InactivityDetected { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsSampling
Gets a value indicating whether the analog input port is currently sampling the ADC. Call StartSampling() to spin up the sampling process.
Declaration
public bool IsSampling { get; protected set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
SelfTest
Set the value of the self test register. Setting this to true will put the device into self test mode, setting this to false will turn off the self test.
Declaration
public bool SelfTest { set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Status
Read the status register.
Declaration
public byte Status { get; }
Property Value
Type | Description |
---|---|
System.Byte |
Temperature
Sensor temperature.
Declaration
public double Temperature { get; }
Property Value
Type | Description |
---|---|
System.Double |
XAcceleration
Acceleration along the X-axis.
Declaration
public float XAcceleration { get; }
Property Value
Type | Description |
---|---|
System.Single |
Remarks
This property will only contain valid data after a call to Read or after an interrupt has been generated.
YAcceleration
Acceleration along the Y-axis.
Declaration
public float YAcceleration { get; }
Property Value
Type | Description |
---|---|
System.Single |
Remarks
This property will only contain valid data after a call to Read or after an interrupt has been generated.
ZAcceleration
Acceleration along the Z-axis.
Declaration
public float ZAcceleration { get; }
Property Value
Type | Description |
---|---|
System.Single |
Remarks
This property will only contain valid data after a call to Read or after an interrupt has been generated.
Methods
ConfigureActivityThreshold(UInt16, Byte)
Configure the activity threshold and activity time. Once configured it will be necessary to set the activity/inactivity control and interrupts if required.
Declaration
public void ConfigureActivityThreshold(ushort threshold, byte numberOfSamples)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | threshold | 11-bit unsigned value for the activity threshold. |
System.Byte | numberOfSamples | Number of consecutive samples that must exceed the threshold |
ConfigureInactivityThreshold(UInt16, UInt16)
Configure the inactivity threshold and activity time. Once configured it will be necessary to set the activity/inactivity control and interrupts if required.
Declaration
public void ConfigureInactivityThreshold(ushort threshold, ushort numberOfSamples)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | threshold | 11-bit unsigned value for the activity threshold. |
System.UInt16 | numberOfSamples | Number of consecutive samples that must exceed the threshold |
RaiseChangedAndNotify(AccelerationConditionChangeResult)
Declaration
protected void RaiseChangedAndNotify(AccelerationConditionChangeResult changeResult)
Parameters
Type | Name | Description |
---|---|---|
AccelerationConditionChangeResult | changeResult |
Read()
Declaration
public Task<AccelerationConditions> Read()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<AccelerationConditions> |
Reset()
Reset the sensor.
Declaration
public void Reset()
Start()
Start making sensor readings.
Declaration
public void Start()
StartUpdating(Int32)
Declaration
public void StartUpdating(int standbyDuration = 1000)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | standbyDuration |
Stop()
Stop sensor readings.
Declaration
public void Stop()
StopUpdating()
Declaration
public void StopUpdating()
Update()
Read the sensors and make the readings available through the X, Y and Z properties.
Declaration
public void Update()
Events
Updated
Declaration
public event EventHandler<AccelerationConditionChangeResult> Updated
Event Type
Type | Description |
---|---|
System.EventHandler<AccelerationConditionChangeResult> |