Hey guys, my first post here, I have my arduino from about a year and it's a shame that I haven't tinkered with it yet... so lets get down to business.
My idea:
I want to measure consumed power in realtime (like every 1 second), transmit the data to MATLAB and use MATLAB to plot the data in realtime.
What I managed to do:
I successfuly transformed my Arduino into Voltmeter capable of measuring up to 5V DC, I made the connection with MATLAB and everything is working, I am measuring the voltage across a 10k resistor with 3V supply and the plot is looking nice.
The problems that I am having:
In order to be able to measure the power that I want (which is in the order of 300-600W) I need to use shunt resistor, measure the voltage across it and do some calculations to get the power. The problem is that the voltage across that shunt resistor will be probably less than 50 milivolts and after a few experiments with different resistors I found out that when it gets down to veeery low values, it's not very accurate, if I have to measure 50 milivolts the error will be in the order of +- 10% since from what I saw Arduino's "step" on voltage measuring is 5 milivolts, so at all times I have an error of +- 5 milivolts, which is problematic for the low voltages that I want to measure. I know how to increase the range of a voltmeter (add a resistor in series) and to reduce the range (make it more accurate for low voltages) I have to add a resistor in parallel to the resistor of the device which obviously I can't do with the Arduino, so how can I make it more accurate?
One more thing, the current that will go through the shunt resistor is AC, will I be able to measure it with Arduino? Like I said it's in the order of a few tens of milivolts, can this damage the arduino?
I don't care about the damage to the Arduino, I'm worried about the damage to you.
When you measure the current over a shunt, the Arduino is connected to the mains. That can go bad very quick, for example when you connect a computer to the usb of the Arduino. I mean : when you really want to use a shunt, you should wear rubber gloves and boots, and have eye protection, and a fire extinguisher nearby.
It is safer to use a current transformer.
Peter_n:
I don't care about the damage to the Arduino, I'm worried about the damage to you.
When you measure the current over a shunt, the Arduino is connected to the mains. That can go bad very quick, for example when you connect a computer to the usb of the Arduino. I mean : when you really want to use a shunt, you should wear rubber gloves and boots, and have eye protection, and a fire extinguisher nearby.
It is safer to use a current transformer.
cjdelphi:
Did I read something completely different to what you read?
Yes, Dardbound wants to measure the power usage of a 300-600W load, and wanted to measure the current with a shunt. That means the Arduino would be connected to the mains and to a computer.
I was away for a couple of days and today I finished the circuitry and I ran into a problem. I used Current Transformer I have a full bridge rectifier circuit on its secondary side and the rectified current goes through a 560 Ohm resistor which yields about 4,5V with 1 kW load on the primary circuit (and I want to measure smaller load so everything is good!) the problem is that even that its only positive waves now Arduino can't measure it? I am able to measure it with my multimeter on both alternating and direct voltage settings but the Arduino just gives me 0 volts... Another thing that I noticed when I measured the voltage with Arduino also plugged in it caused about 4 volts drop and I was measuring less than 1 volt with the Multimeter, is that normal?
Could add a protection resistor from the bridge (+) to the Arduino analog input. For example 4k7 (1k to 10k).
When the current transformer gets a big pulse, that results into a very strong voltage peak, via the bridge rectifier, directly into the Arduino analog input.
What is your sketch ? Can you try another analog input, perhaps A0 is damaged.
A0 is working I just tried to measure 3V voltage coming out of a AC->DC adapter and it works, but when I try to measure the voltage from the bridge it just reads 0V... I don't think that the protection is necessary because the voltage after the bridge is like 2,5 volts or so, 2V drop from the diodes, even without them the max voltage that I saw using my multimeter was 4,6V, but Arduino gives me nothing at all..
That protection resistor is needed. The Current Transformer with the bridge and resistor create a low impedance circuit. When you measure a max of 4.6V, you measure the average or the rms value. Since that signal is a not DC, the peak might already have damaged the Arduino, or only the analog section. I think you need a new Arduino board to be sure.
Could you check that the ground of the diode bridge is connected to the Arduino. Breadboards are known to have sometimes bad contacts.
Since you measure a wave (100 or 120Hz), waiting 1 second will measure almost in the same spot of the wave. Can you make delaytime a value of 821 ? (any value that is out of sync with the wave signal).
Do you read the same value in the serial monitor as on the display ?
Can you copy the output of the serial monitor in a post ? I am very curious what "nothing at all" is
I live in Europe, so the wave is 60Hz, I actually haven't tried reading the value on the serial monitor with the AC, I stopped doing it as soon as I saw that it works (that was before I got into the AC) and by nothing I mean that the LCD is showing 0.00 V, when I measure it with my Multimeter on Alternating Voltage I get about 2,4V when I Measure it on Direct Voltage I get 4,4-4,5V. And like I said I think that the port is fine since if I measure Direct Voltage from my AC->DC adapter its working fine, I will check if the serial output is the same as what the LCD shows but I am pretty sure that this will be the case.
P.S. Well that's interesting, last night I had no readings at all, today I have readings from the LCD and from the Serial output and what's interesting is that it peaks to 5V but I was never able to measure more than 4,5V with my multimeter...
That is normal. The multimeter measures an average or rms value. The Arduino takes a sample at that very momemt, and the top of the signal is higher. Multimeters are made to measure 50Hz/60Hz signals, most do also measure the right value when set in 'DC'.
You did use that protection resistor I hope ?
Did you take a look at the wave in the picture here: Rectifier - Wikipedia
That is the signal you have after the bridge rectifier.
Yes I know what the rectifier does, the question now is how to get the Arduino to measure it accurately, and how to do the calculations with that extra resistor?
The extra protection resistor has no influence on the voltage at pin A0.
It will only make the analogRead() a little more inaccurate (but only a little).
You could add a capacitor next to the 560 ohm. That will make the circuit even more low impedance, with danger of destroying the Arduino without that extra protection resistor. You have been warned !
Or you can use an RC filter before the signal is going to pin A0.
Or you can take a lot of samples, so you can calculate the actual voltage with that wave.
I used Current Transformer I have a full bridge rectifier circuit on its secondary side and the rectified current goes through a 560 Ohm resistor which yields about 4,5V with 1 kW load on the primary circuit
That won't work well. The diodes in the bridge rectifier have a voltage drop that depends logarithmically on the current passing through them. Normally, either the AC voltage across the resistor would be measured directly, or you would use a precision rectifier circuit to convert the AC to DC without the diode voltage drop. This post has an example circuit: Arduino CT Sensor low voltage - Sensors - Arduino Forum
They have 1V voltage drop I checked their datasheet, since the current at all times goes through 2 diods, that gives a total of 2V voltage drop. Not an issue:) but thanks for the warning!
Using a bridge rectifier will lead to inaccuracies at low current... (remember, there is a forward voltage drop across each diode in the bridge) better to use an absolute value circuit (also known as a precision rectifier)
This circuit uses a dual op-amp a few resistors and 4 silicon small sig diodes and will work all the way down to zero volts.