1Sigma-delta Modulation
2======================
3
4{IDF_TARGET_SIGMA_DELTA_MODULATION_CHANNEL_NUM:default="8", esp32c3="4"}
5
6Introduction
7------------
8
9{IDF_TARGET_NAME} has a second-order sigma-delta modulation module. This driver configures the channels of the sigma-delta module.
10
11Functionality Overview
12----------------------
13
14There are {IDF_TARGET_SIGMA_DELTA_MODULATION_CHANNEL_NUM} independent sigma-delta modulation channels identified with :cpp:type:`sigmadelta_channel_t`. Each channel is capable to output the binary, hardware generated signal with the sigma-delta modulation.
15
16Selected channel should be set up by providing configuration parameters in :cpp:type:`sigmadelta_config_t` and then applying this configuration with :cpp:func:`sigmadelta_config`.
17
18Another option is to call individual functions, that will configure all required parameters one by one:
19
20* **Prescaler** of the sigma-delta generator - :cpp:func:`sigmadelta_set_prescale`
21* **Duty** of the output signal - :cpp:func:`sigmadelta_set_duty`
22* **GPIO pin** to output modulated signal - :cpp:func:`sigmadelta_set_pin`
23
24The range of the 'duty' input parameter of :cpp:func:`sigmadelta_set_duty` is from -128 to 127 (eight bit signed integer). If zero value is set, then the output signal's duty will be about 50%, see description of :cpp:func:`sigmadelta_set_duty`.
25
26
27Convert to analog signal (Optional)
28-----------------------------------
29
30Typically, if the sigma-delta signal is connected to an LED, you don't have to add any filter between them (because our eyes are a low pass filter naturally). However, if you want to check the real voltage or watch the analog waveform, you need to design an analog low pass filter. Also, it is recommended to use an active filter instead of a passive filter to gain better isolation and not lose too much voltage.
31
32For example, you can take the following `Sallen-Key topology Low Pass Filter`_ as a reference.
33
34.. figure:: ../../../_static/typical_sallenkey_LP_filter.png
35    :align: center
36    :alt: Sallen-Key Low Pass Filter
37    :figclass: align-center
38
39    Sallen-Key Low Pass Filter
40
41
42Application Example
43-------------------
44
45Sigma-delta Modulation example: :example:`peripherals/sigmadelta`.
46
47API Reference
48-------------
49
50.. include-build-file:: inc/sigmadelta.inc
51.. include-build-file:: inc/sigmadelta_types.inc
52
53.. _Sallen-Key topology Low Pass Filter: https://en.wikipedia.org/wiki/Sallen%E2%80%93Key_topology
54