This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:iot-open:practical:hardware:sut:stm32:emb2_1 [2024/04/21 11:22] – [STM_2: Using a digital potentiometer] ktokarz | en:iot-open:practical:hardware:sut:stm32:emb2_1 [2024/04/21 11:25] (current) – [Result validation] ktokarz | ||
---|---|---|---|
Line 92: | Line 92: | ||
=== Step 4 === | === Step 4 === | ||
- | Initialise the I2C bus and configure ADC's GPIO as input: | + | Initialise the I2C bus and configure ADC's GPIO as input. Change the ADC resolution to 12-bits. |
<code c> | <code c> | ||
Wire.begin(); | Wire.begin(); | ||
pinMode(POT_ADC, | pinMode(POT_ADC, | ||
+ | analogReadResolution(12); | ||
</ | </ | ||
Line 128: | Line 129: | ||
</ | </ | ||
==== Result validation ==== | ==== Result validation ==== | ||
- | A relation between the potentiometer set value and ADC reading should be almost linear from 0V up to about 3V. It becomes horizontal because | + | A relation between the potentiometer set value and ADC reading should be almost linear from 0V up to the maximum. The linear correlation is never perfect, either because of the devices' |
===== FAQ ===== | ===== FAQ ===== |