Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:vim4: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:vim4:applications:gpio:adc [2022/07/21 21:03]
nick created
products:sbc:vim4:applications:gpio:adc [2023/07/25 22:21] (current)
nick
Line 1: Line 1:
 +{{indexmenu_n>10}}
  
 ====== VIM4 ADC ====== ====== VIM4 ADC ======
  
 +===== Introduction =====
  
-{{page>products:sbc:common:applications:gpio:adc&noheader}}+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. 
 + 
 +===== Hardware Information ===== 
 + 
 +The ADC  is a 12-bit successive approximation register (SAR) A/D Converter. 
 + 
 +^  Pin  ^ SIGNAL  ^  Voltage  ^  Device Node                                       ^ 
 +|  10   | ADC_CH6 |  0~1.8V    /sys/bus/iio/devices/iio:device0/in_voltage6_raw 
 +|  12   | ADC_CH3 |  0~1.8V    /sys/bus/iio/devices/iio:device0/in_voltage3_raw 
 + 
 +===== Get Raw ADC Value ===== 
 + 
 +<WRAP important > 
 +Replace the variable ''x'' in ''in_voltageX''raw with the corresponding channel value 
 +</WRAP> 
 + 
 +```shell 
 +$ cat /sys/bus/iio/devices/iio:device0/in_voltageX_raw 
 +``` 
 + 
 +The following uses PIN10 as an example. 
 + 
 +```shell 
 +$ cat /sys/bus/iio/devices/iio:device0/in_voltage6_raw     // PIN10 is connected to 1.8V                                         
 +4082 
 +$ cat /sys/bus/iio/devices/iio:device0/in_voltage6_raw    // PIN10 connects to GND 
 +
 +``` 
 + 
 +Convert the raw ADC value to Voltage: 
 + 
 +''Voltage = (value / 4096) * 1.8V''
Last modified: 2022/07/21 21:03 by nick