This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
products:sbc:vim4:applications:gpio:adc [2022/09/19 04:41] nick |
products:sbc:vim4:applications:gpio:adc [2023/07/25 22:20] nick |
||
---|---|---|---|
Line 3: | Line 3: | ||
====== VIM4 ADC ====== | ====== VIM4 ADC ====== | ||
+ | ===== Introduction ===== | ||
- | {{page> | + | 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 developers 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 | ||
+ | | 10 | ADC_CH6 | 0~1.8V | ||
+ | | 12 | ADC_CH3 | 0~1.8V | ||
+ | |||
+ | ===== Get Raw ADC Value ===== | ||
+ | |||
+ | <WRAP important > | ||
+ | Replace the variable '' | ||
+ | </ | ||
+ | |||
+ | ```shell | ||
+ | $ cat / | ||
+ | ``` | ||
+ | |||
+ | The following uses PIN10 as an example. | ||
+ | |||
+ | ```shell | ||
+ | $ cat / | ||
+ | 4082 | ||
+ | $ cat / | ||
+ | 5 | ||
+ | ``` | ||
+ | |||
+ | Convert the raw ADC value to Voltage: | ||
+ | |||
+ | '' |