3.Analog-digital converter
Application of ADC which is variable gain on BiBoard (ESP32)
The instructions of ADC on BiBoard
The 34, 35, 36 and 39 pins of the ESP32 module support input only. We configure it as an analog input port on BiBoard, which makes it convenient for developers to connect 4 foot sensors.
The usage of analog input analog-to-digital converter (ADC) on BiBoard is the same as the basic Arduino UNO, but the accuracy is higher (12 bits, UNO is 10 bits), and a programmable gain amplifier is added to make the ADC work in the best range.
When a 1V voltage signal is input, if 12bit access is used according to the normal configuration, the reference voltage is equal to the power supply voltage (3.3V): the corresponding output is 0๏ฝ1241, a large part of the ADC range will be wasted, resulting in inaccurate data. When we configure the programmable gain, we can make the 1V input signal fill almost the entire ADC range, and the accuracy and resolution are greatly improved.
This demo uses 4 inputs, respectively configured as: 0/2.5/6/11 decibel amplification gain, it should be noted that the default configuration of ESP32 Arduino is 11 decibel amplification gain.
We use "analogSetPinAttenuation(PIN_NAME, attenuation)" to configure the gain of a single input pin, or use "analogSetAttenuation(attenuation)" to configure the gain of all analog input pins.
In the actual test, when the 1V standard voltage is input, the ADC values are: 3850/2890/2025/1050. In future productions, the ADC range can be changed by changing the ADC gain without the replacement of the reference voltage source.
Last updated