DC + AC sensors on EmonTxShield + EmonBase

Hi Folks, so the plan is to get datas from 5 DC sensors + one general AC sensor. The system is running on 12V for DC and 220V for the AC.

The Hardware:

  • 5 x acs712 sensors ( http://fr.aliexpress.com/item/30A-range-Current-Sensor-Module-ACS712-Module/2038552144.html )
  • 1 x Arduino Uno 
  • 1 x EmonTxShield
  • 1 x EmonBase with RFM12B (433Mhz)

What Ive done:

 

  • I've assembled the emontxShield and plugged it on the an arduino Uno.
  • I've also upgraded the firwmare (Shield_CT1234_Voltage) with  the serial monitor showing:

"emonTX Shield CT123 Voltage example
OpenEnergyMonitor.org
Node: 6 Freq: 433Mhz Network: 210"

  • I've connected an acs712 sensor as described there: http://goo.gl/V3Ab0l and it's working fine (with the sketch on the page ).
  • I've installed emonCMS (v9) + emonHub on the EmonBase as described, everything seems to work properly there.

Remark: There is no leds on the emonTxShield. Should there be a green one? Ive built the shield according to ( http://wiki.openenergymonitor.org/index.php?title=EmonTx_Arduino_Shield#... )

Now, my questions:

  1. - What sketch should I upload to the Arduino to get all the data needed from the DC sensors (V + A) ? Ive modified the actual one but not sure its working: http://pastebin.com/Wegx1c9s​
  2. - How do I make sure the EmonTxShield/Arduino Uno and the EmonBase are wirelessly connected via the two RFM12B ? (I don't see any Led turning on except when the EmonBase is booting)
  3. - How do I add proper inputs on EmonCmS for the DC sensors and the AC/CT one.

Here a picture from the install: 

Thank for your help !

Ressources: http://henrysbench.capnfatz.com/henrys-bench/the-acs712-current-sensor-w...

Robert Wall's picture

Re: DC + AC sensors on EmonTxShield + EmonBase

"There is no leds on the emonTxShield. Should there be a green one?"

There is a position for a LED on the shield. Was one not included with your kit? If not, email the shop with your order number.

As far as I know, there are no fully engineered sketches for a dc input on GitHub, however there is a sketch on the "DC Shunt" page in Building Blocks which may be helpful. I don't look at sketches on 3rd party sites, so I can't comment about any other. If you want people here to see your sketch, attach it to your post here.

You need to configure emonHub to see the inputs in emoncms. See http://openenergymonitor.org/emon/modules/emonpi

rubensben's picture

Re: DC + AC sensors on EmonTxShield + EmonBase

Hi Robert and thanks for the answer.  In fact no led in the kit, but not critical since I just need to be sure the emonTxShield works fine. At this purpose I realized I got an error when browsing to  http://raspberrypi/nodes

Fatal error: Call to a member function exists() on boolean in /var/www/emoncms/Modules/nodes/nodes_controller.php on line 76

Any clues with that ? Im guessing it's a configuration problem. I'm using Emoncms  9 RC2 | on Raspbian Jessie following this https://github.com/emoncms/emoncms/blob/9.0/docs/RaspberryPi/install_Raspbian_Jessie.md

Update 1:

At least, no problem in the emonhub.log : 

2015-11-01 15:50:10,035 INFO EmonHub Pre-Release Development Version (rc1.2)
2015-11-01 15:50:10,036 INFO Opening hub...
2015-11-01 15:50:10,037 INFO Logging level set to DEBUG
2015-11-01 15:50:10,038 INFO Creating EmonHubEmoncmsReporter 'emonCMS_local' 
2015-11-01 15:50:10,040 INFO Set up reporter 'emonCMS_local' (buffer: memory | size: 1000)
2015-11-01 15:50:10,041 INFO Setting emonCMS_local url: http://localhost
2015-11-01 15:50:10,042 INFO Setting emonCMS_local apikey: set
2015-11-01 15:50:10,043 INFO Creating EmonHubJeeInterfacer 'RFM2Pi' 
2015-11-01 15:50:10,044 DEBUG Opening serial port: /dev/ttyAMA0 @ 38400 bits/s
2015-11-01 15:50:14,052 INFO RFM2Pi device firmware version: [RF12demo.12]
2015-11-01 15:50:14,054 INFO RFM2Pi device current settings:  O i15 g210 @ 433 MHz q1

 

Update 2

Ok Ive disconnected the shield to see if there is a difference in the serial monitor and noticed that data where sent unlike when the shield was connected. I'm guessing now that something is wrong with the shield. Strange thing as Ive paid attention when soldering. Everything seems to be in order

Update 3

Ok the shield thing is fixed ! Strangely the I had to plug the jumper on "Digital 3" as I'm using an Arduino Uno, pluging it on "Digital 2" doesn't show any datas. Im trying now to transmit them but nothing in emonhub.log. How can I make sure the Shield is sending them over the RFM69Pi ??

Update 4

Magic/Wagic, I just had to set #define RF69_COMPAT to 1. funfunfun!

rubensben's picture

Re: DC + AC sensors on EmonTxShield + EmonBase

Ok the big question now : Is it possible to monitor datas both from acs712 DC sensors (plugged from A0 to A5) and CT sensors of the EmonTXShield ? I got fixed values when pluging the DC sensors on A1-A2-A3-A4 (whereas it works well on the Arduino). Is this normal ? If not I guess I haven't soldered well the shield ^^

Robert Wall's picture

Re: DC + AC sensors on EmonTxShield + EmonBase

I don't understand what you are trying to do. Are you really connecting the ACS712 output to the CT input of the shield? If so, that will never work - those inputs are specifically designed to accept a current transformer.

If you wish to use those inputs with a dc signal from the ACS712, you can either remove the pins that transfer the signal between Shield and Arduino from the connector, or you can remove the burden resistors (R16 etc) and connect to the ADC inputs using GND and the sleeve of the input jack.

I didn't realise you had the SMT Shield - is the LED missing? It should be factory-fitted and is near the centre of the board. It's Dig9.

rubensben's picture

Re: DC + AC sensors on EmonTxShield + EmonBase

Im trying to connect ACS712 sensors directly to the Analog input of the arduino (via the shield) + at the same time plug one CT sensor. But from what I understand the Analog inputs have been linked to the CT sensors.

I guess I have to use 2 arduinos, one for ACS712 sensors only (plugged via UBS), and another one with an EmonTxShield for the CT sensor 

The led is working fine on the SMT shield :)

 

Robert Wall's picture

Re: DC + AC sensors on EmonTxShield + EmonBase

"But from what I understand the Analog inputs have been linked to the CT sensors."
Indeed. That's the general principle behind the Shield. It carries the signal conditioning circuitry and the radio.

You need to get and look at the circuit diagram for the Shield. There are 6 ADC inputs, all 6 are brought to the Shield but only 5 are used, ADC0 is the ac adapter voltage input, ADC1-4 are the 4 CT inputs. ADC5 is not used. As I mentioned above, by removing the burden resistor on the current input (or R13 & R14 for the voltage input) the input conditioning circuitry on the Shield can be disconnected to allow you to make a direct connection to the ADC input. That would, given that those 6 inputs are sufficient for your needs, remove the need for a second Arduino.

rubensben's picture

Re: DC + AC sensors on EmonTxShield + EmonBase

Thanks for the light Robert, very kind :)

rubensben's picture

Re: DC + AC sensors on EmonTxShield + EmonBase

Ok Almost there and last wall before I success with this install. Im now done with the DC sensors but get a problem with the CT sensor on the EmonTxShield to measure Watts on the alternative current (220V)

The datas gived bythe arduino+emonTxShielf with the "Shield_CT1234" are very random. Here are the averages based on 1 minute time (I'm using a wattmeter as a reference).

CT1 at 3W : 1100 0 0 0  /  CT1 at 30W :  1000 0 0 0 

CT2 at 3W : 0 350 0 0 / CT2 at 30W : 0 150 0 0 (a lot of variations, ranging from 90 to 400)

CT3 at 3W : 0 0 ??? 0 / CT3 at 30W : 0 0 ??? 0 (datas are rangin from 90 to 1100, with too much variations to establish something relevant)

CT4 at 3W : 0 0 0 300 / CT4 at 30W : 0 0 0 200

Any clues on what's wrong ? The raspberry + shield are powered in DC via a 5v USB cable. I don't think Ive made mistake with the soldering (but not 99% sure)

Here is a picture: 

Thx in Advance for help, kind of urgent

Robert Wall's picture

Re: DC + AC sensors on EmonTxShield + EmonBase

That is certainly not correct. I cannot remember anyone having this problem before.

As well as your wattmeter, what test equipment do you have?

Which type of CT are you using, have you checked the resistance with a multimeter - you should read about 100 Ω between the plug tip and the plug sleeve for the standard "shop" one. There is no connection to the plug ring. (This picture is NOT a plug on a CT - there is only a red and white wire connected on the CT.)

What do you measure with the CT unplugged?

Carefully check the soldering of the pins that carry the analogue signal to the Arduino - labelled ADC 0 - 4 on the emonTx. With ac adapter and the CTs unplugged, you should measure a steady 2.5 V dc on all 5 pins. See below.

rubensben's picture

Re: DC + AC sensors on EmonTxShield + EmonBase

Thanks for the answer Robert (you are my guru on this one).

- So Im using the SCT-013-000. Im indeed reading 102 Ω between the tip and the sleeve. White and Red wires are connected,

 

- I can't check the wattmeter's model right now but it's pretty accurate.

- unplugged, I read "0" on the others CT sensors (after few seconds, I guess for calibration). 

- Im measuring a 220V Alternative Current (pluged on one cable. Ive checked both actually and get the same weird datas)

- Thanks I'm gonna check the circuit :)

Robert Wall's picture

Re: DC + AC sensors on EmonTxShield + EmonBase

Which sketch are you using? I assume it a "shield" sketch.

I was wrong when I wrote "With ac adapter and the CTs unplugged. You should measure a steady 2.5 V dc on all 5 pins." You need to plug an empty jack plug (or a CT off its cable) into the connector to read 2.5 V. With the CT unplugged, you should read 0 V. (I'd forgotten that the shield also detects the CT by shorting the input to GND when no plug is present.)

If a check of the soldering shows nothing unusual, try loading Robin's Raw Samples tool http://openenergymonitor.org/emon/sites/default/files/RawSamplesTool_4ss...
(You'll need to change voltageSensorPin = 2 and currentSensorPin = 1 to the pins that the shield uses, 0 for voltage and 1 - 4 for current.)

With your CT off the cable, you should see an approximation of a sine wave for voltage and a straight line for current. With the CT on its cable and if there's current of course, you should also see a sine wave, in phase or 180 ° out of phase with the voltage.

rubensben's picture

Re: DC + AC sensors on EmonTxShield + EmonBase

Yes It is a shield sketch. Alright will do the checks and come back here ASAP.

THX

rubensben's picture

Re: DC + AC sensors on EmonTxShield + EmonBase

Ok ~2.43 on each CT's when an empty jack is plugged and 0 when not plugged. Gonna go with the Robin's Raw Samples tool

rubensben's picture

Re: DC + AC sensors on EmonTxShield + EmonBase

Ok Got this with CT off the cable AND with CT on the cable and "measuring" alternative current.

It's coming from the CT right ? Maybe I should roll the positive cable one or two time inside the CT's sensor ?

No of cycles recorded = 3
cycleCount 2304,  samplesRecorded 18
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
minVoltage 510,  maxVoltage 511,  minCurrent 511,  maxCurrent 512

 

rubensben's picture

Re: DC + AC sensors on EmonTxShield + EmonBase

Alright this is what I get when the CT is off AND on the cable (measuring current). Strange hein ? I guess it's coming from the sensor ? An idea on how can I check that ?

No of cycles recorded = 3
cycleCount 554,  samplesRecorded 51
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
|                                      c.                                       |
minVoltage 510,  maxVoltage 511,  minCurrent 509,  maxCurrent 510

Raw data from stored cycle: <Vsample>,<Isample>[cr]
51, <<< No of sample pairs
511,509
510,510
510,509
510,509
510,509
510,509
510,509
510,509
510,510
510,509
510,510
510,510
510,510
510,510
510,510
511,510
511,510
510,510
510,510
510,510
510,510
511,510
510,510
510,510
510,510
510,510
510,509
510,509
510,509
510,510
510,510
510,510
510,510
510,510
510,510
510,510
510,509
510,510
510,510
510,510
510,510
510,510
510,510
510,510
510,510
510,510
510,510
510,510
510,510
510,510
510,510

Robert Wall's picture

Re: DC + AC sensors on EmonTxShield + EmonBase

Where is your voltage input signal? Robin's test sketch won't work without a voltage input. So if you don't have a voltage input for it to get a timing reference from, we must abandon that idea.

Is it a completely unmodified shield that you are using? You were going to use ACS712's for some inputs, but I cannot see any changes.

What power supply are you using? If you do not have a good 'clean' power supply, you can have all sorts of problems. See http://openenergymonitor.blogspot.co.uk/2011/08/not-all-usb-power-supplies-are-created.html

rubensben's picture

Re: DC + AC sensors on EmonTxShield + EmonBase

Ok Im using a different arduino for analog inputs.
This one is a shield on another arduino where i only plug one Ct. It's powered by the blue Usb cable supplied with the arduino.

I confirm thats an unmodified shield im using.

I will check for an external 9v power suply but I dont need it since I told the sketch im on 220v right?

Robert Wall's picture

Re: DC + AC sensors on EmonTxShield + EmonBase

Without a voltage input, you will only be able to calculate an estimate of 'apparent power'. You do not need it for the standard sketch, but you do for Robin's test sketch - which did not work correctly for you.

rubensben's picture

Re: DC + AC sensors on EmonTxShield + EmonBase

Alright, this is what I get when plugged a 9v input on the arduino shield and CT Off the cable

|                                      c.         v                             |
|                                      c.         v                             |
|                                      c.         v                             |
minVoltage 647,  maxVoltage 654,  minCurrent 511,  maxCurrent 511

And this with 9v and CT on the Cable 
|                                       c         v                             |
|                                       c         v                             |
|                                      c.         v                             |
|                                      c.         v                             |
minVoltage 647,  maxVoltage 654,  minCurrent 511,  maxCurrent 512

I in fact see a sinus on the current and linear curve on the voltage. Look's good yes ?

rubensben's picture

Re: DC + AC sensors on EmonTxShield + EmonBase

The last reply was for CT3. This is that I see on the others CT's. Im using an AC/DC 9v plug (couldn't find an AC/AC around Paris and don't think I will find it on time, it's pretty rare).

CT1 (sin on v)
|                                       c          v                            |
|                                       c         v                             |
|                                       c         v                             |
|                                       c         v                             |
minVoltage 647,  maxVoltage 654,  minCurrent 513,  maxCurrent 513

CT2 (sin on v)

|                                      c.          v                            |
|                                      c.         v                             |
|                                      c.         v                             |
minVoltage 646,  maxVoltage 654,  minCurrent 506,  maxCurrent 506

CT3-1 (sin on c and v)
|                                      c.          v                            |
|                                      c.         v                             |
|                                       c         v                             |
|                                       c         v                             |
|                                      c.         v                             |
|                                      c.         v                             |

minVoltage 647,  maxVoltage 654,  minCurrent 511,  maxCurrent 512

CT4 (sin on v)
|                                      c.          v                            |
|                                      c.          v                            |
|                                      c.          v                            |
|                                      c.         v                             |
|                                      c.         v                             |

|                                      c.         v                             |
minVoltage 647,  maxVoltage 654,  minCurrent 505,  maxCurrent 506

rubensben's picture

Re: DC + AC sensors on EmonTxShield + EmonBase

Hi Again, 

Here is my config:

I'm using a AC/DC 9v converter. Couldnt find a AC/AC converter in Paris and don't think I will before tuesday.What is plugged is a battery charger for CANON cameras.

When the CT sensor is unplugged from the cable

CT1 ( c = moving. v = moving )

|                                      c.         v                             |
|                                      c.         v                             |
|                                      c.          v                            |
minVoltage 647,  maxVoltage 654,  minCurrent 508,  maxCurrent 509

CT2 ( c = moving. v = moving )

|                                      c.         v                             |
|                                      c.         v                             |
|                                      c.          v                            |
minVoltage 647,  maxVoltage 654,  minCurrent 505,  maxCurrent 506

 

 

CT3 ( c = moving. v = moving )

|                                      c.          v                            |
|                                       c         v                             |
|                                      c.         v                             |
minVoltage 647,  maxVoltage 654,  minCurrent 511,  maxCurrent 512

 

CT4 ( c = linear. v = moving )

|                                      c.         v                             |
|                                      c.         v                             |
|                                      c.          v                            |

minVoltage 647,  maxVoltage 654,  minCurrent 511,  maxCurrent 511

 

When the CT sensor is plugged from the cable and should measure the AC of the Canon Charger (cf picture above)

CT1 ( c = moving slightly, v = static)

|                                       c         v                             |
|                                      c.         v                             |
|                                       c         v                             |

minVoltage 649,  maxVoltage 651,  minCurrent 511,  maxCurrent 515

CT2 ( c = moving slightly, v = static)

|                                       c         v                             |
|                                      c.         v                             |
|                                       c         v                             |

minVoltage 649,  maxVoltage 652,  minCurrent 511,  maxCurrent 514

CT3  ( c = moving slightly, v = static)

|                                      c.         v                             |
|                                       c         v                             |
|                                       c         v                             |
|                                       c         v                             |

minVoltage 650,  maxVoltage 651,  minCurrent 510,  maxCurrent 513

CT4  ( c = moving slightly, v = static)

|                                       c         v                             |
|                                       c         v                             |
|                                      c.         v                             |

 

minVoltage 649,  maxVoltage 651,  minCurrent 509,  maxCurrent 512

HMmmmmm?

 

 

 

 

 

 

 

rubensben's picture

Re: DC + AC sensors on EmonTxShield + EmonBase

I have a 100A:50mA sensor, maybe I should get a lower one ? 

Watts on my system are ranging from 2.5 to 300. (220V). 

rubensben's picture

Re: DC + AC sensors on EmonTxShield + EmonBase

In fact 

300 W = 1.3 A x 220v

100 W = 0.45 A x 220v

2W = 0.01 A x 220v​

 

Robert Wall's picture

Re: DC + AC sensors on EmonTxShield + EmonBase

Don't use the DC converter, it won't do the job. We want the shape of the voltage wave, not the power. Any 6-9 V transformer is usable for a quick test.

You might read 300 W with the setup you have, but accuracy will very poor. First, use as many primary turns as you can through the CT, then remove the burden resistor on that channel and replace it with a much higher value. You will be aiming for about 1.6 V rms at the maximum current that you want to measure.

Your CT is 100 A : 50 mA. With (say) 6 turns in the primary, the ratio becomes 16.66 A : 50 mA, and you calculate the burden resistor value on that basis. So for a maximum current of 1.5 A, the CT will give you 4.5 mA, you need a 620 Ω burden resistor. The more turns you can get, lower the burden resistor value and the better it will be (but beware of heating in the coil you're creating).

Comment viewing options

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