Hi to All,
As described in my post Multichannel Home Electricity Monitoring System I succeeded to run EmonLibCM on Olimex AVR-T32U4 board (Arduino Leonardo compatible) using all 12 ADC inputs as single ended and everything works fine. Later on I have made some steps to investigate usage of HWCT-5A/5mA current sensor. All this is described in Multichannel_Home_Electricity_Monitoring_System.pdf and on the Olimex forum tread.
Next step in my plan was to test using of differential inputs on ATmega32U4 MCU. As expected selection of corresponding inputs/gain combination works fine but the result is wrong as amplitude. Because of added by me ability to capture and print ADC raw data I see that the problem comes at switching between single ended and differential channels. Probably the problem comes from the need of more time like described in ATmega32U4 datasheet:
Special care should be taken when changing differential channels. Once a differential channel has been selected, the stage may take as much as 125μs to stabilize to the new value. Thus conversions should not be started within the first 125μs after selecting a new differential channel. Alternatively, conversion results obtained within this period should be discarded.
One possible solution is to double first differential input and discard the first sample. I tested this by scanning only differential channels and it works fine. Doubling first differential input is possible because the channels sequence used by me is to scan first single ended inputs and then differential once.
Is there another solution of this problem?
Thanks in advance