Measure ac using current transformer and Arduino Nano

I have what appears to be a simple project, to measure mains current (240vac) in the range 0 - 50 A ac, create an adjustable trigger point within the software, and energise a relay once the measured current exceeds the trigger point. The relay will switch low current at 24vdc.

The measuring device at present is a clamp-on current transformer producing about 1 vac at 50 A, so a typical trigger point will correspond to about 0.5 vac (as measured by my digital voltmeter).

Ultimately, and as my skills with the Arduino develop, I would like to have a web based interface so I can monitor the current drawn, and maybe log/integrate it...but let's not run before walking!!

I was initially going to build a common emiter transistor amplifier to bring the input signal up to a reasonable 3-5 vac level before rectifying it and connecting to an analog input pin of the Nano, but became intrigued by others' solutions to similar problems, suggesting using the ADC of the Nano to 'read' the input waveform and thereby do the signal processing in software. Given a 50Hz input frequency can the Nano read an ac signal fast enough to approximate the RMS value of the input? Bear in mind that accuracy is not as important as repeatability - see project description below, for those interested.

So there it is, one simple question with a lot of padding around it, all in context I hope!

Extra info: The project revolves around control of an electric heating system in a flat.
The heating system comprises a 6 kW electric boiler. The maximum demand in the flat (before the supply trips at the meter 3 floors below!) is 12 kW (about 50A). The device I want to build will shut off the heating by using the relay to trick the room thermostat into believing the desired room temperature has been reached, and the relay will do this once the power consumed by the other electrical appliances exceeds 6kW, and will de-energise the relay once consumption falls below a predetermined hysteresis value of, say 2kW or 8A.

. Given a 50Hz input frequency can the Nano read an ac signal fast enough to approximate the RMS value of the input?

Yes. You can just read in a "fast loop" to find the peak (every so-many milliseconds). You know it's a sine wave so you know the peak is about 1.4 times the RMS voltage.

...You may want to calculate a moving-average so that one short spike doesn't trigger a shut-down.

You do have to deal with the negative-half of the AC cycle. The most common solution is to bias the ADC input at 2.5V with two equal-value resistors, then "isolate" the bias with a series capacitor.

But, you could also use a [u]diode+resistor protection circuit[/u] to block the negative voltage. Then, you could switch to the optional 1.1V ADC reference which would give you more resolution.

(I can't help you with the web interface.)

P.S.
I recommend you consult with an electrician to solve the root problem. :wink:

DVDdoug:
P.S.
I recommend you consult with an electrician to solve the root problem. :wink:

Fantastic. Thanks for the answer. I'll read up on using the ADC; this will make the project much simpler and neater, and probably more reliable.

Regarding the supply 'problem'; it isn't. The flat is in Andorra, and they seem to limit consumption by limitting the peak power any residence may consume. The flat used to have gas fired heating, but with the standing charge at about 50 Euros per MONTH it became expensive. The 50A supply is AFTER an upgrade from a 20A supply!!!

Just one more Q if I may. You mentioned biasing the input to 2.5v to allow for the negative half of the wave. In my application I really only need to measure the approximate peak of the positive cycle, as the input will be sinusoidal and symmetrical with stable frequency.

Do I need to avoid negative inputs to protect the Arduino's internal circuitry?