User Tools

Site Tools


No ACL setup yet! Denying access to everyone.
en:edu:zmitac:macro:iot:labesp32

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:edu:zmitac:macro:iot:labesp32 [2020/03/12 10:11] – [Laboratory scenarios] pczekalskien:edu:zmitac:macro:iot:labesp32 [2020/03/12 11:08] (current) – [Laboratory scenarios] pczekalski
Line 265: Line 265:
  
 ** Task 7 ** - reading analog data\\ ** Task 7 ** - reading analog data\\
-In this task, you will read analogue data via integrated ADCs of the ESP32. ESP has 15 channels exposed (18 total) of the up to 12-bit resolution ADCs. Reading of the raw data (12-bit resolution is the default, 8 samples per measure as default) is easy. \\+In this task, you will read analogue data via integrated ADCs.\\ 
 +Hardware part includes use of the "Joystick" sensor, composed of two potentiometers (one per axis) and a button (we do not use it here). 
 +__Please note correct pinout. Connect **GND** to board's GND, **5V** to 3.3V (**NOT 5V!**) even if on-board print states 5V.!__. Analogue resistance (voltage divider) goes through VRx and VRy.\\ 
 + 
 +ESP32 has 15 channels exposed (18 total) of the up to 12-bit resolution ADCs. Reading of the raw data (12-bit resolution is the default, 8 samples per measure as default) is easy using ''analogRead()'' function. \\
 Technically, under the hood on the hardware level, there are two ADCs (ADC1 and ADC2). ADC 1 uses GPIOs 32 through 39. ADC2 GPIOs 0,2,4, 12-15 and 25-27. Note, ADC2 is used for WiFi purposes so you cannot use it when WiFi communication is enabled (so cannot you use GPIOs). Other limitations include use of GPIOs 0, 2, 4 an 15 in ESP WROVER KIT as mentioned above (those are already bound to other hardware). \\ Technically, under the hood on the hardware level, there are two ADCs (ADC1 and ADC2). ADC 1 uses GPIOs 32 through 39. ADC2 GPIOs 0,2,4, 12-15 and 25-27. Note, ADC2 is used for WiFi purposes so you cannot use it when WiFi communication is enabled (so cannot you use GPIOs). Other limitations include use of GPIOs 0, 2, 4 an 15 in ESP WROVER KIT as mentioned above (those are already bound to other hardware). \\
 Just execute ''analogRead(GPIO)''.\\ Just execute ''analogRead(GPIO)''.\\
Line 276: Line 280:
     * ''ADC_2_5db'' - 1.34 (1V on input = 2086 reading on ADC), so full scale is 0..1.5V     * ''ADC_2_5db'' - 1.34 (1V on input = 2086 reading on ADC), so full scale is 0..1.5V
     * ''ADC_6db'' - 1.5 (1V on input = 2975 reading on ADC), so full scale is 0..2.2V     * ''ADC_6db'' - 1.5 (1V on input = 2975 reading on ADC), so full scale is 0..2.2V
-    * ''ADC_11db'' - 3.6 (1V on input = 3959 reading on ADC), so full scale is 0..3.9V - **warning - some people report that using it bricks ESP board!**+    * ''ADC_11db'' - 3.6 (1V on input = 3959 reading on ADC), so full scale is 0..3.9V 
 + 
 +<note important>Do not execute consequent way ''analogRead()''. As technically all channels use same two registers (ADC1 and ADC2) you need to give it some time to sample (i.e. ''delay(100)'' between consecutive reads on different channels).</note> 
 + 
 +During your exercise, you may start from informing ESP to start sampling on particular GPIOs, usually in the ''setup()'' function: 
 +<code c> 
 +... 
 +#define VRxPIN 25 
 +#define VRyPIN 26 
 +... 
 +void setup() 
 +{ 
 +... 
 +  adcAttachPin(VRxPIN); 
 +  adcAttachPin(VRyPIN); 
 +  // here you can also change clock divider, number of cycles per sample and so on. 
 +... 
 +} 
 +</code>
 ==== Resources ==== ==== Resources ====
   - [[https://www.espressif.com/en/products/hardware/esp-wrover-kit/resources|ESP32 WROVER kit starting page]]   - [[https://www.espressif.com/en/products/hardware/esp-wrover-kit/resources|ESP32 WROVER kit starting page]]
en/edu/zmitac/macro/iot/labesp32.1584004318.txt.gz · Last modified: by pczekalski