|
Post by Rowan on Aug 18, 2019 13:54:23 GMT
You calculation seems right. Are you only ever getting round numbers on the app (is it rounding down?), or is it just consistently about 1A low?
Try commenting out the current filter enabling line in the calibration file, see if that makes a difference?
|
|
|
Post by colinm on Aug 18, 2019 17:23:42 GMT
hI, some readings 4.23 = 3.2 5.04 = 4.0 6.12 = 5.0 7.36 = 6.0 8.7 = 8.0 10.3 = 9.0 10.67 = 10.0 13.26 = 12.0 14.8 = 14.0 15.45 = 14.5/14.8/15.0 jumped around 16.25 = 15.0 18.2 = 17.0 20.3 = 19.0
Seems to be rounding down...
How should i comment out? (clanky mech eng engaging) ;-)
const float CAL_CURRENT = 3.613; // Current Multiplier - See documentation for calibration method
|
|
|
Post by Rowan on Aug 19, 2019 12:43:51 GMT
As you say, consistently about 1A low. That points to the calibration being off. If you give me a couple of reading pairs for externally measured current and voltage on A2 I can check what you've got? The line of code in your last post is the current calibration, but I think the decimal place is in the wrong place 36.13 instead of 3.613? Also didn't you calculate it as 37.17 in the post before that? Forget my bit about disabling the filtering - I was getting confused with a different bit of code sorry!
|
|
|
Post by colinm on Aug 19, 2019 14:15:46 GMT
HI, here is 4 readings to work with.... 2.00A = 56 mV (35.7) 7.07A = 189 mV (37.4) 13.23A = 350 mV (37.8) 17.78A = 468 mV (38.0) 21.15A = 557 mV (37.9)
I flashed the Arduino again at 37.9 constant and checked reading at 17.8 A input and was showing 17.0A on APP. I gradually increased the amps until I got movement on the APP and it then moved to 18.0A but stepped though 3 intermediate readings on the way there over about a second.
On the above, I used power supply with 5 wraps around the sensor.
To check, I did another test using our battery test rig which was reading 16.84A (clamp meter as used above)and 16.8A (battery test meter) with corresponding A2 reading of 440mV (38.3) and the APP reading 16.0A
So, it seems to be rounding down to a whole number which I guess is in the software?
|
|
|
Post by icooper on Aug 19, 2019 14:35:37 GMT
@rowan, just a quick note one this subject if testing with a power supply - does the code still contain the auto zero'ing function at init? Just wondering if this could accidentally throw off the readings if the PSU is always on and 'simulating' current.
Colinm, it may be worth checking the resistor values around the op amp with a multimeter you trust (power off, board disconnected, sensor disconnected). Ideally R20 + R21 should closely match each other (4k7) and R22 + R23 should closely match each other (10k). A mismatch here in hardware would show as a current offset.
|
|
|
Post by colinm on Aug 19, 2019 14:36:11 GMT
|
|
|
Post by Rowan on Aug 19, 2019 14:36:41 GMT
Most of the readings you give from the app are whole numbers, then you have the occasional decimal reading... If it was rounding I don't understand how it rounds to a whole number most of the time but not all of the time. It's odd as I'd expect it to be either or. It does sound like a software issue though. Time to disable the filtering I think as that's the most likely source of error in the software. Comment out lines 450 to 470 as shown in this link: github.com/eChook/eChook-Arduino-Nano/blob/f644faacc2213e9797c7b15cd00b8ebfb8fc19a2/eChookCode/eChookCode.ino#L450Note that your code may be on slightly different line numbers. Sorry about this!
|
|
|
Post by Rowan on Aug 19, 2019 14:37:54 GMT
Nice. Looking now... That doesn't appear to be limited to round numbers?
|
|
|
Post by colinm on Aug 19, 2019 14:37:54 GMT
Input current is a steady 16.6A
|
|
|
Post by colinm on Aug 19, 2019 14:40:13 GMT
correct, it started moving around when I put it on the battery tester
|
|
|
Post by colinm on Aug 19, 2019 14:41:10 GMT
Still havnt managed to get the voltage showing.... Ive got the temp and rpm probes working
|
|
|
Post by colinm on Aug 19, 2019 14:41:41 GMT
I'll check the resistors now
|
|
|
Post by Rowan on Aug 19, 2019 14:47:06 GMT
Cool. It may be a bad connection on the board... Are you getting any voltage on pin A0?
Current wise, it's a shame your measured constant is changing - from the sensor it really should be linear. If you average the ones you have does the app give a close enough reading?
Going to be driving for a bit - I'll check back later!
|
|
|
Post by colinm on Aug 19, 2019 14:50:56 GMT
R20=4.71k R21=4.71k R22=9.95k R23=9.92k
|
|
|
Post by icooper on Aug 19, 2019 15:08:12 GMT
R20=4.71k R21=4.71k R22=9.95k R23=9.92k Those sound good. Just do a quick check on the R24 (should be 47k). Sounds like the hardware is within spec. We will have a further think on this one!
|
|