Cheap current sensors

 Apologies if this has been answered elsewhere but I couldn't find any references.

I have two energy monitors which were supplied by electricity suppliers, one from British gas the other from Npower.

They both use clip on sensors which look identical, I would like to recycle these sensors and interface then to an arduino.

They produce an output in the AC millivolt range and from research are Hall effect devices?

If anyone has successfully interfaced these I would be V interested in how they did it.

I have tried a voltage divider to bias the signal as suggested for a CT sensor but this does not seem to work maybe because the signal is too weak?

I have some LM358N op amps on order which I was going to have a play with.

Any suggestions?

Thanks

Robert Wall's picture

Re: Cheap current sensors

I've not come across one of those. The best suggestion I have to find out what is inside is to open it up - carefully.

Alternatively, if it is a Hall Effect transducer, it's very likely you will get no output if you connect it to only a multimeter on an a.c current range (because the Hall IC needs a supply!), whereas a current transformer without an inbuilt burden resistor will typically read about 50 mA output at max current (usually 30 - 100 A).  A c.t. with a built-in burden resistor will typically give 1 V at max current.

Once we know what is inside, we might be able to take it further. (And don't worry about short-circuiting a c.t. - that's how they're designed to work).

Andygodber's picture

Re: Cheap current sensors

 Kalamgish - can you post pictures?

 

Ive successfully used 're-purposed' clamps from EDF and Biritsh Gas meters, but these were of the CurrentCost branded versions.

kalamgish's picture

Re: Cheap current sensors

I have actually got this reading now with a bit of tweaking the voltage divider and aref values.

here is a link to the product anyway.

 www.greenenergyoptions.co.uk/assets/media/smartpower_piccolo_manual.pdf

 

Looks like a split ferrite ring which goes round the cable, is that what an ordinary CT sensor uses?

Robert Wall's picture

Re: Cheap current sensors

It does sound like a standard split-core current transformer. Does it loook like the ones here http://openenergymonitor.org/emon/buildingblocks/report-yhdc-sct-013-000... and here http://openenergymonitor.org/emon/node/476

kalamgish's picture

Re: Cheap current sensors

 Yes looking at those images I'm pretty sure that my sensors are of the same design.

I am only looking to use these for an immersion switching application (what else...) so as long as I can get a reasonably accurate reading I'll be happy.

I will have to do some testing to try and calibrate (if we get any sun this summer !).

Thanks.

Robert Wall's picture

Re: Cheap current sensors

Frankly, I would have been very surprised had it been other than a normal split-core c.t. Your next problem will be to get some idea of the maximum current (the manual implies around 100 A [edit] states 75 A ) and the ratio; and the maximum output voltage that it is capable of before distortion becomes too great.

You can get an approximate calibration of your c.t. using known loads. If you are intending to control towards zero current (rather than accurately measuring consumption), then calibration is not particularly important - you only need to know that current is not close enough to zero and in which direction. If however you feel you need greater accuracy, you might find some hints in the Report: Yhdc SCT-013-000 Current Transformer (though of course you are unlikely to have the equipment to replicate many of the measurements!).

Many contributors to these forums are working on similar schemes to the one you propose. I do know that Calypso_Rae in particular is working towards measuring the nett current (the intake current) and looking to burst-fire control his immersion heater so as to balance exactly the generated power.

kalamgish's picture

Re: Cheap current sensors

 Well I am only really interested if my output - input is > a threshhold value, the values I am getting although fairly crude (+/- 100Watts) should be good enough as I will leave at least that as a margin for error.

I have bought a 1kW immersion and have a 4kW PV system.

I have a working prototype now albeit just turning on an LED.

Two main concerns.

1. Can I get the blanking screw off the cylinder!

2. Will the inevitable continual cycling of a relay to control the immersion have any long term implications.

Robert Wall's picture

Re: Cheap current sensors

1. I can't help you with the blanking screw.

2. I would not use a relay - you will need to replace it quite frequently due to contact wear. It will be far better to use a solid-state solution, i.e. a triac. My recommendation would be to burst-fire the triac on zero crossings so that you switch when voltage and current are close to zero and always send complete cycles of mains to the heater.  It will give you much closer control (i.e. less probability of buying power you don't need and of selling power that you could otherwise use) because you can control down to one cycle on or off. You could have a 4 kW immersion heater with that sort of control. Burst firing avoids having to include bulky and expensive filtering components that you would otherwise need to suppress the interference that phase control would give. I've asked Calypso-rae to contact you.

calypso_rae's picture

Re: Cheap current sensors

I have successfully used a LF358 op amp to buffer the 2.5V reference point, as per http://openenergymonitor.org/emon/node/673 .  It runs nicely from the Arduino's on-board +5V supply.

As I understand it, one point of the standard sensor loop needs to be anchored to Vref, and the AC voltage at a different point is then measured by the Arduino.  The voltage between these two points is caused by an AC current flowing through a burden resistor.  If the resulting voltage were to be very small, then I suppose it could be pre-amplified by an LM358 before being fed to the Arduino.  But with the ADC having 1024 levels, just a few mV apart, I doubt whether this should be necessary.

My system only measures current at the supply point, and I am only really interested at low levels of power.  If my current-detector saturates when our household consumption is high, that's not a problem thanks to Glynn's protection diodes!  But when a controlled amount of power is being dumped to the immersion, and just 50W or so is being exported (my chosen margin of safety), then I trust that my current-measuring system is behaving linearly, as intended.

Most PV control systems to date appear to have used a 3rd party device with which to distribute surplus power.  Mine uses a Carlo Gavazzi controller at around £79, and others use a Crydom which may be a little cheaper.  Each of these devices can distribute power evenly within the 'energy window' that modern supply meters appear to allow. 

A relay may be OK if you're just switching something on and off fairly infrequently, but it would not be able to track the amount of spare power during changing conditions.  You may be interested in a set of videos that I posted at

http://openenergymonitor.org/emon/node/176?page=4  on 8th, 9th and 27th May this year. 

PS. If you're anywhere near M62, J7, I have one of those big octagonal spanners which I believe you're looking for.  :)

 

 

 

kalamgish's picture

Re: Cheap current sensors

Calypsoe_rae > Your set up looks very impressive, the ability to continuously variable output is attractive.

I think I will get my system working as is first then consider refinements.

 The way I have got my sensors working is to have a voltage divider with the output fed into analog pin 1 and adjusted so I get a reading of approx 512.

One wire from the CT is then sent to the divider output and the other to analog pin 2, this will give the AC signal the maximum +/- range. I then have a procedure to sample pin2 and take the max value over a set of readings (500 seems to work).

Re the immersion cap, what a nighmare! I ended up drilling it out and came close to needing a new cylinder but I am actually powering the immersion with the sun as I write this....

 

 
Robert Wall's picture

Re: Cheap current sensors

"One wire from the CT is then sent to the divider output and the other to analog pin 2, this will give the AC signal the maximum +/- range. I then have a procedure to sample pin2 and take the max value over a set of readings (500 seems to work)."

I see what you're doing there, but unless you subtract the pin 1 reading, I think your readings are susceptible to drift, which will give you large time, temperature or age-dependent errors at low currents. The 'standard' approach is to use a high pass filter in software to remove the offset, then obtain the average power by taking a few cycles' worth of instantaneous readings of voltage and current at the rate of about 50 per cycle, multiplying them in pairs to give the instantaneous power, then average that. If you're only measuring the peak current, you are open to errors resulting from interference (possibly) or a distorted current waveform generated by switched-mode power supplies.

calypso_rae's picture

Re: Cheap current sensors

 kalamgish >One wire from the CT is then sent to the divider output and the other to analog pin 2, this will give the AC signal the maximum +/- range.

Hi, is there any resistance across your CT?  As posted on a separate thread, I've just found that my current waveform is way too small for my needs, so increasing the burden resistor would seem an obvious way to go.  When I removed my external 39R burden entirely a month or to ago, the monitor software gave huge readings which suggested that no internal burden was fitted.  But when I checked inside, a pair of internal resistors were definitely there, so it all seemed to be very confusing.

Given the high impedance of the Arduino's analogue inputs, I would have thought that the C/T's signal amplitude could be increased more or less as much as desired by simply increasing the resistance of the burden .  But if there is no burden at all, the sinusoidal readings are likely to turn into a 50Hz square wave.

I like your approach for removing the dc-offset without any extra hardware or high-pass filters.  When measuring both voltage and current to determine real power, the standard approach has two sets of readings, each with its own high-pass filter in software to remove the dc-offset that's introduced by its front-end circuitry.  I only use one (buffered) 2.5V reference, so the dc-offset will always be the same in both cases.  Routinely taking a third set of measurements for the reference, and then subtracting this value from each of the other two is an interesting idea. 

I wonder whether this alternative approach would have any pitfalls that I've failed to consider?

 

 

 

 

 

Robert Wall's picture

Re: Cheap current sensors

     NEVER OPERATE A CURRENT TRANSFORMER WITHOUT A BURDEN

calypso_rae  - read my report on the yhdc c.t. and you'll see what happens. The core will saturate and you will get very high voltage spikes if you operate the c.t. without a burden. You cannot get what voltage you like out of a current transformer - just as you cannot get what current you like out of an (ordinary) voltage transformer. Duality?

 

Robert Wall's picture

Re: Cheap current sensors

Pitfalls in the alternative approach:

I see two:

1. It takes a lot longer to read an analogue input than it does to process the filter equation,

2. The number out of the filter equation is a float, which means that if the centre point happens to lie on the boundary of two LSBs and there's a bit of noise, it will average to a number much closer to the true voltage. Reading the midpoint voltage will only ever give you the nearest integer.

calypso_rae's picture

Re: Cheap current sensors

Sorry, folks, if my previous posting was ambiguous.
 
I was never intending that a C/T should be operated without any burden at all.  Rather, I was suggesting that the amplitude of my current-sensor's waveform could be usefully increased by raising the value of the burden somewhat.  I'm using an external burden resistor of 39R, and there may or may not already be a resistor inside.  
 
With appropriate care, I will experiment and report back in due course :)
dickielightbar's picture

Re: Cheap current sensors

 Hi 

I am working on a Solar PV diverter with some great results.

Could sombody explain what is meant by "energy window" of a modern meter. I think I know what you are getting at, I just want to understand what your definition of that window is.

Many thanks

calypso_rae's picture

Re: Cheap current sensors

As I understand it, modern meters have a 'sweet zone' of 0.001kWh within which no permanent data is recorded.  Once the grid-supplied energy strays outside that band, the customer is either billed for the energy that they've consumed (pulse seen at meter), or energy is permanently lost to the grid (LED stays on).  Within this zone, energy can be bounced in & out of the grid without cost (or loss) to the user.  Simple experiments with a kettle or similar should demonstrate the principle. 

The term, "energy window" is not an official one.  It was just a convenient way of describing what was going on when the topic was being debated a month of two back. 

dickielightbar's picture

Re: Cheap current sensors

 Thanks for clearing that up, I have a nice old analogue meter so I can clearly see the "window" before a little ratchet stops the dial going backwards. :-(

When I get the inevitable change to a digital meter I now know what code will need changing. Thanks again for the info.

PS i like the choice "sweet zone" very clear.

Thanks

Robert Wall's picture

Re: Cheap current sensors

I think you need to make sure you know how you will get paid for exported energy if it is not registered on your meter. .

dickielightbar's picture

Re: Cheap current sensors

Robert :-I don’t think you understand...
I am meaning the "energy window" on my household meter, I have a separate generation meter for the P.V. generation.
Most domestic solar P.V. installations are like this, with a "use it or lose it" on the generated electricity. With a FIT for 100% of the generation and a pittance (currently about 3p per Kwh) on the assumed export of 50%.
Hence the whole point of diverting excess to the immersion heater.
Even if I had a true digital import/export meter I would rather divert/use it at a 3p value than buy it in later at an 8p value.
I hope you understand:- that’s why solar P.V. was a no brainer until the government started to lower the tariffs.

calypso_rae's picture

Re: Cheap current sensors

dickielightbar:-   Most domestic solar P.V. installations are like this, with a "use it or lose it" on the generated electricity. With a FIT for 100% of the generation and a pittance (currently about 3p per Kwh) on the assumed export of 50%.
Hence the whole point of diverting excess to the immersion heater.

A nice, succinct explanation of the strange way that FITs have been set up :)

Robert Wall's picture

Re: Cheap current sensors

dickielightbar

I didn't understand because you didn't even say which country you were in. You should not assume we all have a crystal ball - I sometimes forget to clean mine, then it doesn't work too well.

[And if you read up on digital meters, you'll find that they can be (and I think for many it is the default) set up so that energy in either direction is registered as consumption - it's an anti-fraud measure. So if you had one of those installed to replace your analogue meter, you'd have been paying (8-3=5p on your numbers) for the privilege of exporting your energy to the grid. Yes that shouldn't happen but there are reports that it has].

kalamgish's picture

Re: Cheap current sensors

 I have got a working system now however I am a bit confused (not unusual).

I have got the output from the CT sensors going into a precision rectifier which I found some designs for (see attachments).

These can rectify signals whose amplitude is smaller than the 0.7v needed to forward bias a diode and they definitely work.

When I measure the output with a multimeter (no scope unfortunately)  I am getting a d/c output but also an a/c voltage.

I presume the a/c reading is because the output is a half wave and not really a/c i.e. +/-?

Is there any way to confirm this without a scope?

I was thinking of buying one of those cheap usb scopes on e-bay but they all seem to be restricted to 3kHz maximum frequency which would be ok for this I suppose but maybe a bit limited for other uses.

 

Robert Wall's picture

Re: Cheap current sensors

Have you considered using your computer sound card? That's how I produced the "scope" pictures in the reports on the YHDC c.t. and the Mascot a.c. adapter.

Your input voltage is limited to around 1 V p-p, and most likely referenced to mains earth (so beware earthing problems), but given the probability that you have one and its range can be extended fairly simply, it's worth looking at. If you use the software 'scope that I used, beware that the internal Y calibration is wrong by a factor of 2 (the author is aware, a new release is promised). Calibration is a real issue and depends on your sound card, so you need to be aware of that.

Returning to your original question, it depends very much on your meter. Most budget meters read on the a.c ranges the average value, but are calibrated to indicate rms of a sine wave. As your waveform is not a sine wave, the answer is wrong. If you know what the shape of the wave is, you can apply a correction factor.

And the explanation for the rectifiers working: it's the feedback loop around the op. amp. The op.amp. provides a voltage to offset the foward drop of the diode.

Should I ask why you want to rectify the c.t. output? In the reference sketches, rectification is done in the software; and in the VI sketches, it's phase sensitive so you know the direction of power flow. It may not be important to you, but if you rectify the current externally, you lose the ability to know the direction of power flow.

kalamgish's picture

Re: Cheap current sensors

 Brilliant!

Thanks very much for the scope link, definitely a square wave, see below.

The reason for rectification... my understanding is that the atmega/arduino analog inputs only like +ve inputs.

Direction of power seems to be sorted out by the placement of the sensors, again I'm not sure why but one is giving a reading proportional to the PV generation the other proportional to the usage, this seems counter intuitive to me as they both seem attached to the same wire, this was achieved by luck more than anything as there are only some wires the sensor will fit round.

Anyway.. I have a working system.

calypso_rae's picture

Re: Cheap current sensors

kalamgish: ... my understanding is that the atmega/arduino analog inputs only like +ve inputs.

Yes, that's correct.  If an AC signal based around 0V were fed into the Arduino, then only the upper half of the waveform would be seen.  To get around this problem, the standard approach is to bias the AC signal at 2.5V using a voltage-divider reference circuit. 

The voltage and current sensors both work in the same way; they create a small AC signal that is floating.   By tying one end of these circuits to 2.5V, the Arduino then receives signals that are centred at the mid-point of its input range.

I recently posted a tool which records and displays the raw values that are generated by my Arduino for mains voltage and current.  These waveforms are both centred around 512, that being mid way in the ADC's range of 0 - 1023.  By using this sketch, you would be able to check that the values that your Arduino is creating look OK.  You can vary the magnitude of the waveforms by changing your input components.  This tool, and a couple of images of my own results, are at http://openenergymonitor.org/emon/node/824

Hope this helps. 

Robert Wall's picture

Re: Cheap current sensors

kalamgish

Your 'scope picture isn't what I call a square wave! It's obviously a current waveform that's been half-wave rectified. If you measure this in the Arduino using our sketches, you will get a reading that is roughly proportional to current but it won't be totally accurate. I think you might find a simpler solution by copying the input circuitry and software that is used in the emonTx.

Read this http://openenergymonitor.org/emon/buildingblocks/ac-power-introduction which explains the relationship between voltage and current and how these are used together to measure power. Then read  http://openenergymonitor.org/emon/buildingblocks/measuring-voltage-with-... and http://openenergymonitor.org/emon/buildingblocks/ct-sensors-interface which explain in detail how the signals get in to the Arduino (as Calypso_rae mentioned above). Come back to me if you have any questions.

dickielightbar's picture

Re: Cheap current sensors

 

Apologies, I should have made it clearer, I have read up on digital meters and they have a very small window that we can exploit, typically 0.001 kwh (like 3kw for a fifteenth of a second).

Think about it...some capacitive and inductive loads would be seen as consumption if the meter was utterly unforgiving regarding the direction of power.

I have a digital export meter that is separate to my household meter so I think I will always be safe. But I do see your point.

Kind regards

Robert Wall's picture

Re: Cheap current sensors

dickielightbar

they have a very small window that we can exploit, typically 0.001 kwh (like 3kw for a fifteenth of a second)

Exactly. One fifteenth of a second is sufficiently longer than 1 cycle (1/50th) to allow us to exploit that property. Which is how and why calypso_rae's design works and has a pretty much instantaneous response to load changes.

With your analogue meter, you are much more likely to be exploiting stiction and inertia in the moving parts. I think the only way you would be able to quantify that would be to burst fire a known (resistive) load and watch for movement of the disk given various combinations of burst length and power (and then it would be meaningful only for your particular meter). And even better, if you could alternately burst-fire a known generated reverse power into the meter as well .... !

some capacitive and inductive loads would be seen as consumption if the meter was utterly unforgiving regarding the direction of power.

I don't think you said quite what you meant there, but yes, for part of the cycle a reactive load is returning energy to the supply (we call it 'circulating VArs') and if that were to be ignored, the (digital) meter would be capable of giving very wrong readings.

calypso_rae's picture

Re: Cheap current sensors

dickielightbar: Apologies, I should have made it clearer, I have read up on digital meters and they have a very small window that we can exploit, typically 0.001 kwh (like 3kw for a fifteenth of a second).

If you've managed to locate this information in an official manual, then well done!  No-one else has.  We've just found out by observation that 0.001W of ebb and flow appears to be permitted without charge or loss to the customer.

0.001kWh is 3600 Joules.  A 3kW load will take 1.2 seconds to consume this amount of energy, so any power-distribution algorithm needs to keep its activities to within this timescale.  The code that I've just posted at http://openenergymonitor.org/emon/node/841 operates within an energy window of around 100J and has a response time of <50mS. 

kalamgish's picture

Re: Cheap current sensors

 I meant to say half wave.... but funnily enough when my PV system is outputting >3kW the scope IS showing a square wave, or maybe a truncated half wave because the signal is overloading the input?

I have played about with the e-mon software etc but it seemed a bit of an overkill for my purposes. I have just transferred the circuit to veroboard, and incorporated the control system to run my hot water panels so I'm not going to be altering anything for a while.

Robert Wall's picture

Re: Cheap current sensors

kalamgish

It does seem probable that you are overloading something. My sound card input says "2dBv", so about 3.5 V p-p. The reason for the multi-turn pot in my test rig was to turn the input down to prevent overloading, and the resistor and diodes are there to prevent damage whatever happens. If you put a pot in between what you are measuring and the sound card, and turn it down and the peak does not move, you're overloading it!

 

dickielightbar's picture

Re: Cheap current sensors

Guys, I did not want to create an argument. We are all trying to achieve the same goal.

I did indeed find the energy window as described in a Landis & Gyr meter document.
Quote

3.4 Reverse / Export Energy registration
Three factory configurable reverse energy modes can be set as follows:
Export Energy Registration
A reverse / export energy register stores the value of kWh recorded by the meter in a reverse direction. The register may be configured as part of the display cycle of the meter. Alternately the register is held in memory and can be read from the meter via the IEC 1107 port. The Reverse energy register can be displayed with 0, 1 or 2 decimal places. Export energy will be recorded in the same way as forward (Import) flowing energy using identical starting currents etc.

Total Reverse
Reverse Energy Detection
A configurable option within the meter will alternate a warning message on the display should a fraud attempt be made by running current backwards through the meter. The reverse energy warning message is triggered when the reverse power exceeds a programmable threshold level of between 1- 10 Amps for a period of 10Wh. Once this level is reached the message below will be displayed which can only be reset via the IEC 1107 port. Whilst in this mode the LED will remain lit whilst there is reverse energy detected.

Robert Wall's picture

Re: Cheap current sensors

dickielightbar

Sorry, but that's actually what I was on about regarding fraud detection, it isn't the parameter that we're talking about when we say "energy window". The way I got to understand it was to go through the code that accompanies the Atmel application note (AVR465) that the emonTx is based on. In that, the accumulated power readings over a period are added up and the result transferred to the energy registers. It's that period that we're interested in - Atmel I think (from memory) used something like 200 ms. I'd need to check again. From what you said about reactive loads, it clearly needs to be more than 1 cycle, and it clearly needs to be as close as possible to an integral number of cycles. MrSharkey (who's since left the forums) got hold of a meter and did bench tests, and by driving known amounts of power over carefully timed periods backwards and forwards through the meter, he came to the conclusion that the lower limit for the energy to be transferred to the registers was 1 Wh, below that value it was ignored and discarded. He concluded that the time over which this happened was immaterial.  It is an assumption - but probably a very reasonable one - that most models of digital meter will behave similarly. But probably not identically.

A summary by MrSharkey ("anonymous") of his findings is here: http://openenergymonitor.org/emon/node/696#comment-4558 and that links to the thread with the main discussion.

calypso_rae's picture

Re: Cheap current sensors

If the LED on the supply meter were to be monitored, that information could conceivably be fed into the algorithm to reset/adjust/calibrate its data.  By this means, it should be possible for a virtual energy meter to be synchronised with the physical one.  Every Joule of surplus energy could then be safely utilised as required without need for a minimum level of export.  

I rather like the idea of a hardware latch which is set whenever a meter event occurs.  This could be polled every so often by the sketch, or maybe it should trigger an interrupt routine.  If the latch can be reset, then it must have been set by a pulse (when importing power); if it can't be reset, this means that the LED is still on (when exporting power).

 

kalamgish's picture

Re: Cheap current sensors

I'm just tacking this onto the thread I started, my monitor/controller is working fine however I want to add another sensor and output to the arduino.

The problem is I am using an 8 core cable to carry data and I have used 7 of the wires which leaves me one short.

My question is if I was to use the mains earth instead of my 0v line would that have any implications?

Thanks.

 

Robert Wall's picture

Re: Cheap current sensors

I have two concerns.

  1. It is quite possible that you will get totally wrong readings from the sensor if you do that. 
  2. In the event of an earth fault somewhere, the mains earth could end up at an elevated voltage while the fuse blows or the circuit breaker trips, damaging your Arduino and anything connected to it.

When you write "I am using an 8 core cable to carry data and I have used 7 of the wires..." what is the data and how are the wires used, i.e inputs from what sort of sensor, outputs driving what?  Is it possible to share another wire? (There might be another way).

But by far the best way is to run another cable, or use the old cable to pull in a new one with more cores.

Comment viewing options

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