Difference: AnalogueSignals (1 vs. 3)

Revision 32022-10-24 - UliRaich

Line: 1 to 1
 
META TOPICPARENT name="MinimalLectures"

Analogue Signals

Line: 17 to 17
 
GND GND
Use the male/female Dupont wires to make the connections.
Added:
>
>
slider_conn.png
 You find a description of the MicroPython driver in the doc again. The ADC works for a range of 0..1V only while the potentiometer produces signal levels of 0..3.3V. A signal attenuator allows adapting the ranges. It must be set to ADC.ATTN_11DB for our 0..3.3V slider.
Added:
>
>
 
from machine import ADC,Pin
from time import sleep_ms
Line: 34 to 37
 
<--/commentPlugin-->
Changed:
<
<
META FILEATTACHMENT attachment="slider.png" attr="" comment="" date="1665953663" name="slider.png" path="slider.png" size="156597" user="UliRaich" version="1"
>
>
META FILEATTACHMENT attachment="slider.png" attr="" comment="" date="1666609103" name="slider.png" path="slider.png" size="156597" user="UliRaich" version="3"
META FILEATTACHMENT attachment="slider_conn.png" attr="" comment="" date="1666609153" name="slider_conn.png" path="slider_conn.png" size="79590" user="UliRaich" version="1"

Revision 22022-10-17 - UliRaich

Line: 1 to 1
 
META TOPICPARENT name="MinimalLectures"

Analogue Signals

Line: 9 to 9
 slider.png

The potentiometer has 3 pins: OTA (or OTB), VCC, GND which must be connected to the triple base as follows:

Added:
>
>
 
Potentiometer Triple Base
OTA A0 (ADC) GPIO 36
VCC 3V3

Revision 12022-10-16 - UliRaich

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="MinimalLectures"

Analogue Signals

Up to now, we only treated digital signals in output mode (LED) and in input mode (pushbutton). Sensors often produce analogue signal levels, however. A thermistor, for example, returns a voltage level which corresponds to the temperature. How can we treat signals like these?

Our slider potentiometer produces a similar signal level, and we will connect it to an Analogue to Digital Converter (ADC). The ESP32 chip already supplies a 12 bit ADC. With 12 bits 4096 different numbers can be represented, and we therefore get a resolution of our measurement of 1/4096 which corresponds to ~0.025 %

slider.png

The potentiometer has 3 pins: OTA (or OTB), VCC, GND which must be connected to the triple base as follows:

Potentiometer Triple Base
OTA A0 (ADC) GPIO 36
VCC 3V3
GND GND
Use the male/female Dupont wires to make the connections.

You find a description of the MicroPython driver in the doc again. The ADC works for a range of 0..1V only while the potentiometer produces signal levels of 0..3.3V. A signal attenuator allows adapting the ranges. It must be set to ADC.ATTN_11DB for our 0..3.3V slider.

from machine import ADC,Pin
from time import sleep_ms

slider = ADC(Pin(36, atten=ADC.ATTN_11DB)  # use the ADC on GPIO 36 and set the attenuator to 11 dB
while True:
     print("Raw 12 bit value from slider: ",slider.read())
     sleep_ms(100)

The only hardware still missing is the rgb LED chain

-- Uli Raich - 2022-10-16

Comments

<--/commentPlugin-->

META FILEATTACHMENT attachment="slider.png" attr="" comment="" date="1665953663" name="slider.png" path="slider.png" size="156597" user="UliRaich" version="1"
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback