Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:iot-open:practical:hardware:sut:stm32:emb2_1 [2024/04/21 11:22] – [STM_2: Using a digital potentiometer] ktokarzen: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, INPUT);   pinMode(POT_ADC, INPUT);
 +  analogReadResolution(12);
 </code> </code>
  
Line 128: Line 129:
 </code> </code>
 ==== 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 the ESP32 chip limits the ADC range to 3V, so going beyond 3V (and due to the electronic construction as in figure {{ref>figuredigipot}} it may go to about 3.3V) gives no further increase but rather a reading of the 4096 value (which means the input voltage is over the limit). For this reason, your plot may be finished suddenly with a horizontal instead of linearity decreasing function. It is by design. ADC input of the ESP32 can tolerate values between 3V and 3.3V. The linear correlation mentioned above is never perfect, either because of the devices' implementation imperfection (ESP32's ADC input and digital potentiometer output) or because of the electromagnetic noise. There are many devices in our lab room.+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' implementation imperfection (STM32's ADC input and digital potentiometer output) or because of the electromagnetic noise. There are many devices in our lab room.
  
 ===== FAQ ===== ===== FAQ =====
en/iot-open/practical/hardware/sut/stm32/emb2_1.1713698526.txt.gz · Last modified: 2024/04/21 11:22 by ktokarz
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0