Shop OBEX P1 Docs P2 Docs Learn Events
Irratic readings from Allegro's current sensor... — Parallax Forums

Irratic readings from Allegro's current sensor...

denodeno Posts: 242
edited 2007-09-07 04:31 in General Discussion
Hello to all readers...I have a little situation as far as readout from the above sensor.· Actually, readings are very stable when the current flow, (charging or discharging) is resistive or inductive (12 DC pump motors) .· Example, when the solar panels are charging, I get an accurate readout of current (charging).· When I turn on various loads, light, pumps, etc. the readings again are stable (discharging).

The irratic readings only show up when I am using my 2500 watt inverter.· Now, this inverter is on my boat, and it will charge the house bank when incoming shore power is available, up to 125 amps into a 12volt bank (very large battery bank).· When the shore power is not available, the device will go into invert and provide AC power from the same 12 volt house bank.

I believe that there must be alot of noise or spikes on the DC power line connected to the house bank, in invert mode or charge mode, thus causing the wild DC amprage readings (wiring from inverter to house bank is 2/0 wire). The Allegro device ASEK754SCB-130 (will measure plus or minus 130 amps) provides an output of 0 to 5 volts.· 2.5 volts being 0 amps, and 5 volts representing 130 amps (charaging).· 0 volts output would be -130amps discharging).

Again, I believe that the LTC1298 ADC, is so fast, that it is taking readings when the chargerer/inverter is modulating (for a lack of a better discription). I don't have a scope to witness this.

I was wondering if I could buffer the output with a capacitor, choke arrangement to smooth out the output, much like a power supply, before the LTC1298 ADC.

The stamp only makes amp reading about once every 5 seconds, so there is time for some sort of averaging circuit.· I must also add, that I have tried to take several readings with the LTC1298 ADC and averaging, but just one really low reading throws off the accuracy when it comes to averaging.

Have any of you fell readers run across this unusual problem, and do you think some sort of smoothing circuit would work.· I did try several small capacitors (.1u, 1u, 10u, and a 100u) with no help.

Thoughts would be appreciated on this...

Deno

Comments

  • pwillardpwillard Posts: 321
    edited 2007-08-31 01:32
    The wave form of the AC coming out of a tyical inverter is pretty gross and hardly a sin wave like it's suppsed to be. Check this out and maybe it will make more sense why it makes nearby electronics rather flakey.

    http://www.rocketroberts.com/techart/inverter.htm

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    There's nothing like a new idea and a warm soldering iron.
  • denodeno Posts: 242
    edited 2007-08-31 02:38
    Thank you for the link, however, the currert I am trying to measure is the DC current from the 12 volt house bank, which powers the inverter (discharging the house bank).· This is the same current in reverse that I am also trying to measure from the inverter to the house bank·(charging).

    I am not concerned with measuring the AC current into or out of the inverter.

    Thank you, as the link was interesting to read.

    Deno
  • pwillardpwillard Posts: 321
    edited 2007-08-31 03:10
    The point is... that circuitry used to create that nasty AC-Like waveform from DC is rich in harmonics. The DC source side is slapping hard in an on-off cycle while that wave is created. This can only mean that induced noise and load spikes can possily have a nasty effect on the source.

    Oh... and I honestly know little about this stuff... I really don't know what you should do.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    There's nothing like a new idea and a warm soldering iron.
  • denodeno Posts: 242
    edited 2007-08-31 11:42
    It would make sense that the DC side of the inverter would be "spikey".· So, I am wondering if a capacitor, choke, capacitor arrangement would filter out some of this noise leaving only a reasonably smooth DC voltage level.· A level that would be allowed to swing up or down, without the spikes.

    Tracy Allen, do you have any thoughts on this sensor?

    Deno
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2007-08-31 13:28
    Deno -

    Would you mind terribly drawing up a simple schematic of your system, so we might be able to provide additional assistance. Please include at least the following components:

    Line voltage input and output (as/if applicable)
    DC-->AC Inverter input and output
    12 VDC "house bank"
    Any other batteries in the system
    Allegro currrent sensor

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • denodeno Posts: 242
    edited 2007-08-31 22:06
    Bruce...Thank you for your interest...

    I don't know how to· draw a schematic on the computer, and I don't have a scanner to get it into the computer.· However, I will try to explain the hookup.

    Basiclly, this is a 12 volt house system, comprised of 3 8D batteries.· Each battery has a capacity of 225 amp hours, of which you can use half before the battery is considered discharged.· About 11 volts.

    The inverter is a 2500 watt Heart inverter which means it will run a 2500 watt device on 12 DC.· It also doubles as a battery charger, when AC input voltage is present, which is 120v AC. It can charge up to 125 amps.

    I have the Allegro device ASEK754SCB-130 device·installed with large battery cables between the inverter, house loads, and the 3·8D batteries on the negative side of the battery. It is easier to collect and consolidate the negatives then the various positives that run all over the boat.· This is a standerd practice for inverters on boats.

    The Allegro device ASEK754SCB-130·does work very well when the inverter in not charging or inverting.· Measuring the output of the··Allegro device ASEK754SCB-130· does show a very stable voltage between 0 and 5 volts, depending on charging or discharging with a digital volt meter which does not show spikes or noise because it averages (i think).

    I just think that here is so much noise on the 12 line going thru the Allegro device, and the LTC1298 is just sampling at the wrong time.· It, does give a good reading every once in a while, which tells me, if I could smooth out the noise and spikes, I could get good reading all the time.

    I hope this further explains the hookup.

    Deno

    Thank you again...·
  • LilDiLilDi Posts: 229
    edited 2007-09-01 01:38
    Is this close to what you have. (see attachment)
  • denodeno Posts: 242
    edited 2007-09-01 02:25
    Yes, except for one detail.· The 12 volt neg. from the inverter is connected to the neg. after the current sensor, and not directly to the neg. of the battery bank.· I did this so I could monitor the charging and discharging current to and from the inverter as well as the "house" loads.

    Again, I am sure that the inverter/charger is spiking the· 12 volt bank, and the ADC is sensing· this spike from time to time.

    Thank you for your drawing, as it does help to explain the circuit.

    Deno
  • Tracy AllenTracy Allen Posts: 6,666
    edited 2007-09-02 21:37
    Deno,

    How erratic are the readings, as a % of the average?

    Yes, a bit of RC filtering could do wonders.
    shunt (+) ----/\/\----o----- LTC1298 (+ in)
                  RΩ      |
                          |
                        ===== 0.1uf
                          |
                   RΩ   |
    shunt (-) ----/\/\----o----- LTC1298 (- in)
    



    The resistance R can be quite large if it is only sampling once every 5 seconds. Try any R from 10kohms to 1 meg. With 1 meg, it could filter even 60 hertz modulations. The RC network should be located right next to the LTC1298 inputs. Averaging in software is most effective if it is synchronized to the fundamental frequency of the modulation and would require that you sample the input much more often.

    Here are additional things to look at:
    * Is the LTC1298 hooked up in differential mode, to measure the voltage difference directly across the shunt? The diagram above assumes this is true. The alternative is one side of the shunt grounded.
    * Where does the power supply for the LTC1298 and CPU come from, and in particular, where is it grounded?
    * How close is the LTC1298 to the shunt? What kind of wiring is it, loose wires? Twisted pair? Shielded?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • denodeno Posts: 242
    edited 2007-09-02 22:19
    Thank you for replying...

    The reading are very irratic...for example, I know from the bar graph on the inverter control panel, that I am charging·, lets say 80 amps.· The readout will swing from minus 100 amps to a plus 100 amps.· Every once in a while it will read 80 amps.· This condition happens when charging or discharging.· With the charger/inverter turned off, the reading are right on. I don't think I can compute a percent average, because of the wild fluctions.

    The LTC1298 is hooked up as single ended, meaning, I am switching the device between the 2 channels.· One channel measures 12 volt battery voltage thru a voltage divider.· This voltage reading is right on and is not irratic.· The other channel of the LTC1298 is interfaced with Allegro's current sensor, and this is not a shunt.· It outputs a voltage from 0 to 5 volts, with 2.5 volts being "zero" charge or discharge. 5 volts would indicate 130 amps charging and 0 volts would mean 130 amps discharging.

    The power supply for the LTC1298 is directly wired thru a fuse to the house batteries. This includes the ground.

    The LTC1298 is connected to the Allegro device thru a twisted and shielded wire with a distance of about 8 feet.· The sensor wire does not come close to the large charging/discharging cables from/to the inverter.

    I have tried various capacitor combinations between the output of the Allegro device and ground, but at the site of the current sensor, not at the LTC1298 device.

    Thanks again for your input...

    ·
  • Tracy AllenTracy Allen Posts: 6,666
    edited 2007-09-03 17:40
    Sorry, I missed the part about this not being a shunt. It sounds like a nice setup. I bet the inverter puts out or takes in pulses of current. It would be nice to be visualize it on an oscilloscope.

    What happens with a multimeter connected to the Allegro output with the inverter on--Does the meter reading fluctuate? Try it with the multimeter on the DC, and also look at it to see how much it reads on the multimeter AC range.

    RC filtering is simpler.
    Allegro (+) ----/\/\----o----- LTC1298 (+ in)
                        RΩ      |
                                  |
                              ===== C µF
                                  |
                                  |
    Allgro com ------------o----------- LTC1298 common
    



    I'd still put the RC close to the LTC1298, because the resistor will create a node that is subject to noise pickup on the right hand side.

    The capacitor could be up to several microfarads and the resistor up to a megaohm, but I have to emphasize that the filter itself can cause an error due to the input current of the LTC1298. That current is proportional to the rate at which the LTC1298 samples the input, and at one sample every 5 seconds like your program is doing now, it will not be a problem even if R=1 megaohm.

    The RC network can average the input signal, but might not give a right-on indication of the RMS (effective) current. The shape of the pulse waveform might be too extreme to give a good average close to the RMS value. It is worth a try though.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • denodeno Posts: 242
    edited 2007-09-04 11:47
    Tracy...I was quit supprised to find an AC component of voltage between the Allegro's output and ground.·So, with the charger on and charging around 100 amps, I measured about 3.05 volts·DC and·I measured alittle over 1 volt AC.· The DC component is fairly stable, not fluctating more then 10 to 15 mvolts as long as the charge rate does not change (I know the rate of charge will go down with time).·So I would assume that the LTC1298 is sampling the additive or substractive effect of the AC on the DC voltage, thus causing the reading to vary wildly when the charger is on or in invert mode.

    I have filtering capacitors on the power line to the current sensor, so I am alittle supprised that the AC is getting to the device.· I measured the frequency of the supply, and it appears to be 0. This AC voltage does stop when I turn off the charger/inverter.

    The frequency of this AC is exactly 120 hertz.· Any thoughts on how to filter this AC component out.· Various sizes of capacitors seems to have no effect.

    Thank again on this ongoing problem.

    Deno
  • Tracy AllenTracy Allen Posts: 6,666
    edited 2007-09-04 15:33
    Filter capacitors on the power line to the current sensor are not going to help if the current is actually pulsing.. The Allegro is accurately passing the pulsations through to its output.

    Did you try the RC filter right at the LTC1298 inputs? The RC filter will need a time constant of much longer than 1/120 second. 10 microfarad tantalum with 100 kohms would have 1 second time constant and that should do the trick. Multimeter voltage inputs often have that long of a time constant. The fact that the DC range of the multimeter is relatively steady shows that it can be done.

    Also, multimeters sample at a multiple of the power line frequency, so they can reject power line noise. You can do that in your system, but it takes some fine-tuned programming. Are you using a BS2? The BS2 would have to take an even number of samples (say N=4) from the LTC1298 at intervals of exactly 8.3 milliseconds, and average those. Then wait your 5 seconds and do it again. That can be combined with the RC filter at the input and still not create an input current error.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • denodeno Posts: 242
    edited 2007-09-04 20:07
    Thank you again, and I will try the 10ufd and 100kohms filter.· How long would one have to wait to take readings for averaging, using the BS2sx?· 1 /120 = .0083 sec.· Is it the same for the BS2sx?

    Deno
  • Tracy AllenTracy Allen Posts: 6,666
    edited 2007-09-05 06:10
    The time is based on taking two samples per cycle so that they will be roughly 180 degrees phase apart on the cycle and thus cancel out. It does not matter if it is a BS2 or a BS2sx. I see now that you found that the frequency of the AC is 120 hertz, and in that case, the sampling should be done at 0.00415 second intervals That gives 2 samples in 1/120 second and 4 samples in 1/60 second. Even with the BS2sx, there is very little time to make CS\ low, send the SHIFTOUT command followed by the SHIFTIN of 12 bytes to get the data and then make CS\ high. And then again several times. It can be done with in-line coding. But try the RC filter first.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • denodeno Posts: 242
    edited 2007-09-05 17:07
    Tracy, the RC filter works very well, and is accurate for all discharge issues, even when inverting.· The charging values are reading about 20 amps low (on the average) when charging the battery bank from the inverter/charger.

    I can live with the inaccurate charging values, as it is the discharge info that I like to monitor.

    Thanks again, Tracy.

    Deno

    PS My next stamp project in the spring will be a "follow me" golf cart.·
  • Sparks-R-FunSparks-R-Fun Posts: 388
    edited 2007-09-05 17:43
    I am working on a similar arrangement but do not have mine set up yet. I bought the connectors I needed, and got a terminal block and some cables. I also drilled an access hole for one of my cable runs last weekend. Now I have no DC power until I can find time to reassemble the system! Hopefully I will work on it some more this weekend.

    I am curious to know exactly what RC filter values and what sampling rate you are using.


    - Sparks
  • denodeno Posts: 242
    edited 2007-09-05 22:40
    I used what was recommended by Tracy in the above posts.· The 10 ufd and 100K ohm resistor as shown in the above hookup.· The only other thing I am doing with the software is making 3 readings with the LTC1298 and averaging them.· However, I am going to change the code to make just one reading, and see if that improves the charging accuracy of the amp reading.·

    Also, I install a very small computer pillow fan (12 volt) that blows directly on the Allergro device.· When I am pumping 120 amps thru it, it seems to get alittle warm.· I have taken it's temp, but the little fan can't hurt.· When you look at the 2/0 battery cables being necked down to that little device, you have to wonder....

    Make sure you use good solid connections to the device.· I actually built a small base to hold the Allegro current sensor EV board on standoffs, with 3/4 inch wide, 1/8 inch thick copper· strips bolted to the EV provided holes with 1/4 inch brass bolts.· The other end of the copper strips (2 inches) is stud mounted to secondary mounts that the large battery cables bolt to.· This takes all strain off of the Allegro device.

    Hope this helps...I do believe the device works better then a standard shunt, because of the output being 2.5 volts at 0 amps, verses 0 volts at 0 amps with a standard shunt..· To much error can get into the readings at the lower voltages using a shunt type device.

    Deno

    ·
  • Sparks-R-FunSparks-R-Fun Posts: 388
    edited 2007-09-07 04:31
    Thanks for clarifying the specific values, Deno. And thanks to Tracy Allen for suggesting the solution that is working for Deno. It may solve a problem for me that I have not even experienced yet!

    Thanks also to everyone who has helped with this discussion. It is helping me anticipate possible problems before I encounter then.

    I am hoping to temporarily install my Allegro sensor this weekend and run some tests on it. I doubt I will be hooking it up to a microcontroller right away but now that there is some interest in seeing waveforms I just might lug over the oscilloscope to see what I can observe about the signal. I might take some temperature readings of the sensor as it operates as well. However, I do not plan to be pulling anything close to 130 amps through it this weekend!

    I will try to let you know if I uncover anything interesting.

    - Sparks
Sign In or Register to comment.