exmonTx Shield CT to ADC Pin allocation incorrect

Hi All,

Just soldered up the shield and put it on an Arduino Leonardo but noted the CT number on the shield and the ADC pins on the Leonardo have different numbers. In the library. I see the following. Where as voltage on the shield is ADC0 and CT1-4 are ADC1-4. Am I missing something or is the library incorrect?

// Sets the pins to be used for voltage and current sensors based on emontx pin map
//--------------------------------------------------------------------------------------
void EnergyMonitor::voltageTX(double _VCAL, double _PHASECAL)
{
   inPinV = 2;
   VCAL = _VCAL;
   PHASECAL = _PHASECAL;
}

void EnergyMonitor::currentTX(int _channel, double _ICAL)
{
   if (_channel == 1) inPinI = 3;
   if (_channel == 2) inPinI = 0;
   if (_channel == 3) inPinI = 1;
   ICAL = _ICAL;
}

Robert Wall's picture

Re: exmonTx Shield CT to ADC Pin allocation incorrect

Yes, you are missing something. There is a separate demonstration sketch for the emonTx Shield: https://github.com/openenergymonitor/emonTxFirmware/tree/master/emonTxSh... and you should be following that.

The methods you cite are for the emonTx (not the shield version).

cavemoa's picture

Re: exmonTx Shield CT to ADC Pin allocation incorrect

Thanks Robert,

The shield examples use the emonLib library that I had pulled the code from. Once change in the lib the shield work as expected. Until then plugging CT's in produces weird results of course.

#include "EmonLib.h"

 

 

Robert Wall's picture

Re: exmonTx Shield CT to ADC Pin allocation incorrect

I don't understand what you are trying to say there.

The methods called in the emonTx Shield examples use the same emonLib library that was initially written for the emonTx, and the same class (the one and only class) in that library. The only difference is in the methods used to set up the private properties within the class instance.

If you look at the library source file, all should become clear.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.