Test with 24-V LEDs
Since the last time I’ve managed to get the ADC running to measure voltage and current. It required design of certain circuits. The ESP32 ADC module is no big deal. It is very weak. The ADC does not have any automatic trigger and does not have any interrupts at the end of conversion. There is an option of the ADC connection to the I2S which uses the DMA and interrupts. I considered this option although it is a little overkill for the voltage and current measurement in this case. Unfortunately, it is out of question due to random samples loss.
Finally, I had to stick with the manual trigger from a timer interrupt. The sample readout and ADC reconfiguration are done in another interrupt. Here I expect the sample will be measured in a defined time (with certain reserve).
The ADC itself does not measure very precisely. Lower and upper 100 mV are practically immesurable. So, when measuring in the 0 – 3.3 V range I am only able to use the 0.15 – 3.15 V region. Moreover, it is necessary to compensate the ADC curve. In other words, it is the one of the worst ADCs I have seen in my life.
Despite that challenge I managed to write an algorithm to get the voltage and current and yet with some filtration.
I have also designed a small box for the control board. It will be necessary to adjust it a little. But I already have a certain idea on size when I get down to the control board design.
I spent a lot of time creating unit tests. I would say from Christmas until May. Tests writing is not too much visible. But it is tens of thousands of lines of important code that discovered bugs and weak points. The tests helped me to discover missing memory deallocation for instance. Such a bug would shown up after a while when the system ran out of memory.
The following video shows two tests with the 24-V LEDs:
- From sunrise to sunset. LED power reaches 42 W.
- Slow sunrise from 0 to 0.1 % a minute.