Help with Current Transformer Circuit and Arduino (PDU clone Project) - Page 1
Forum section: electronics / beginners

author: Bskitter
author_rank: Regular Contributor
timestamp: April 05, 2016, 08:25:28 pm
content: Hey Guys, So im new to the Forum, I always watch Davids videos since they really interesting, I always wanted to study electrical engineering but ended up doing Computer Science and right now I have a project for my college, Im trying to make a clone of and APC PDU. I am using the Arduino with an Ethernet Shield to control the device, I will have 8 relays connected to a TPIC6C595 chip and control that chip with the Arduino. I also want to be able to measure the power consumption of each power outlet (there are 8 of them) I have seen many people use the ACS712 chip on their Arduino's but I fear that the current will be to large (I dont know if that is the correct term to use ) for the chip. The relays I am using are rated at 220v 16Amps I also want to put a fuse before each relay and a surge protector at the inlet plug.Here is a diagram that is totally not drawn in paint.And this is the complete project I want to makeI boughtthis CTat my local electronics storeThis is how the CT operates under different input currents and indicates what burden resistor I must use from this diagram it looks like I should use a 50 Ohm resistor to get an output between 0.01 and 5 volts but Ill only get 5 volts output if 60 Amps goes through it and I dont think that will ever happen since its a 16 Amp plug but tell me why I am wrong.I need 8 of these to read the current off each output as I mentioned above but the Arduino only has 5 Analog inputs, So ill need another Chip to connect the 8 CTs to and then get the Arduino to communicate to that chip to get the different readings.So Basically can someone help me put together a small circuit to get readings from this CT I have and what Chip can I use with the Arduino to iterate through the readings of each of the CT's.So far I have bought the following things for my ProjectA12 Volt Power supply that can Supply 6 Amps of current220V 16 Amp Relays with a 12V CoilAwaitingthese chipsAnd theCTmentioned aboveI also want to power the Arudino and the TPIC6C595 chip off the 12V supply but they need 5V inputs so I googled "12V to 5V circuit and this is the first one that popped up, is it sufficient any circuit that could do a better job that you guys could recommend ?My knowledege is super limited to electronics although I really love working with circuits and I am very keen to learn something out of this project.Pardon my incorrect phrases or terminology.

author: Lovely_Santa
author_rank: Contributor
timestamp: April 05, 2016, 10:46:04 pm
content: Hey Bskitter!First of all...Quote from: Bskitter on April 05, 2016, 08:25:28 pmLet's have a talk about the ACS712 chip... I know you are not familiar with this kind of stuff, so I try to explain it... When I open the datasheet I see this at the top:Fully Integrated,Hall Effect-BasedLinear Current Sensor IC with 2.1 kVRMS Isolation and a Low-Resistance Current ConductorIt's a Hall Effect based design, this means, it will use the magnetic field arround a wire to measure the current... For this to do (and this is why they use hall effect sensors) you need enough current. So this means for your 16A application, it won't smoke your application. An other side note: It will only blow up an application if the power dissipation (P=U*I) is too high... and as the resistor is only 1.2mOhm, this won't be a problem for only 16A.Conclusion: YES you can use the ACS712 chip if you want:The left side you need to connect in series, That's the 1.2mOhm resistor, where your 16A is flowing (Ip). Becose of the high current ability, there are 2 pin connections for each side...The right side is your measuring side: You apply 5V voltage, and it will give a voltage in the range of 0-5V analoge output. (between 66 to 185 mV/A output sensitivity)As your arduino has analoge pins, just connect it to the pin. It has an high input impedance so there is almost no current flowing in your arduino, so that won't give a problem either... (an example for a measurement below)The next thing...Quote from: Bskitter on April 05, 2016, 08:25:28 pmLet me say it: You are wrong...So you want to measure between 0 and 5V, and you have 16Amps goiing in...So let's see on the graph:So on the graph I marked your maximum measurements in red.. As you see, you have 2 known curves arround it (green) above (the invisible) 500 ohm and underneath 200 ohm. Which one should we choose... Well.. when we would choose the 500 ohm, we would measure arround 7.5V for 16A, so way too much. When we take the 200 ohm, we would measure some little above 3V, that's like 50% of our range, so not as good...Well, get something in between... I would say go with 270 ohm and see what you get, i guess it will be arround 4.0-4.5V @16A you will measure, that will get your job done...Quote from: Bskitter on April 05, 2016, 08:25:28 pmNope, I won't do that, then you won't learn something.. and I think that's the purpose of goiing to school (just like I still do).Try it and post your "totally not drawn in paint picture" underneath... A tip: I showed you how to measure with arduino and how the IC works... Not plug and play.. but not that hard...Last problem...Quote from: Bskitter on April 05, 2016, 08:25:28 pmI think this is "meehhhh".. It's not the best solution... I would make a little bigger circuit to get a stable 5V supply, becose the LM78 series is switching power supply, and will give some noise... Yes you can use some caps arround it (I would set an additional 100nF on the output of that picture)...Just like I told in the first thing of my post: the power dissipation... 12V-5V = 7V is more than 50% of the power will transfer into heat... Even it is for low current, you may need a little heat sink for that...When you are doiing this, there are even beter things on the market than the old fashioned lm78 series, like the LT3080 that David used in he's power supply, It's a linear one, and you can easy set the desired output with a single resistor (even trimable with a pot)Much beter!Now, it's 0:41 am here, so i'm goiing to get some sleep, i'll see what you answerRegars,Lovely Santa

author: Dave
author_rank: Super Contributor
timestamp: April 06, 2016, 05:55:54 pm
content: First of all: You can't measure power by just observing the current. Even if the voltage was fairly stable, you would be estimating the apparent power, which is pretty much useless without phase angles.In order to produce any kind of useful result, you need to measure the current waveform with at least 1-2kSps, to capture a decent number of harmonic components. Your arduino code better be pretty damn fast to pull this off and let's not forget that you are going to be measuring several channels.You could use ACS712 to do this, just get one that's made for up to ±30A (ACS712ELCTR-30A).Quote from: Lovely_Santa on April 05, 2016, 10:46:04 pmSo are you.The graph shows RMS values. At 16ARMSon the input you want to have 5VP-P(peak to peak) on the output, because that's what an Arduino input can take.5VP-P= 1.77VRMSLooking at the graph, that puts it in the range of a 100R loading resistor.You also need a biasing circuit that will keep the DC voltage on the ADC input at half the supply voltage and you also need a series resistor with the ADC pin and some clamping diodes to protect the input from large transients. You could just rely on the internal clamping diodes, but those really aren't designed for large overloads.Quote from: Lovely_Santa on April 05, 2016, 10:46:04 pmQuote from: Lovely_Santa on April 05, 2016, 10:46:04 pmBoth of the proposed linear regulators will waste the same amout of power, so the argument here is pointless (ignoring the quiescent currents, which don't contribute significantly).Quote from: Lovely_Santa on April 05, 2016, 10:46:04 pmMuch more expensive without any significant benefits. The PSRR and accuracy might be a bit better, but that's about it. His measurements are going to be ballparks at best, so it really wouldn't make a difference in this application.Just go with a good old LM7805, it's more than good enough for your purposes.One last thing, Bskitter: Are you sure you are ready to mess with mains voltages? Are you aware of the dangers and what precautions to take to avoid them? I don't want to discourage you from doing the things you like, but you really shouldn't be messing with things that could potentially kill you if you don't have the experience needed for the job.

author: Seekonk
author_rank: Super Contributor
timestamp: April 06, 2016, 06:20:47 pm
content: I would take the 7805 regulator and bump it up to 8V with two resistors and feed that into the boards internal 5V regulator for the board only. A separate 7805 for external loads like the , that little on board snot can't take much. That will distribute the heat loss. I buy just 5A hall sensors and apply a shunt to them, just a couple inches of wire is often enough. Remember 8A is the average, the sensor will be reading the peak of the sine wave.

author: rstofer
author_rank: Super Contributor
timestamp: April 06, 2016, 06:52:22 pm
content: Datasheet: file:///C:/Users/Richard/Favorites/Downloads/ACS712-Datasheet.pdfApplication 4 in the datasheet rectifies the output to provide a unipolar output to a microcontroller A/D (if clips off the negative half cycle). Rf is bothersome because it is in series with the A/D input. If the value is low (very low) then no problem. But if the A/D input impedance is 10k (and I haven't checked the datasheet for the Arduino (Atmel chip)) and Rf is 1k then we have a voltage divider.I was happy to see the output stage of the ACS712 had a voltage follower but we lose that feature with Rf. I might add a voltage follower between the output of the rectifier circuit and the input to the A/D.The problem is, if you really need power (Watts or kiloWatts), you need the phase relationship between the current and voltage to calculate the power factor. What you are measuring is Volt-Amperes, not Watts. So, this might kill the idea of using a rectifier.Furthermore, your circuit isn't picking up a voltage waveform but you will need one to calculate Watts.If I were doing this, I would scale the signals by a factor of 2 and slide them up by 2.5 volts (or whatever) such that my signal, at max current, never went negative. Ideally, 0V and 0A would have my A/D at mid scale. The easiest way to do this is to use 4 resistors and an op-amp to rescale and offset the signals while also providing the buffer for the A/D input. See Chapter 4 of "Op Amps For Everyone", particularly section 4.3http://www.cypress.com/file/65366/download

author: Bskitter
author_rank: Regular Contributor
timestamp: April 08, 2016, 03:15:34 pm
content: Thanks for all the input guys !Well Since the ACS712 will be able to do the Job I will just go for 8 of these chips. But Since I want to use 8 of them I will require 8 Analog inputs.The Arduino Uno only has 6 Analog Inputs but I have read that i can use a4051 Multiplexer Chipto add more analog inputs on the board.Quote from: Dave on April 06, 2016, 05:55:54 pmI can't remeber exactly where I read it but someone was taking 600 samples a second with the ACS712 chip.There isthis sitefor a tutorial on the ACS712 and the Arduino in his code he reads the output value from the chip for 1 second while recording the min and max values and after that performs a calculation on it.Will the multiplexer mentioned above able to iterate through each ACS712 chip fast enough or does it fall down to the Arudino on how fast it can sample its inputs ?Quote from: Dave on April 06, 2016, 05:55:54 pmAlthough I am not the experienced i circuitry I have been messing around with mains power most of my life. I cant say I haven't been shocked but I do take the obvious precautions when working mains !Byron

author: Dave
author_rank: Super Contributor
timestamp: April 08, 2016, 05:39:13 pm
content: Quote from: Bskitter on April 08, 2016, 03:15:34 pmI've looked at the code and it literally is as basic as finding the positive and negative peaks and then guesstimating the RMS.It's absolutely useless for anything other than a purely resistive load like an incandescent light bulb or a heater. The current waveform with most other loads will be far from sinusoidal.If you want to measure the real RMS value (which is relevant from the aspect of the loading on the power strip), you need to actually calculate the root mean square. Poor estimates just don't cut it.