Hi,
I've been trying to adapt the Emonlib for beaglebone ADC. So far i'e been able to get it running, but I'm not getting very precise values. I'm using only the calcIrms function to get the rms Current, which I use to calculate the apparent power by multiplying with 230.
These are the constants I'm using:
SUPPLYVOLTAGE = 1800;
calibration = 166.666 (i.e. for a burden resistor of 13 ohms, calculated using the calibration theory).
Further, I changed I_RATIO = ICAL *((SUPPLYVOLTAGE/1000.0) / (1.8 * ADC_COUNTS));
Can't figure out whats wrong. Please help.
Thanks.
Re: Emonlib on Beaglebone
Hello zaxter, can you copy and paste a sample of the output at different loads, say 60W and then 3kW. Maybe 10 readings at each power.
Re: Emonlib on Beaglebone
What are the raw numbers that your ADC is giving out?
Re: Emonlib on Beaglebone
@TrystanLea
Following is the output for a 160w load->
At 17:39:54
Apparent power = 26.270148 and Irms = 0.114218 <<--------when switched off
At 17:39:55
Apparent power = 28.736440 and Irms = 0.124941
At 17:39:57
Apparent power = 44.157726 and Irms = 0.191990
At 17:39:59
Apparent power = 60.549677 and Irms = 0.263259
At 17:40:1
Apparent power = 63.220695 and Irms = 0.274873
At 17:40:2
Apparent power = 64.330163 and Irms = 0.279696 <<--------when switched on
At 17:40:4
Apparent power = 64.444600 and Irms = 0.280194
At 17:40:6
Apparent power = 64.733168 and Irms = 0.281449
At 17:40:7
Apparent power = 65.135276 and Irms = 0.283197
Sorry I dont currently have a larger load.
I'm using a yhdc sct-01300 current o/p type sensor.
Re: Emonlib on Beaglebone
@robert wall. I'm getting 800~. Its a 12 bit ADC with Vref = 1.8v.
Re: Emonlib on Beaglebone
That tells me that your mid-point bias is wrong. You should be seeing a count of around 2048 with no input, if you're seeing ~800 it means your midpoint is at 0.35V, not where it should be at 0.9 V.
With a 230 V supply and a load of 160 W, the primary current is ~700 mA and the secondary current out of your ct (SCT-013-000?) is 0.35 mA, the voltage across your burden should be ~ 4.5 mV (all rms values). That means the ADC output should be swinging by 29 counts peak-peak.
Could you try one of Robin's test sketches to show what is happening to the input: http://openenergymonitor.org/emon/node/1757
Re: Emonlib on Beaglebone
Thanks a lot for your reply @Robert. I've attached my circuit. Maybe the voltage divider I'm using isn't right.
The arduino sketches need to be tweaked a little to get them working on Beaglebone. It will take some time. I'll get back to you once I'm done.
Re: Emonlib on Beaglebone
That ought to be right - there must be something else wrong somewhere. I assume the capacitor is a polarised type, is it the correct way round? Have you measured the mid-point voltage with a multimeter? If that's correct, then we need to await the results of Robin's sketches.
Re: Emonlib on Beaglebone
@Robert. Sorry I just had a doubt.
Shouldn't the raw value for 1.8V in a 12 bit ADC be ~1800. Because when I connect 1.8V to a ADC pin, it reads ~1799. In that case 0.9V should give about 900. Could you please clarify?
Re: Emonlib on Beaglebone
But you said your reference was 1.8 V, therefore all voltages and counts that you measure are based on 0 V = 0 counts and 1.8 V = 4095 counts. 0.9 V is half way and should be 2047-2048 counts.
What you've just written says your Analogue reference is 4.096 V, which is a common and credible number but not what you said it was.
Re: Emonlib on Beaglebone
Oh. I'm really sorry for the confusion.
The analog pins on beaglebone can only take a maximum of 1.8V, although its a 12 bit ADC. So, practically, the maximum value can only be 1799 and not 4095.
Re: Emonlib on Beaglebone
That's really weird and a bit pointless - you have got a not-quite-11-bit ADC there.
So you expect the midpoint to sit at around 900 counts, therefore the 800 you are seeing is a bit low but not disastrously wrong. But the input swing I gave you in counts is grossly optimistic, it should be 12-13 counts peak-peak, or 4.5 counts rms. Or for 100 A, you should see 650 counts rms. That I think makes your current calibration constant 153.84, always assuming you've set SUPPLYVOLTAGE = 1800 and ADC_COUNTS = 1799 - you need consistent values here. (If you have left ADC_COUNTS as it is set in the header file to 1024 or 4096, that's at least part of where it is going wrong.
But equally worrying is the "no current" values of 120 mA or so. This indicates that there is noise or pickup getting in to the analogue front end (or into the ADC converter reference voltage), and that needs to be sorted out. Careful attention to grounding, screening and filtering will be required to reduce it, but using current-only is the worst case because any sniff of noise is rectified by the rms calculation and added to the wanted value. You'll find it reduces if you use calcVI to get average power directly, because the noise current that is in phase and that which is out of phase with the voltage tends to cancel out and average towards zero.
Re: Emonlib on Beaglebone
@Robert. Thanks again for your continued interest. I've tried with the constant values you suggested, but no luck yet, although I have been able to get closer to desired values. Currently looking into the possibility of using the CalcVI().
I was wondering if the current o/p yhdc SCT013 can be used somehow to get the voltage readings.
Re: Emonlib on Beaglebone
"I was wondering if the current o/p yhdc SCT013 can be used somehow to get the voltage readings." No, that's not possible. The YHDC SCT-013-000 is a current transformer (and it makes no direct galvanic connection to the cable), for the voltage input you need an approved (for your safety) voltage transformer (also called an ac-ac adapter) that connects directly to Line & Neutral.
As far as the calibration goes, how far out are you now (over a range of values)? All the theory will only get you to within about 4% at best due to the tolerance spread in the various components that affect the measurement (see Building Blocks and "Sources of error in the emonTx voltage and current inputs"). The final adjustment has to be by checking against a known good meter.
Re: Emonlib on Beaglebone
@Robert. Apologies for the delayed response.
Presently, I'm getting ~40W for a 60W load and ~130 for a 160W load. But I'm still getting values around 20W without any load.
Thanks a lot for your help.
Could you please suggest me a voltage sensor?
Re: Emonlib on Beaglebone
At the top of every page, there's a link labelled "Shop". If you are in Europe, or you have an equivalent supply (voltage, frequency, plug shape), you should find what you need there. Otherwise, I'm afraid you will have to find a local equivalent. The output voltage isn't critical, because provided that it is greater then the input range of your ADC, you can have a voltage divider to scale it appropriately. There's "Building Blocks" page that explains this.
Re: Emonlib on Beaglebone
Hi guys I also want to use the Beaglebone Black with a CT I have a few leftover of these 582-1018-ND from
Digi-key. they are rated at 20 amps and are 1000 turn. I don't need any thing higher than 20 amps. I want to install
this in my Level 2 16 amp electric vehicle charging station. A step by step for the CT setup would be greatly appeared.
Zaxter Did you ever solve the Delta in you power measurements?
Thanks
Re: Emonlib on Beaglebone
I have thought about rewriting the design process all in one place, it's actually all in Building Blocks but it's scattered about. Here's the short version:
1. Calculate the current you'll get in the CT secondary at the maximum current you're interested in.
2. Calculate the maximum voltage swing that your ADC input can accept under worst-case conditions, e.g. at minimum supply voltage, and with the midpoint bias off-centre due to resistor tolerances.
3. Calculate the value of burden resistor to give you that voltage peak-peak at the current from step 1, again given worst-case resistor tolerance. Always go to the next lower value (or revise your requirement for the maximum current), so as to allow a bit of 'headroom'. If you think you might have a 'peaky' current wave, where the ratio of peak/rms is greater then √2, then you need to reduce the burden resistor value by quite a lot - maybe 20 - 30%.
4. Use those values to calculate your calibration coefficient as explained in Building Blocks - CT and AC power adapter installation and calibration theory.
Re: Emonlib on Beaglebone
Could someone please explain how to run Emonlib on BeagleBoneBlack so I could test it myself?
Re: Emonlib on Beaglebone
This forum is now read-only. See the Latest Blog post on the right for details. Please join the new forums and ask this question there.