Standard Arduino SPI and I2C interface
The SPI and I2C interfaces are available on the expansion slot. The SPI interface is also used for LoRa, the I2C interface is already used for the optional external temperature/humidity sensor. Please note that the SPI or I2C interfaces must not be used simultaneously by the RadioShuttle software and your own applications.
I2C can be used within “loop”, as RadioShuttle does not access it at the same time.
With SPI it makes sense to use SPI only if LoRa is not active. Using the
UpdateNodeStartup(RS_Node_Offline) function, LoRa can also be temporarily deactivated. Alternatively, the interrupts can be deactivated during own SPI access.
Eagle board: pin and interrupt assignment
U.FL antenna connector
A U.FL socket is already soldered on. Please note that the U.FL socket is only designed for a few connections.
Accuracy of the ESP32 analog-to-digital converter (ADC)
In order to significantly increase the accuracy of the ADC measurements on the Eagle board, the internal voltage reference of the ESP32 processor is measured during the production of the Eagle boards and is internally stored in the eFuse memory. The function
prop.GetProperty(prop.ADC_VREF, 1100); allows retrieving the value in millivolts to make an accurate calculation of the ADC measurements. Since almost every ESP32 module has a deviation in its internal reference voltage (1.100 volts), the calibration of the Eagle boards for more accurate ADC measurements is of great advantage.
The internal ESP analog reference voltage is approx. 1.100 volts (“Attenuation ADC_0db” setting), other reference voltages (e.g. 6 dB = approx. 2.2 volts) are only derived from the internal reference 1.100 volts (0 dB). For ADC mesurements it is therefore recommended to use the 1.100 volts reference voltage (“ADC_0db”) right away because it was measured and therefore calibrated during the production of the Eagle board.
The ADC offers an accuracy up to 12 bit (12 bit = 4,096 gradations) in a voltage range of 0-1.100 volts (reference voltage aprox. 1.100 volts). Unfortunately, these 4,096 gradations of the ESP32 internal ADC are non-linear, which impairs the accuracy of the ADC measurements. For achieving more accurate ADC measurements it is necessary that both internal converters, ADC0 and ADC1, create and use their own lookup tables for linearization.
As already mentioned before, accurate ADC measurements are only limited, or only possible with increased calibration effort. A topic on which the manufacturer, Espressif Systems, must continue to work.
ESP32 “deepsleep” and wakeup
The following pins support the wake-up function in the “deepsleep” mode:
In addition, the MCU becomes briefly active every 10 seconds and makes the white LED briefly flash as an activity indicator. However, this is done without starting up the MCU completely. Every minute (definable) the MCU is completely started to allow programs to periodically check if there is any task to do – this saves power. The following functions affect the sleep time and the number of passes:
|Function||Default||Min … Max|
|ESP32SetDeepSleepDuration(int ms)||10 000 ms||200 … 1 200 000 ms|
|ESP32SetDeepSleepBlinkDuration(int µs)||100 µs||Recommended up to 10 000, to avoid a significant increase in energy consumption|
|ESP32SetDeepSleepWakeupInterval(int count)||6 passes||After the passes have been completed, a wake up takes place (total time = passes x duration)|
ESP32 “sleep” and wakeup
sleep() function is used when there are no tasks left to do. It lets the current CPU sleep and waits for events such as interrupts, timer, etc. The complete memory is preserved and the peripheral continues to run. Usually a system interrupt occurs 1 000 times a second, therefore white LED lightly flickers. The “sleep” function also saves energy, preventing the CPU from heating up. However, despite “sleep”, approx. 55 mA are still required, in “deepsleep” merely approx. 800 µA.
sleep() function is executed within the
loop() function as soon as no task is to do anymore. An infinite loop within the loop (polling) is not recommended and should be avoided. Clean programming should be event-driven and not use polling. This applies not only to the ESP32 but to all programs, also under Windows, Linux, Mac, and in particular in embbeded applications.