Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
Commit ca462419 authored by Deepak Khatri's avatar Deepak Khatri :dog:
Browse files

Update ADS1115 ADC usage guide

parent d2b8b6e2
Branches
Tags
No related merge requests found
...@@ -19,7 +19,7 @@ ADS1115 16-bit ADC ...@@ -19,7 +19,7 @@ ADS1115 16-bit ADC
Wiring/connection Wiring/connection
================== ==================
Following the I2C pinout shown above let's make the connection of our ADS1115 ADC with BeagleY-AI. Following the I2C pinout shown above let's make the connection of our ADS1115 ADC.
.. figure:: ../images/i2c/ads1115-connection.* .. figure:: ../images/i2c/ads1115-connection.*
:align: center :align: center
...@@ -27,8 +27,9 @@ Following the I2C pinout shown above let's make the connection of our ADS1115 AD ...@@ -27,8 +27,9 @@ Following the I2C pinout shown above let's make the connection of our ADS1115 AD
ADS1115 connection ADS1115 connection
To check if your ADS1115 ADC is correctly connected to your BeagleY-AI you .. tip:: The ADC can work on ``2.0V - 5.5V`` voltage range, here we have selected to run it on ``5V`` from ``HAT PIN2``. For more information checkout `ADS1115 datasheet <https://www.ti.com/lit/ds/symlink/ads1115.pdf>`_.
can use ``i2cdetect`` command as shown below.
To check if your ADS1115 ADC is correctly connected to your BeagleY-AI you can use ``i2cdetect`` command as shown below.
.. code:: console .. code:: console
...@@ -57,26 +58,26 @@ PGA ...@@ -57,26 +58,26 @@ PGA
The pga is the programmable gain amplifier (values are full scale), in the device tree overlay we have ``ti,gain = <#>;`` where ``#`` can be following, The pga is the programmable gain amplifier (values are full scale), in the device tree overlay we have ``ti,gain = <#>;`` where ``#`` can be following,
- 0: +/- 6.144 V - ``0``: +/- 6.144 V
- 1: +/- 4.096 V (default) - ``1``: +/- 4.096 V (default)
- 2: +/- 2.048 V - ``2``: +/- 2.048 V
- 3: +/- 1.024 V - ``3``: +/- 1.024 V
- 4: +/- 0.512 V - ``4``: +/- 0.512 V
- 5: +/- 0.256 V - ``5``: +/- 0.256 V
Data rate Data rate
---------- ----------
The data_rate in samples per second, in the device tree overlay we have ``ti,datarate = <#>;`` where ``#`` can be following, The data_rate in samples per second, in the device tree overlay we have ``ti,datarate = <#>;`` where ``#`` can be following,
- 0: 8 - ``0``: 8
- 1: 16 - ``1``: 16
- 2: 32 - ``2``: 32
- 3: 64 - ``3``: 64
- 4: 128 - ``4``: 128
- 5: 250 - ``5``: 250
- 6: 475 - ``6``: 475
- 7: 860 (default) - ``7``: 860 (default)
.. _beagley-ai-adc-ads1115-inputs: .. _beagley-ai-adc-ads1115-inputs:
...@@ -85,16 +86,16 @@ ADC Inputs ...@@ -85,16 +86,16 @@ ADC Inputs
The inputs can be made available by 8 sysfs input files in0_input - in7_input, The inputs can be made available by 8 sysfs input files in0_input - in7_input,
- in0: Voltage over AIN0 and AIN1. - ``in0``: Voltage over AIN0 and AIN1.
- in1: Voltage over AIN0 and AIN3. - ``in1``: Voltage over AIN0 and AIN3.
- in2: Voltage over AIN1 and AIN3. - ``in2``: Voltage over AIN1 and AIN3.
- in3: Voltage over AIN2 and AIN3. - ``in3``: Voltage over AIN2 and AIN3.
- in4: Voltage over AIN0 and GND. - ``in4``: Voltage over AIN0 and GND.
- in5: Voltage over AIN1 and GND. - ``in5``: Voltage over AIN1 and GND.
- in6: Voltage over AIN2 and GND. - ``in6``: Voltage over AIN2 and GND.
- in7: Voltage over AIN3 and GND. - ``in7``: Voltage over AIN3 and GND.
in the device tree overlay we have ``channel@4 - channel@7`` representing ``in4 - in7``. .. note:: In the device tree overlay we have ``channel@4 - channel@7`` device tree nodes representing ``in4 - in7`` from the list above.
.. _beagley-ai-ads1115-using-kernel-driver: .. _beagley-ai-ads1115-using-kernel-driver:
...@@ -125,16 +126,15 @@ After rebooting the board you should see ``/sys/bus/iio/devices/iio:device0`` av ...@@ -125,16 +126,15 @@ After rebooting the board you should see ``/sys/bus/iio/devices/iio:device0`` av
debian@BeagleBone:~$ ls /sys/bus/iio/devices/ | grep iio debian@BeagleBone:~$ ls /sys/bus/iio/devices/ | grep iio
iio:device0 iio:device0
To show all the ``beagley-ai-adc-ads1115-inputs`` you can create a script called ``adcreader.sh ``, To show all the :ref:`beagley-ai-adc-ads1115-inputs` you can create a script called ``adcreader.sh``.
Create the file, - Create the file,
.. code:: shell .. code:: shell
nano adcreader.sh nano adcreader.sh
Copy and paste the content below, - Copy and paste the content below,
.. code:: bash .. code:: bash
...@@ -149,13 +149,13 @@ Copy and paste the content below, ...@@ -149,13 +149,13 @@ Copy and paste the content below,
echo "in0=${in0}\nin1=${in1}\nin2=${in2}\nin3=${in3}\nin4=${in4}\nin5=${in5}\nin6=${in6}\nin7=${in7}" echo "in0=${in0}\nin1=${in1}\nin2=${in2}\nin3=${in3}\nin4=${in4}\nin5=${in5}\nin6=${in6}\nin7=${in7}"
To allow the execution of the script as normal user use the command below, - To allow the execution of the script as normal user use the command below,
.. code:: shell .. code:: shell
chmod +x adcreader.sh chmod +x adcreader.sh
To view the ADC updates every 100ms use the ``watch`` command as shown below, - To view the ADC updates every 100ms use the ``watch`` command as shown below,
.. code:: shell .. code:: shell
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment