Pages: 1 2 [3]   Go Down
Author Topic: coulomb counting  (Read 4098 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It has not been self-evident from your descriptions,   that it has ever actually been "working" at all.

as indicated in a previous post, the setup has worked. but only gives me an accuracy down to .3A. im now after a bit more accuracy from it, so hoping that the 24bit DAC i mentioned is what im after. if not, i'll have to look for another.

cheers

Jason
Logged

Lacey, Washington, USA
Offline Offline
Edison Member
*
Karma: 155
Posts: 2346
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

A 24 bit DAC is going to require superhuman noise reduction and voltage reference regulation.

To be pedantic:
Quote
amps, not ma.

mA, not ma.
Logged

Steve Greenfield AE7HD
CET Consumer Electronics and Computer
Please don't read your attitudes into my messages

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A 24 bit DAC is going to require superhuman noise reduction and voltage reference regulation.

To be pedantic:
Quote
amps, not ma.

mA, not ma.

would this be better?

https://www.adafruit.com/blog/2012/10/26/new-product-ads1015-12-bit-adc-4-channel-with-progrmmable-gain-amplifier/

if 24 is to much, and 10 isnt enough, this might be a good trade. im hoping to get it to ~0.01 accuracy across the shunts.

cheers

Jason
Logged

Offline Offline
Faraday Member
**
Karma: 62
Posts: 3011
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Your problem is always going to be,    getting a detectable response for small currents while still being able to deliver large currents.

What I would be looking to do,   is separate the starter motor circuit from the circuit for everything else.    And then put a 100 amp shunt in the starter motor circuit and a 30 amp shunt ( with a higher mV/A sensitivity ) into the circuit for everything else.

The wiring in every car I have ever looked at,  is already actually arranged to facilitate this.  In my car there are two leads off the positive battery terminal.   One goes straight to the starter motor.   The other one goes to the fuse receptacle.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Your problem is always going to be,    getting a detectable response for small currents while still being able to deliver large currents.

What I would be looking to do,   is separate the starter motor circuit from the circuit for everything else.    And then put a 100 amp shunt in the starter motor circuit and a 30 amp shunt ( with a higher mV/A sensitivity ) into the circuit for everything else.

The wiring in every car I have ever looked at,  is already actually arranged to facilitate this.  In my car there are two leads off the positive battery terminal.   One goes straight to the starter motor.   The other one goes to the fuse receptacle.

there is no starter motor in the circuit.

its purely solar and aux battery.


                                                                                                                     arduino and screen displaying data
                                                                                                                                         |       (Power In, power out, Voltage etc...)
                                                                                                                                         |
                                                                                                                                         |
start battery-----VSR (Voltage sensitive relay)--shunt (200A will only use about 90-100A)----------Aux battery
                                                                                                                           |            |
Solar Panel--------------------------------------------------Shunt-----|            |
                                                                                  (50A purely to measure            |
                                                                                                    solar input)                |
                                                                                                                                        |
                                                                                                                                Accessories


i hope that make sense.

as you can see, this is just measuring the amps in, amps out the voltage of the battery etc... and i want to use that to also give me an indication of AH remaining in the batter using coulomb counting.

cheers

Jason
Logged

Lacey, Washington, USA
Offline Offline
Edison Member
*
Karma: 155
Posts: 2346
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Keep in mind there is something called ENOB - Effective Number Of Bits.

http://www.analog.com/library/analogdialogue/archives/47-02/RAQ_90.html

http://www.analog.com/static/imported-files/tutorials/MT-003.pdf
Logged

Steve Greenfield AE7HD
CET Consumer Electronics and Computer
Please don't read your attitudes into my messages

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


and im lost.

i dont have alot of knowledge in the electronics world. im peicing it together slowly. is it basicly the case that with the 2 products i have, they wont be able to measure what i want them to, to the accuracy i want them to?

cheers

Jason
Logged

Rapa Nui
Offline Offline
Edison Member
*
Karma: 60
Posts: 2071
Pukao hats cleaning services
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would go with ADS1115 - 16bit adc (or ADS1118 - with temp sensor). This will give you up to +/-256mV fullscale resolution (8uV), and it is easier manageable than 24bits adcs.
You have to consider:
1. those ADSxxxx are sigma-delta adcs, so you will read ~8-15measurements per second in highest resolution
2. noise - +/-3 lsb bits of noise is a good guess when wired and filtered properly in your application
3. it has true differential inputs - so actual wiring needs to be adjusted to your sensors.

« Last Edit: December 30, 2013, 06:24:59 am by pito » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would go with ADS1115 - 16bit adc (or ADS1118 - with temp sensor). This will give you up to +/-256mV fullscale resolution (8uV), and it is easier manageable than 24bits adcs.
You have to consider:
1. those ADSxxxx are sigma-delta adcs, so you will read ~8-15measurements per second in highest resolution
2. noise - +/-3 lsb bits of noise is a good guess when wired and filtered properly in your application
3. it has true differential inputs - so actual wiring needs to be adjusted to your sensors.



what is a sigma-delta adcs? and will the 8-15 MPS be enough?

will your estimated -/+ 3LSB be a problem with the computed output? and by filtered, do you mean just have a cap between that and ground?

ok, if it was to get the ADS1115 (as i couldnt find a ADS1118 on a breakout board) from what i can gather, it either has 4 inputs, or can double something up and have 2. im only after 2, as i only have 2 hall sensors that i want to read. so i assume that i can use 2 of the 4 inputs.

thanks for the help. i appreciate it. and am slowly learning.

cheers

Jason
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok, after some research, and some tinkering etc... and using a code i found online as my base, i have my unit successfully reading the voltage. amps, and calculating AH and WH. but, im getting what i would call sensor drift. where with no load, i see frequent spikes up to .5A. im not sure if that is because there is no load, or if there is a filtering issue. the hall effect sensor has a capacitor on it. but i am unable to test it.

this is also using the 200A sensor. after i get this to work successfully, i will implement the 50A sensor. but i need 1 to work first so that i only have to troubleshoot 1 problem.

also, the sensor in the guide is different to mine, but i adjusted the mA/V value and the offset so that it was at 0.0. but as i am only able to get an output into double digits, i dont know if i can get it to show more decimal values.
any suggestions?

the guide and code i used i found here.
http://www.hacktronics.com/Tutorials/arduino-current-sensor.html

and this is my modified code

Code:
int batMonPin = A0;    // input pin for the voltage divider
int batVal = 0;       // variable for the A/D value
float pinVoltage = 0; // variable to hold the calculated voltage
float batteryVoltage = 0;

int analogInPin = A2;  // Analog input pin that the carrier board OUT is connected to
int sensorValue = 0;        // value read from the carrier board
int outputValue = 0;        // output in milliamps
unsigned long msec = 0;
float time = 0.0;
int sample = 0;
float totalCharge = 0.0;
float averageAmps = 0.0;
float ampSeconds = 0.0;
float ampHours = 0.0;
float wattHours = 0.0;
float amps = 0.0;


void setup() {
  // initialize serial communications at 9600 bps:
  Serial.begin(9600);
}

void loop() {

  int sampleBVal = 0;
  int avgBVal = 0;
  int sampleAmpVal = 0;
  int avgSAV = 0;

  for (int x = 0; x < 10; x++){ // run through loop 10x

    // read the analog in value:
    sensorValue = analogRead(analogInPin); 
    sampleAmpVal = sampleAmpVal + sensorValue; // add samples together

    batVal = analogRead(batMonPin);    // read the voltage on the divider
    sampleBVal = sampleBVal + batVal; // add samples together

    delay (10); // let ADC settle before next sample

  }

  avgSAV = sampleAmpVal / 10;

  // convert to milli amps
  outputValue = (((long)avgSAV * 5000 / 1024)+224.44) * 1000 / 10;

  /* sensor outputs about 100 at rest.
   Analog read produces a value of 0-1023, equating to 0v to 5v.
   "((long)sensorValue * 5000 / 1024)" is the voltage on the sensor's output in millivolts.
   There's a 500mv offset to subtract.
   The unit produces 133mv per amp of current, so
   divide by 0.133 to convert mv to ma
   
   */


  avgBVal = sampleBVal / 10; //divide by 10 (number of samples) to get a steady reading

  pinVoltage = avgBVal * (15.0/1023.0);       //  Calculate the voltage on the A/D pin
  /*  A reading of 1 for the A/D = 0.0048mV
   if we multiply the A/D reading by 0.00488 then
   we get the voltage on the pin.
   
   NOTE! .00488 is ideal. I had to adjust
   to .00610 to match fluke meter.
   
   Also, depending on wiring and
   where voltage is being read, under
   heavy loads voltage displayed can be
   well under voltage at supply. monitor
   at load or supply and decide.
   */

  batteryVoltage = pinVoltage;    //  Use the ratio calculated for the voltage divider
  //  to calculate the battery voltage


    amps = (float) outputValue / 1000;
  float watts = amps * batteryVoltage;

  Serial.print("Volts = " );                     
  Serial.print(batteryVoltage);     
  Serial.print("\t Current (amps) = ");     
  Serial.print(amps);
  Serial.print("\t Power (Watts) = "); 
  Serial.print(watts); 


  sample = sample + 1;

  msec = millis();



  time = (float) msec / 1000.0;

  totalCharge = totalCharge + amps;

  averageAmps = totalCharge / sample;

  ampSeconds = averageAmps*time;

  ampHours = ampSeconds/3600;

  wattHours = batteryVoltage * ampHours;

  //wattHours = batteryVoltage * ampSeconds;


  Serial.print("\t Time (hours) = ");
  Serial.print(time/3600);

  Serial.print("\t Amp Hours (ah) = ");
  Serial.print(ampHours);
   Serial.print("\t Watt Hours (wh) = ");
   Serial.println(wattHours);
  //Serial.print("\t Watt Seconds (ws) = ");
  //Serial.println(wattHours);
  // wait 1 seconds before the next loop
  // for the analog-to-digital converter to settle
  // after the last reading:
  delay(1000);                   
}
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17293
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
ok, if it was to get the ADS1115 (as i couldnt find a ADS1118 on a breakout board) from what i can gather, it either has 4 inputs, or can double something up and have 2. im only after 2, as i only have 2 hall sensors that i want to read. so i assume that i can use 2 of the 4 inputs.

As the outputs of your hall sensor are single-ended, you do not need to read it as a differential input, so any of the four inputs can be used.

The ADS1115 is a very nice device. Adafruit sells a nice breakout for it.

Logged

Victoria, Australia
Offline Offline
Edison Member
*
Karma: 46
Posts: 1515
Electronics Engineer/Industrial Control
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, you may need to do some bypassing at the current sensor to see if that will minimise the odd 0.5A.
Try 0.1uF between gnd and the output of the sensor and also say 10uF across the gnd and +5V points on the sensor.
How long are the leads from the sensor to the arduino?


Tom...... smiley
Logged

Everything runs on smoke, let the smoke out, it stops running......VK3DMK

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, you may need to do some bypassing at the current sensor to see if that will minimise the odd 0.5A.
Try 0.1uF between gnd and the output of the sensor and also say 10uF across the gnd and +5V points on the sensor.
How long are the leads from the sensor to the arduino?


Tom...... smiley

cheers mate. i will give it a try.

the leads are ~300mm at the moment, just using network cable, single core. as i have the shunts installed in the box i need them in, but i still have my arduino on the breadboard.when complete, i will mostlikley put it on a custom PCB. and it will all be connected via traces/solder (still debating wether to make my own pcb or customise one thats the size of my box and cut it up.

i will report back. there is also a capacitor on the board from what i can see, but no idea how to measure it. as my meter has a slot where the legs are inserted into it. i cant use leads.

cheers

Jason
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok, well i have purchased a ads1115 sensor and breakout board from ebay

http://www.ebay.com.au/itm/230984376981?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649

so i will have to wait till it arrives to test it out. but hopefully that gives me sufficent accuracy.
also, i noticed that the ads1118 has some temp. sensor thing. whereas the ads1115 dose not. will i need that? and what does it do?

cheers

Jason
Logged

Lacey, Washington, USA
Offline Offline
Edison Member
*
Karma: 155
Posts: 2346
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Right there on the first page of the datasheet:

http://www.ti.com/lit/ds/symlink/ads1118.pdf

The ADS1118 is meant to be used with thermocouples. So you need cold junction compensation. To be more clear, every time two different metals touch, they form a thermocouple that puts out a voltage that increases with temperature. So not only do the two dissimilar metals touching in the thermocouple generate a voltage, the point where the thermocouple wires connect to the board generate a voltage. The temperature sensor in the ADS1118 gives you a reading of the temperature on the board so you can compensate for that offsetting voltage.
Logged

Steve Greenfield AE7HD
CET Consumer Electronics and Computer
Please don't read your attitudes into my messages

Pages: 1 2 [3]   Go Up
Jump to: