Current Reading

Hey guys !

So I am new to this forum but I have falling inlove with the Arduino concept and deiced to do my college project with it.

I am basically trying to make a clone of an APC PDU,

Right now I am struggling on two things.

1) Finding a separate "relay switching" chip to control 8 different relays, the catch is, these are 16 amp relays and not the relays you can conveniently connect to the Arduino, the relays I have found need 24 volts to activate the coil. I have found this chip.

http://www.nxp.com/files/analog/doc/data_sheet/MC33298.pdf

Will this chip do what I need ?

2)I need to have a current sensor on each plug (there are 8 of them). Now I have seen that a lot of people use the ACS712 chip but to my knowledege these chip will not be able to handle a 220v 16 amp load. So I then came across the circuits that use a current transformer. After doing some brief reading I decied to buy a current transformer yesterday when I was at the electrical shop and do some testing on it.

This is the one I bought

http://www.gmelectronic.com/img/cache/doc/610/952/ac-1005-datasheet-1.pdf

Now I dont know how the ratings for these components work but it look like it can read current between 1 - 60 Amps which is more than efficient.

Can some recommend how I can hook this component up to my Arduino.

Also would it be possible to get a chip that can have 8 inputs and then the Arduino can send a signal to that chip and tell what which data it wants to receive from the chip ?

Note I am using the Arudino Uno with a Ethernet Shield.

Byron

That looks (at first glance) like a reasonable chip assuming the relays don't need more coil current than what the chip can sink, HOWEVER, I would make sure I could get my hands on some of those chips before charging ahead - both digikey.com and mouser.com don't have them and show they are "end of life". As far as reading current goes, one item you kind of implied but did not state clearly is what you are measuring the current of - from the mention of "220v" I assume it is AC power you are measuring. A current transformer can give you the current in the wire, but you need to make sure you configure the current transformer correctly (with a burden resistor etc.). Recognize that in the AC world, if the load is not purely resistive, then the current will usually be shifted in phase from the voltage somewhat. Also, many AC "thingies" do funny things as far as when they turn on in a cycle (fluorescent lights often are strange) so depending on exactly what you are trying to accomplish with the current reading, you may find it a bit more "interesting" than you expected. That is what comes to mind to start with.

Thanks gpsmikey for the reply !

Thats exactly what I want to do with the Current TF, I want to hook it up to the plug that the relay turns on.

I want to basically read how many watts/amps the device connected is using.

If I cant find those Chips what alternatives could I use ?

Byron

You could use discrete MOSFETS - there are a number of them that would work. I don't have a number off hand (I am using IRL520's for my project, but that is overkill for what you are doing - search the forum here for other MOSFET (or FET) questions and see what others have posted. If you go that route, you need to put a protection diode across the relay coil .... hmmm - just had a thought - are you using 24v AC or DC with the relay coils? (here in the US, 24vac is common for things like control relays, doorbells and other such things). If the coils are using 24vac, then you need to switch it differently.

I was double checking the relay I had and it actually requires 220 v ac to activate the coil,

But I will be using this one

http://www.gmelectronic.com/relay-with-dc-coil-12v-finder-40-61-9-012-0000-p634-038

Coil U 12 V Coil R 220 Ohm Coil I 55 mA Coil R 0,65 W

So I would rather need a low side or high side relay driver that can supply 12v to 8 of these.

concerning the Current TF looking that the specifications sheet there is this graph

In the graph there are numbers in white boxes among the lines are these resistors that can be placed on the TF that will change the Voltage output ?

Example: if I put a 100 ohm resistor on it and there is 1 amp of current flowing through it I will be getting 0.1 volts out of the current TF ?

Simple open drain shift register such as TPIC6C595 or TPIC6B595 can sink 55mA per output from 12VDC for 8 of those relays.

It looks like you have good help with your 1st question already.

For your 2nd question, yes those CTs would be fine for measuring the AC current. Do you see the schematic in the bottom right of its datasheet? You need to select a resistor such that the max/min currents you expect to measure result in voltages less than 5V (Vcc) of the Arduino. You would be best to have a signal that is 5V/2 when the current is zero, and then swings between 0V - 5V.

After this, it depends on how accurate you want to make this. As gpsmikey pointed out above, electronic loads are not going to draw sinusoidal currents. They can have crest factors up to 3, meaning you need to scale your A/D signal such that 48A (3*16A) will result in 5V at your Arduio.

The next problem will be the ADC range to satisfy the maximum currents will make it difficult to measure small currents accurately (all of those small currents add up over time). To deal with this, I actually chose my burden resistor to give me more signal than I needed. I then used a mux/opamp circuit to 1) select an adjustable gain, 2) add my Vcc/2 offset, 3) filter above the nyquist frequency, and 4) provide a low impedance signal so that I could sample all of the currents very quickly.

You have said "power" which means you must have a voltage measurement. Do you have plans for that? It is discussed in this thread where I also included a model to show how to calculate the RMS voltage. Measuring RMS current would be very similar, where power would be summing v*I over one cycle and then averaging. I implemented the code for the RMS calculation here, although there are 3 todos in there that would make the code much better.

A last note about CTs. Do you see the schematic in the bottom right of its datasheet? Where current flowing in the primary is trying to force a voltage across whatever RL you put on the secondary? Well, if you disconnect RL completely, then it equals infinity (well, not quite...the insulation resistance is only 100MΩ). The CT isn't really going to create 500kV, but it could start to shake and make noise and generally be very unhappy.

BigBobby: A last note about CTs. Do you see the schematic in the bottom right of its datasheet? Where current flowing in the primary is trying to force a voltage across whatever RL you put on the secondary? Well, if you disconnect RL completely, then it equals infinity (well, not quite...the insulation resistance is only 100MΩ). The CT isn't really going to create 500kV, but it could start to shake and make noise and generally be very unhappy.

No, look at the chart "Output Volts vs Input Current For various ohmic load" on the same page. Now follow the infinite ohms line to the maximum test current, 60A. The output voltage is 15V.

aarg: No, look at the chart "Output Volts vs Input Current For various ohmic load" on the same page. Now follow the infinite ohms line to the maximum test current, 60A. The output voltage is 15V.

I did say "the CT isn't really going to create 500kV." The actual voltage it's going to saturate at is going to be much lower.

All I was trying to express to the OP was that he doesn't want to run current through a CT without a burden resistor connected.

The datasheet includes the infinity curve not because they expect customers to operate there, but because 1) it shows the limits on burden resistor value and 2) shows where the CT output voltage saturates.

They don't show it in the spec sheet listed, but it has the feeling of having something like a 20k internal "burden" resistor if you look at that chart. Unloaded current transformers can do some really wacky things, but the closer you get to about 20k, the closer the lines on the chart get to each other.

gpsmikey: They don't show it in the spec sheet listed, but it has the feeling of having something like a 20k internal "burden" resistor if you look at that chart. Unloaded current transformers can do some really wacky things, but the closer you get to about 20k, the closer the lines on the chart get to each other.

I'd need to compare actual numbers from the graph, but the change in the ratio with burden value seems too nonlinear to be explained by a potted 20kΩ.

I worked at APC for 10+ years btw (almost 10 years ago). I believe the OP is interested in the rackmount PDUs which I did not work on, but I did work on their higher power PDUs that are still sold today. My CTs would be mounted on busbars and then plugged into my PCB. A common mistake in mfg was for the CTs to be disconnected, which would look possessed when current flowed through the product.

The founder of APC once called it "making lightning" in a similar circuit. In this case we were driving toroidal transformers to boost or buck different phases of the 3 phase AC so that we could test the high power products' response to phase imbalance. When the test was started the transformers were open circuit...they were probably 25lbs yet dancing.

A friend of mine used to work at Kaiser Aluminum and his stories about how things acted if you were near the huge bus bars used to feed the pot lines was interesting. Some serious magnetic fields there !!

gpsmikey: A friend of mine used to work at Kaiser Aluminum and his stories about how things acted if you were near the huge bus bars used to feed the pot lines was interesting. Some serious magnetic fields there !!

A problem with flexible cable in these applications, is that they can move with enough force in a short circuit event to bend steel.

True - I have seen "magnetic forming" where intense magnetic fields are used to cause steel to form to a mold. That will reset your watch for you :)

CrossRoads: Simple open drain shift register such as TPIC6C595 or TPIC6B595 can sink 55mA per output from 12VDC for 8 of those relays.

Thank you Crossroads for the recommendation, after reading your post I purchased 5 of these chips off ebay

It was a hastily purchase since I was leaving for Berlin that morning.

Now I was looking at the datasheet for this chip and here is the pin configuration

My understanding of this is that Vcc is power supply to the chip, in the specification table it says Vcc voltage supply should be between 0.3 and 7 Volts, So I can supply 5 volts to this chip and the logic part of it will operate, but where does the 12v feed go into the chip that ?

After looking more at the datasheet I assume that the chip controls the ground connection to the relays and not the 12V+ Supply. Here is a basic diagram I drew of how I assume it should be hooked up

Another question is how exactly will this be connected to the Arduino ?

Now concerning reading the current off each relay,

I read the post that BigBobby directed me to.

You recommended that he used a step down Transformer and just tap of the actual wire that has the load on it, but Im using a current transformer to measure the current.

BigBobby: You have said "power" which means you must have a voltage measurement. Do you have plans for that? It is discussed in this thread where I also included a model to show how to calculate the RMS voltage. Measuring RMS current would be very similar, where power would be summing v*I over one cycle and then averaging. I implemented the code for the RMS calculation here, although there are 3 todos in there that would make the code much better.

Knowing the voltage would be nice but I am aiming to measure just how many watts/amps are being drawn of a plug.

Could someone recommend me a circuit I would make to use with the Current Transformer I have purchased ?

Bskitter: Knowing the voltage would be nice but I am aiming to measure just how many watts/amps are being drawn of a plug.

You can't measure Watts without measuring the voltage.

If you want to assume Vrms = 220V, you can multiply Vrms * Irms but that will get you Volt-Amps...not Watts. Unless your load is a simple resistor or a PFC power supply, Watts are not equal to Volt-Amps.

12V does not connect to the shift register. The "top" (anodes) of the LED string connects to 12V, the "bottom" of the LED string connects to an output pin, which when driven makes the connection to Gnd to turn on the LEDs.

You can also just measure the voltage across the 10 ohm resistor and calculate the current flow for a segment.
V/R = I, voltage/resistance = current flow.

Connections, see attached.


I like SPI.transfer to send data to the shift registers. Say you had two of them daisychained as shown here:

digitalWrite (ssPin, LOW); // ss from 10, SCK from 13, MOSI from 11.
SPI.transfer (byte0);
SPI.transfer (byte1);
digitalWrite (ssPin, HIGH);  // outputs change on this rising edge

Or use shiftOut(dataPin, clockPin, MSBFIRST, dataByte);
but it's a lot slower.
Since your making 7-segment displays, you can use arrays also:

byte fontArray[] = {  dp-g-f-e-d-c-b-a
0b00111111, // 0        a        1 = segment on
0b00000110, // 1   f         b
0b01011011, // 2        g
0b01010111, // 3   e         c
etc                               d
};

in loop:
digitalWrite (ssPin, LOW);
SPI.transfer (fontArray[byte0]);
SPI.transfer (fontArray[byte1]);
digitalWrite (ssPin, HIGH);

Or use shiftOut(dataPin, clockPin, MSBFIRST, dataByte);
but it's a lot slower.

So I need to know Amp and Volts in order to get Watts.

But I must I connect my Current Transformer to start getting inputs,

Like what burden resistor must I use ?

Here is an example they give in the datasheet

So my interpretation of this is that there is 5 Amps of current going threw the CT and they are using a 100 ohm burden resistor and they are getting 0.5 Volts out. This is congruent with the Output Volts Vs Input Current Graph.

From looking at the Output Volts Vs Input Current Graph to get an output voltage between 0 and 5 volts I can use a 100 Ohm resistor since there would never be more than 16 Amps going through the CT.

After that Can I just run those two wires straight into the Arduino ?

CrossRoads ! You Boss, thank you for that ! I cant wait for these chips to arrive So I can try it out !

Should I have a resistor from the 12v+ to the Relay ? like you have it on the drawing you posted ?

Bskitter: After that Can I just run those two wires straight into the Arduino ?

No - I would at least put a resistor (say 5k or 10k) from the output of the current transformer to the Arduino input. While you say the load will not go over 16 amps, sooner or later, either a startup spike or something bigger will get plugged in driving the input to the arduino over the 5v range. Also recognize that the output from the current transformer is AC not DC, so it is important just where in the cycle you are measuring it (you also need to offset the output of the transformer with a bias so that it does not go negative relative to ground (Arduinos and most other chips do not like things that go negative relative to ground)

Bskitter: From looking at the Output Volts Vs Input Current Graph to get an output voltage between 0 and 5 volts I can use a 100 Ohm resistor since there would never be more than 16 Amps going through the CT.

You mean 16Arms, I assume? If the load was a pure resistor, then that current is going to peak at +/-22.63A.

Most loads aren't pure resistors, however, and the peak currents will be higher. It is not uncommon to have crest factors of 3, meaning your peaks would be +/-48A.

This was detailed in my first response, at to why the current measurement is more complicated than the voltage measurement.