### 8 lines + water and gas

Hi,

I have been reading on these forums for some while but havent posted much. But now i want to start building something for myself.

I am planning on building setup using a arduino due. I want to monitor 8 lines and also the water and gas usage. The max current per line is 16A (i live in the Netherlands). For the current transformers i have found some through hole 20A, 200 turns sensors. The plan is to place 8 of these on 1 circuit board, and wire it to the arduino.

By using these  sensors i should have the same circuits as discribed in the blog on boredomprojects

Im not quite sure i made the correct choice, any help on choosing the right sensors would be welcome. :)

### Re: 8 lines + water and gas

This is a give-away, from the top of the data sheet:

"Designed for switching power supply applications
Frequency range from 20kHz to 200kHz"

Your mains frequency of 50 Hz  is quite a long way outside the specified range.

I believe Robin Emley uses either the 20 A version here: http://www.yhdc.com/en/product/425/ or this 20A:10mA one http://eppep.com/?action-viewnews-itemid-140364 from http://www.ebay.co.uk/itm/281436762683?_trksid=p2059210.m2749.l2649&ssPa...

### Re: 8 lines + water and gas

Tnaks for the links, I will have to choose between a TA17 CT sensor and one from Triad  both have aprox the same specs.

For the gas and water meter I want to use optical sensors. Just order some stuff and its playtime ;)

### Re: 8 lines + water and gas

The Triad CST-1020 does appear to have an adequate VA rating for a 5 V Arduino.

### Re: 8 lines + water and gas

I have been doing some calculations, with the 2nd link provided by Robert. Its a 1:2000 20A-10mA CT.

At 16A mains -> Isec = 8 mA.  8 * sqrt(2) = 11.3 -> 22.6 mA peak to peak.

For the Arduino Due input is 3.3 V -> 3.3 / 22.6mA = 146 ohm burden resistor.  This can be done by using a 130 + 16 ohm resistors in series.  Using 2* 47 Kohm as a voltage divider will give a current draw per measuring line of 0.035 mA.

According to this page a capacitor should be used. I cant really figure out the function of it, but I suppose its useful so I will place them also :)

The hardware is being ordered. Next is digging into the code en figure out how it calculates the currents etc.

### Re: 8 lines + water and gas

The capacitor is there to provide a low impedance path to GND so that the full burden alternating voltage appears at the ADC input. Otherwise, you have 23.5 kΩ, the Thevenin equivalent of the bias resistors, in series with the burden and the input impedance of the ADC, and some of alternating component of the voltage that you want to appear at the ADC input will instead appear at the junction of the resistors.

You don't in fact want 3.3 V peak-peak across your burden resistor, but about 5% less. Remember component tolerances, you must assume they will always add up the worst possible way and that has the effect of reducing the input range available. I aim for 1.1 V rms across the burden. There's a piece in Building Blocks "Sources of error in the emonTx voltage and current inputs." about their effect, and while it doesn't explicitly state how they affect your choice of burden, it should give you a general idea of what to consider.

### Re: 8 lines + water and gas

Ok thanks, that clears it up (a bit)

A whole other subject. Now the plan is to use the arduino as the collector of the inputs. It sends its data to a raspberry pi. The pi can present the data via a webinterface.

Is it a feasible route to cut out the arduino and use a Pi as a collector for the inputs. I don't need any wireless communication and i have found breakout boards available for the pi. Connecting 8 analog inputs and 2 puls counters to the Pi could be possible?

### Re: 8 lines + water and gas

I can't answer that directly. I'd say probably, but you need to take into account what processing power you have in the Pi and whether it is possible to prioritise the tasks, because you need to sample the analogue inputs regularly in order to be able to calculate the averages. When you write "breakout boards", you actually need analogue to digital converters because my understanding is the Pi natively does not have any analogue input capability.

### Re: 8 lines + water and gas

The arduino due:

A 32-bit core, that allows operations on 4 bytes wide data within a single CPU clock.
CPU Clock at 84Mhz.
96 KBytes of SRAM.

RPi 2 B :

A 900MHz quad-core ARM Cortex-A7 CPU

40pin extended GPIO

It seems to me the Pi has a lot more power to do calculations. I don't need wireless communication because I plan to hook it up via ethernet, so in my opinion I can use all in-outputs for the sensors.

I haven't seen much on this topic, to have 1 Pi do the data acquisition and act as a base station. I have tried to search the website and forum but a lot of hits are generated on de emonPi.

### Re: 8 lines + water and gas

As far as I can remember, nobody has written about adding a analogue input card/shield/whatever to a Pi. The emonPi is actually a slimmed-down emonTx and a Pi in the same box, communicating serially, so not working the way that you want to. So I think that if you do add an analogue input to a Pi, you're pioneering the development of a new device.

### Re: 8 lines + water and gas

This project:  http://openenergymonitor.org/emon/node/10561 went one step further and added an energy IC and analog MUX to an RPi.   That offloads the time critical stuff to the IC and just leaves the RPi to orchestrate everything.

But if you do want to do all the energy maths yourself in C, then as you say it's hard to imagine your RPi won't be better at it then an Arduino (even a SAM based DUE).  One advantage the Arduino approach has is the code you write is the code that runs on the CPU so it's entirely deterministic how long each instruction will take. Whereas if you write it as a  Linux process, it will be competing for resources along with dozens of other processes.

With that much grunt, it's hard to believe it could be a problem and If nice-ing your energy process wasn't sufficient to fix it, there are other options as well.  You can restrict the kernel scheduler to just 3 cores, and run your energy process on the 4th core.  Check out isolcpus and taskset if you want to go that route.  Or you could even push your time critical energy stuff down into the kernel.

### Re: 8 lines + water and gas

mmm, that makes me think. My programming skills are close to zero, so starting a project like this and straight away start writing all custom code etc doesn't seem the wisest thing to do. :)

According to this page it is possible to hard wire a emontx to a RPi. I will start my project by using a Arduino Due and a RPI 2B  in combination with through hole CT sensors.