Arduino ports used

I have the emonTX version 2.5 shield for arduinos. My plan is to monitor the current draw for four different items in an HVAC system. I have an UNO, an Adafruit LCD shield with buttons, and a LIPO battery shield. I can get the UNO, LIPO shield, and the LCD shield to play nice with each other. The world falls apart when I add the emonTX shield to the stack. The LCD no longer displays and the buttons don't respond. I removed the LCD from the stack and ran jumpers from A4, A5, 5V, and GND on the emonTX shield to the LCD and still didn't get anything on the LCD. I removed the emonTX shield from the stack and jumpered A4, A5, 5V, and GND from the LIPO shield to the LCD and it worked fine.

The LIPO shield uses I2C to report battery status and that is what I am using so far to verify that I have some functionality on the LCD.

What pins on the UNO does the emonTX use? I don't have the wifi option. If it uses I2C, then what is it's address? With my luck, I might have an address conflict. I found a diagram here (http://openenergymonitor.org/emon/emontx/reference) that looks like nearly everything is used for the wireless module that I don't have. If this is really the board I have, then it looks like it uses the UART port of the arduino and one interrupt pin.

pb66's picture

Re: Arduino ports used

I'm pretty sure you are right about the I²C being the issue, ADC4 and ADC5 pins double up as the SDA/SCL lines and ADC4 is used on the emonTx shield for CT4.

I'm not familiar with stacking arduino shields but can you either remove a ADC4 stacking pin and put the emonTx at the top or remove the burden resistor for CT4, either way you won't be able to use CT4 and I²C.

Paul

EDIT - another option that might be worth investigating is maybe using a software I²C library and mapping I²C away from ADC4 if you must have the display and 4 CT's

jeffreamartin's picture

Re: Arduino ports used

I found a software version of I2C that allows me to pick two pins for I2C. Which leads me back to my original question. Is there a port map for the shield? Since I am not using the RF portion (it's not on my board at all), those ports should be available. I would think that the port map for the emonTX would be the same as the shield since the emonTX is effectively a shield already glued to an Arduiino. That would also make the sketches and library work the same. Is that a true statement?

Robert Wall's picture

Re: Arduino ports used

There isn't a formal port map on the Wiki. The port map for the emonTx is a starting point, but the Shield has some lines selectable by jumpers/links, which are on the circuit diagram. That is accessible from the Wiki, and should give you all the information you need.

jeffreamartin's picture

Re: Arduino ports used

I ended up using a Mega instead of a Leonardo or Uno. In order to get your shield to fit, I had to use an extra set of pins to create more separation. Your shield doesn't include the SCL and SDA pins on the digital side, so I used another set of pins to raise my LCD and left off the A4 and A5 pins. I jumpered the SCL and SDA pins from the Mega to the LCD. Now that works. I also used some of the other Mega pins and a SparkFun OpenLog to log the data. Everything seems to be working, but I need to verify the current readings. I have the CTs plugged in but they are just sitting on my desk (i.e. not around a powered wire). I am getting apparentPower readings anywhere from 9 to 40 amps.

Robert Wall's picture

Re: Arduino ports used

"I am getting apparentPower readings anywhere from 9 to 40 amps."

I don't believe 9 - 40 A unless you have an extremely high current CT connected. Normally, with a 100 A CT and the emonTx calibrated to match, we expect a few hundred mA, i.e. significantly below 1%.

It is a fairly safe bet that what you are seeing is noise. The act of calculating the rms current (and to a much lesser extent the rms voltage) involves squaring the readings, which automatically means that random noise is rectified along with the wanted signal. We believe the noise originates in the digital circuits inside the processor and travels into the analogue side via the analogue reference voltage. There's little you can do about it, other than adding a voltage input and measuring real power, as the main influences are the design and layout of the Arduino board.

It the noise is constant, you can mitigate the effect by subtracting a constant value somewhere - either in the sketch or in emoncms.

dBC's picture

Re: Arduino ports used

The power supply is often a source of noise, and that is something you may be able to improve.  How are you powering it all?... i.e. where does the 5V come from?  Do you have a schematic for the exact Arduino you're using. Have a read of this thread as well:  http://openenergymonitor.org/emon/node/10111

jeffreamartin's picture

Re: Arduino ports used

I am powering the Mega 2560 (not a clone) via the USB port. I am using the 9VAC power supply that came with the shield for Vrms. I am also using four SCT013 100A CTs.

I assume that the readserial is outputting amps and not milliamps since this device isn't really designed for low power measurements. Is it safe to assume that the realPower and apparentPower commands also output amps and not milliamps?

I just had a thought (it hurt, too). I am on a ship, surrounded by metal bulkheads (walls for landlubbers), 480VAC power cables for heaters, fluorescent lights, and computers. Even though the CTs are closed and there are no wires passing through them, do you think that they might be picking up that much noise?

I took about 700 samples at about a one second rate. I removed the first 50 to get rid of the initial power-up values that get averaged out. Irms is ranging from 0 to 1.5 with an average of , realPower is ranging from -7.67 to 14.2, apparentPower is ranging from  0.6 to 181.39. Vrms is ranging from 121.26 to 124.39. CT1 apparentPower seems to be picking up more noise in that, while CT3 had the highest value, the minimum reading for CT1 apparentPower was 25.31. I dumped my data into a spreadsheet.

 

CT1

realPower

CT1

apparentPower

CT1

Irms

CT1

Vrms

CT2

realPower

CT2

apparentPower

CT2

Irms

CT3

realPower

CT3

apparentPower

CT3

Irms

CT4

realPower

CT4

apparentPower

CT4

Irms

653 samples
Average 0.954 33.843 0.275 123.119 1.048 10.820 0.088 3.126 18.487 0.151 1.030 14.681 0.119
Max 9.02 146.49 1.18 124.39 8.73 63.5 0.52 14.2 181.39 1.46 10.24 52.11 0.42
Min -7.67 25.31 0.21 121.26 -3.76 1.13 0.01 -5.61 6.75 0.05 -2.83 0.6 0

 

Robert Wall's picture

Re: Arduino ports used

If you're using the standard 'discrete samples' sketch, powers are in watts, apparent powers in VA, currents in amps, voltage in volts.

So you're seeing less than 15 W in an input that's good to 12 kW at your system voltage.

As I explained above, apparent power is always more susceptible to noise because all the noise current is rectified and averaged, and not multiplied by the voltage and then averaged as is done for the real power calculation.

One thought: are you running at 400 Hz?

jeffreamartin's picture

Re: Arduino ports used

Watts. Well I'll be darn. That makes a world of difference. That means what I am seeing is really in the mud. That is great! Thanks!

Robert Wall's picture

Re: Arduino ports used

Well, it has to be said that most people measure powers in watts or a multiple (or sub-multiple) thereof!

dBC's picture

Re: Arduino ports used

You may find your RMS noise values improve a lot if you power your Arduino via the DC-IN jack, rather than the USB port.  At the moment you're at the mercy of the quality of your 5V USB supply.  Some of those can be quite low ripple, but generally it's not a requirement for most applications so they aren't.  If you power it via the DC-IN jack, you'll get to enjoy the benefits of the Arduino's onboard linear regulator.  There's more in that link I posted above.

jeffreamartin's picture

Re: Arduino ports used

Everything is 60Hz. I am using this for something that I don't think it was really designed for. Nearly all the comments on these forums is regarding measuring power at a house meter or solar panel. In that case, watts reigns supreme. I am more interested in amps since I am digging inside equipment to investigate an intermittent problem. At that point, amps reigns supreme. That is where my head was (and not in a dark, stinky place!) and I wasn't even thinking about watts.

Once I get back to the ship after Christmas, I'll have to try using an alternative power supply.

Thanks for all y'alls help, and y'all have Merry Christmas and a Happy New Year!!

Comment viewing options

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