Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation changes (first half): Use only a single README.md per device #1611

Merged
merged 11 commits into from
Jul 29, 2021
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/devices/AD5328/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

AD5328 is an Digital-to-Analog converter (DAC) with 12 bits of resolution.

## Documentation

Product information and documentation can he found [here](https://www.analog.com/en/products/ad5328.html)

## Usage

```csharp
Expand All @@ -20,8 +24,3 @@ var dac = new AD5328(spidev, ElectricPotential.FromVolts(2.5), ElectricPotential
Thread.Sleep(1000);
dac.SetVoltage(0, ElectricPotential.FromVolts(1));
```

## References

https://www.analog.com/en/products/ad5328.html

75 changes: 70 additions & 5 deletions src/devices/Ads1115/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# ADS1115 - Analog to Digital Converter

ADS1115 is an Analog-to-Digital converter (ADC) with 16 bits of resolution.

## Documentation

Prodcut datasheet can be found [here](https://cdn-shop.adafruit.com/datasheets/ads1115.pdf)

## Sensor Image
![](sensor.jpg)

![ADS1115](sensor.jpg)

## Usage

```C#
// set I2C bus ID: 1
// ADS1115 Addr Pin connect to GND
Expand All @@ -23,11 +30,69 @@ using (Ads1115 adc = new Ads1115(device, InputMultiplexer.AIN0, MeasuringRange.F
}
```

See the samples project for more examples and usage for different applications.
See the [samples project](./samples) for more examples and usage for different applications.

If you want to use the interrupt pin, the pulses generated by the ADS1115 might be to short to be properly recognized in the software, i.e. on a Raspberry Pi. The schematic below shows a way of increasing the pulse length so that it is properly recognized (from about 10us to 150us). This uses discrete electronics, but an implementation with an NE555 or equivalent would likely work as well (Just note that you need a type that works at 3.3V).

![](Pulse_lengthener_schema.png)
![Pulse_lengthener_schema](Pulse_lengthener_schema.png)

## Example

### Hardware Required

* ADS1115
* Rotary Potentiometer
* Male/Female Jumper Wires

### Circuit

![circuit](ADS1115_circuit_bb.png)

ADS1115
* ADDR - GND
* SCL - SCL
* SDA - SDA
* VCC - 5V
* GND - GND
* A0 - Rotary Potentiometer Pin 2

Rotary Potentiometer
* Pin 1 - 5V
* Pin 2 - ADS1115 Pin A0
* Pin 3 - GND

### Code

```C#
// set I2C bus ID: 1
// ADS1115 Addr Pin connect to GND
I2cConnectionSettings settings = new I2cConnectionSettings(1, (int)I2cAddress.GND);
I2cDevice device = I2cDevice.Create(settings);

// pass in I2cDevice
// measure the voltage AIN0
// set the maximum range to 6.144V
using (Ads1115 adc = new Ads1115(device, InputMultiplexer.AIN0, MeasuringRange.FS6144))
{
// loop
while (true)
{
// read raw data form the sensor
short raw = adc.ReadRaw();
// raw data convert to voltage
double voltage = adc.RawToVoltage(raw);

Console.WriteLine($"ADS1115 Raw Data: {raw}");
Console.WriteLine($"Voltage: {voltage}");
Console.WriteLine();

// wait for 2s
Thread.Sleep(2000);
}
}
```

### Results

## References
https://cdn-shop.adafruit.com/datasheets/ads1115.pdf
![run results](RunningResult.jpg)
![interupt result](InterruptResult.png)
56 changes: 0 additions & 56 deletions src/devices/Ads1115/samples/README.md

This file was deleted.

65 changes: 61 additions & 4 deletions src/devices/Adxl345/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
# ADXL345 - Accelerometer

ADXL345 is a small, thin, low power, 3-axis accelerometer with high resolution (13-bit) measurement at up to ±16g.

## Documentation

In [Chinese](http://wenku.baidu.com/view/87a1cf5c312b3169a451a47e.html)

In [English](https://www.analog.com/media/en/technical-documentation/data-sheets/ADXL345.pdf)


## Sensor Image
![](sensor.jpg)

![sensor](sensor.jpg)

## Usage

```C#
SpiConnectionSettings settings = new SpiConnectionSettings(0, 0)
{
Expand All @@ -24,7 +34,54 @@ using (Adxl345 sensor = new Adxl345(device, GravityRange.Range04))
}
```

## References
In Chinese : http://wenku.baidu.com/view/87a1cf5c312b3169a451a47e.html
## Example

### Hardware Required

* ADXL345
* Male/Female Jumper Wires

## Circuit

![cicuit](ADXL345_circuit_bb.png)

* VCC - 3.3 V
* GND - GND
* CS - CS0(Pin24)
* SDO - SPI0 MISO(Pin21)
* SDA - SPI0 MOSI (Pin19)
* SCL - SPI0 SCLK(Pin23)

### Code

```C#
SpiConnectionSettings settings = new SpiConnectionSettings(0, 0)
{
ClockFrequency = Adxl345.SpiClockFrequency,
Mode = Adxl345.SpiMode
};
var device = SpiDevice.Create(settings);

// Set gravity measurement range ±4G
using (Adxl345 sensor = new Adxl345(device, GravityRange.Range04))
{
// loop
while (true)
{
// read data
Vector3 data = sensor.Acceleration;

Console.WriteLine($"X: {data.X.ToString("0.00")} g");
Console.WriteLine($"Y: {data.Y.ToString("0.00")} g");
Console.WriteLine($"Z: {data.Z.ToString("0.00")} g");
Console.WriteLine();

// wait for 500ms
Thread.Sleep(500);
}
}
```

### Result

In English : https://www.analog.com/media/en/technical-documentation/data-sheets/ADXL345.pdf
![running result](RunningResult.jpg)
47 changes: 0 additions & 47 deletions src/devices/Adxl345/samples/README.md

This file was deleted.

8 changes: 4 additions & 4 deletions src/devices/Adxl357/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ ADXL357 is a 3-Axis digital accelerometer 40g with 20-bit resolution measurement
Sensitivity is configurable (±10g, ±20g, ±40g).
Has a built in temperature sensor.

## Documentation

Product documentation can be found [here](https://www.analog.com/en/products/adxl357.html)

## Sensor Image

![Source: https://wiki.seeedstudio.com/Grove-3-Axis_Digital_Accelerometer_40g-ADXL357/](sensor.png)
Expand Down Expand Up @@ -32,7 +36,3 @@ while (true)
Thread.Sleep(500);
}
```

## References

https://www.analog.com/en/products/adxl357.html
29 changes: 0 additions & 29 deletions src/devices/Adxl357/samples/README.md

This file was deleted.

Loading