How to use ac-ac adapter to read voltage

Hello there.

I'm currently using an emonTx Shield V1, and I have 4 CT current sensors. This is almost ideal to me, but the problem is I need to be able to get the values of the real power, apparent power, powerfactor, etc, for each of the 4 circuits i'm reading. 

If I understant correctly, I can do this using the ac-ac adapter. I understand the "waveform scale down" schematic. my problem is that the example code of the VOLTAGE_AND_CURRENT example is:

##############################################################################
#include "EmonLib.h" // Include Emon Library

EnergyMonitor emon1;              // Create an instance

void setup() {     

Serial.begin(9600);      

emon1.voltage(2, 234.26, 1.7);  // Voltage: input pin, calibration, phase_shift   

emon1.current(1, 111.1);        // Current: input pin, calibration. }

void loop() {   

emon1.calcVI(20,2000);          // Calculate all. No.of crossings, time-out   

emon1.serialprint();            // Print out all variables }
############################################################################

My problem is that, since I have 4 CT sensors, I use something like this:
#################################################################
emon1.current(1, 111.1);        // Current: input pin, calibration.

emon2.current(2, 111.1);        // Current: input pin, calibration.

emon3.current(3, 111.1);        // Current: input pin, calibration.

emon4.current(4, 111.1);        // Current: input pin, calibration.

##################################################################

And the sample code provided states that the input pin for the emon1.voltage is the input pin 2.

Does this cause any kind of problems in the readings of the currents and apparent and real power?

Also if not, what I have to do is something sort of like this:

##################################################################

emon1.current(1, 111.1);        // Current: input pin, calibration.

emon1.voltage(1, 234.26, 1.7);  // Voltage: input pin, calibration, phase_shift 

emon2.current(2, 111.1);        // Current: input pin, calibration.

emon2.voltage(2, 234.26, 1.7);  // Voltage: input pin, calibration, phase_shift 

emon3.current(3, 111.1);        // Current: input pin, calibration.

emon3.voltage(3, 234.26, 1.7);  // Voltage: input pin, calibration, phase_shift 

emon4.current(4, 111.1);        // Current: input pin, calibration.

emon4.voltage(4, 234.26, 1.7);  // Voltage: input pin, calibration, phase_shift 

#####################################################################

I'm asking because I haven't ordered the ac-ac adapter yet, and so I cannot test this by my self. Also, is the "scale down circuit" really necessary? And if so do I have to make 4 of those circuits, one for each of the CT current sensors?

Thanks in advance for any help you guys can provide.

Best regards,
João Almeida.

Robert Wall's picture

Re: How to use ac-ac adapter to read voltage

I think you were looking at the wrong sample code - the code you copied is not for the emonTx Shield.

First, a question: Do you have a single phase supply or a 3-phase one? If you do not know, ask your electricity supply company, or a local qualified electrician, or look here for some things that might help you.
Assuming that you have a single phase supply, you will use one of the sketches with "voltage" in the name - like https://github.com/openenergymonitor/emonTxFirmware/tree/master/emonTxShield/Shield_CT1234_Voltage

If you have a single phase supply, you do not need 4 voltage inputs. The voltage is the same, to within a very small tolerance, throughout your house, therefore it is normal to measure at one place only. But you MUST use the shield with the correct ac adapter that it was designed to be used with. The correct voltage divider for the ac adapter is already part of your emonTx Shield. You do not need to add anything else.

João Almeida's picture

Re: How to use ac-ac adapter to read voltage

First I'd like to thank you in advance for the quick response Robert.

As for the sample code, I got it from the Emonlib examples.

Regarding the first question, I currently have a single phase supply, although I suspect that later on in my project I'll have to switch to a 3-phase supply.

Now I feel dumb, because as you said, of course the voltage is the same. I don't even know why I said or even thought that, so I apologize for my "momentary brain freeze" xD

So, from what you said, me having a system with 4 CT current sensors, and the ac-ac adapter, I can use the sample code you provided, giving it a few alterations, for example, that code strikes me as if the system is communicating with another system trough some kind of wireless device (which I don't need to do), am I right?

Anyway, I'll order the ac-ac adapter and will give it a try once I get it.

Once again, thank you very much for your help Robert, and again, I apologize for the "dumb" question I posted.

Best regards,
João Almeida.

Robert Wall's picture

Re: How to use ac-ac adapter to read voltage

You are correct about using the radio. On the emonTx Shield, there is a RFM12B radio module that sends data to an emonBase (these days a Raspberry Pi) that can either operate a web server that receives the data and stores it locally using emonCMS, and then displays it on a web page; or with an Internet connection via your router, it can forward the data to emonCMS.org where you can have an account and store and examine your data on-line.

That is the normal way in which we view the data collected. You can if you wish use an Ethernet Shield or a direct serial connection instead of the radio.

If you do not have a RFM12B module fitted in your Shield, then you must remove (or comment out) the lines that control the RFM12B. If you do not do this, the sketch will hang and not go past that line.

If you do progress to a 3-phase installation, then we have "3-phase" sketches that use a delayed copy of the first phase voltage to compute an approximation for real power etc on the second and third phases. "Approximation" because it assumes the voltage on all 3 phases is identical, which of course is not guaranteed. If that is not good enough, then you need to ask somebody who knows about shields whether it is possible to stack 3 and communicate with them separately. I suspect you cannot. An alternative to that is 3 emonTx's stacked (http://openenergymonitor.org/emon/node/1170) or as you originally suggested - 2 extra voltage inputs using spare analogue I/O channels on your Arduino.

dBC's picture

Re: How to use ac-ac adapter to read voltage

then you need to ask somebody who knows about shields whether it is possible to stack 3 and communicate with them separately

There's nothing magical about shields.  Those IO pins simply pass on up through the headers.  From a schematic point of view, wherever you see A2 on your Arduino schematic, and all your shield schematics, they'll be connected.  As a general rule you can stack as many shields as you want, so long as they don't conflict on IO pins. Additional constraints might come into play like power requirements, signal integrity etc.  Also, some signals (like MISO, MOSI and SCLK on the SPI bus) are designed to be shared, so they wouldn't be considered a conflict (provided unique /CS signals are chosen for each device on the SPI bus).

Some shield designers go to some lengths to improve stackability, for example by adding dip-switches, jumpers etc. to allow the end user to configure which IO pins the shield connects to.  A quick glance at the emonTx shield makes me think it wouldn't be stackable as you'd have multiple shields driving the same analog inputs at the same time.

Comment viewing options

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