Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:vim-5:applications:gpio:adc

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
products:sbc:vim-5:applications:gpio:adc [2026/09/14 03:59]
127.0.0.1 external edit
products:sbc:vim-5:applications:gpio:adc [2026/09/14 04:18] (current)
nick
Line 1: Line 1:
 {{indexmenu_n>10}} {{indexmenu_n>10}}
  
-====== VIM4 ADC ======+====== VIM 5 ADC ======
  
 ===== Introduction ===== ===== Introduction =====
  
-This document aims to guide you on how to use the ADC (Analog-to-Digital Converter) interface on the GPIO pins of the Khadas VIM4 SBC. The ADC interface allows you to convert analog signals into digital values, providing you with flexibility to connect analog sensors and devices on the VIM4.+This document aims to guide you on how to use the ADC (Analog-to-Digital Converter) interface on the GPIO pins of the Khadas VIM4 SBC. The ADC interface allows you to convert analog signals into digital values, providing you with flexibility to connect analog sensors and devices on the VIM 5.
  
 ===== Hardware Information ===== ===== Hardware Information =====
Line 12: Line 12:
  
 ^  Pin  ^ SIGNAL  ^  Voltage  ^  Device Node                                       ^ ^  Pin  ^ SIGNAL  ^  Voltage  ^  Device Node                                       ^
-|  10   ADC_CH6 |  0~1.8V    /sys/bus/iio/devices/iio:device0/in_voltage6_raw  | +|  10   ADC_CH0 |  0~1.8V    /sys/bus/iio/devices/iio:device0/in_voltage0_input  | 
-|  12   | ADC_CH3 |  0~1.8V    /sys/bus/iio/devices/iio:device0/in_voltage3_raw  |+|  12   | ADC_CH3 |  0~1.8V    /sys/bus/iio/devices/iio:device0/in_voltage3_input  |
  
-===== Get Raw ADC Value =====+===== Get ADC Value =====
  
 <WRAP important > <WRAP important >
-Replace the variable ''x'' in ''in_voltageX''raw with the corresponding channel value+Replace the variable ''x'' in ''in_voltageX_input''raw with the corresponding channel value
 </WRAP> </WRAP>
  
 ```shell ```shell
-$ cat /sys/bus/iio/devices/iio:device0/in_voltageX_raw+$ cat /sys/bus/iio/devices/iio:device0/in_voltageX_input
 ``` ```
  
Line 28: Line 28:
  
 ```shell ```shell
-$ cat /sys/bus/iio/devices/iio:device0/in_voltage6_raw     // PIN10 is connected to 1.8V                                         +$ cat /sys/bus/iio/devices/iio:device0/in_voltage0_input    # PIN10 is connected to 1.8V                                         
-4082 +1800 
-$ cat /sys/bus/iio/devices/iio:device0/in_voltage6_raw    // PIN10 connects to GND +$ cat /sys/bus/iio/devices/iio:device0/in_voltage0_input    PIN10 connects to GND 
-5+0
 ``` ```
  
 Convert the raw ADC value to Voltage: Convert the raw ADC value to Voltage:
  
-''Voltage = (value / 4096) * 1.8V''+''Voltage = (value / 1800) * 1.8V''
Last modified: 2026/09/14 03:59 by 127.0.0.1