Advanced pulsed DC current reading - Page 1
Forum section: electronics / projects

author: Thor
author_rank: Contributor
timestamp: January 21, 2014, 04:12:35 am
content: Hello all!I'm looking to make a current sensing device that does not read the rate.. But actually measures the consumption of coulombs.. Similar to how a gas station pump where you fill your car with petrol does not measure the rate of flow but measures the total volume that has flown into your gas tank.And I want to do this for pulse width modulation below 10khz.. That may possibly vary anywhere from 0 to 100 % duty cycle..Ive been thinking on this idea for a few days and I would like to explain the concept I have come up with.I was thinking a arduino Due would work best for this. idea..I would need a means to detect current via a analog reading... The current could be be a complex wave form.. not being square.. possibly having a rise to time it similar to a charging capacitor or more complex...The Arduino Due has a ADC that has a 1 mhz conversion rate so I would assume that means it can execute a analog read in 1uSI think 200,000 reads a second would be sufficient for what I want to accomplish..So it would perform a analog reading every 5uS taking 1 uS to read and leaving 4uS for computing in between readsThe reading would provide a analog voltage level that would typically be seen as amps (coulombs per second) since the reading is based on sensing the rate of current..so the computation for this would be something like this in code... keep in mind that this is simplifed math (not complete) just to push forward the point..float coulombs_for_5uS_ duration = analog reading amp rate value / 200,000so this would tell you the amount of coulombs in a 5uS duration...then you would have a float variable to keep adding each 5uS duration coulomb total into.. something like this in code..float total_coulombs = total_coulombs + coulombs_for_5uS_ durationSo if your keeping up with me this far you should be able to see I want to be able to measure volume of charge to the highest accuracy achievable for a non continuous dc wave form..one that may not be a constant current during switch and may have a sort of rise time or complex shape that this type of constant high speed reading via analog input might be able to increase accuracy of..I would like some input on this if possible and maybe some ideas on the type of circuit to use to sense something like this which the Arduino Due would work well interfacing withThanks!

author: Rerouter
author_rank: Super Contributor
timestamp: January 21, 2014, 07:36:39 am
content: The due only has a 12 bit dac between gnd and VCC, so it comes down to just how accurate you care about, say 0.1mA for a 409.6mA range (there is non linearity and scaling errors on the adc which may add up to 10 or more steps on average error)

author: Thor
author_rank: Contributor
timestamp: January 22, 2014, 01:40:45 am
content: A 12 bit dac is plenty accurate.. I more or less need to come up with the hardware outside of the due that will give me the best accuracy for amps in the range of 1ma to 20 or so amps..Then i need to be sure that 4uS us plenty of time to perform some calculations in between reads

author: dannyf
author_rank: Super Contributor
timestamp: January 22, 2014, 01:59:23 am
content: I have to say that some of your statements are not clear to me and appear to be conflicting.If you have to do everything in the mcu, research if the mcu has buffers or DMA for the ADC. Also, unless you have confirmed it via experiments, don't bank on reaching the datasheet spec on adc speed.If you allow the use of an external opamp - which will simplify things greatly for you, use an opamp to create a virtual ground and charge up a capacitor with the current to be measured - assuming it is reasonably small. You can then adc the voltage on the opamp's output. The beauty of this approach is that a) it doesn't require a fast adc; and b) it by definition measures the charge flowing into the capacitor (ie. current integrated over time).