Questions about using uCurrent with Arduino Analog Input - Page 1
Forum section: electronics / beginners

author: peter64
author_rank: Newbie
timestamp: July 27, 2015, 07:17:29 am
content: Hello EEVblog,This is my first post so please let me know if I make any mistakes or I need to provide additional details.I recently purchased two uCurrents with the intention to use them as inputs for arduino analogue inputs.I am attempting to make a simple calorimeter to attempt to measure the thermal output of resistors as a small project.I was hoping to use the arduino to measure the temperature of various parts of the calorimeter in conjunction with the current and voltage across the load.From all this data I was going to attempt determine calibrate my calorimeter based on the input power and the output thermal heat.The specifics of my setup are as follows:An Arduino Due power from 8AA batteries.4 LM35D temperature sensors wired to A0-A3 powered from 5v and attached to the Arduino 5vGNDA uCurrent to measure the current flowing through Rload in mA or uA and convert to a voltage I can use on the Arduino analog input.Rload is being powered from an independent 9V battery but I am also using a voltage divider with various points to tap into to provide various voltages to the Rload used to calibrate the calorimeter.The uCurrent has its negative voltage terminal wired to the 5vGND (I've also tried the 3.3vGND as well) and the positive terminal wire to the arduino analog input. The current inputs are in line with Rload.The good news is that the uCurrent provides me with the correct current value (or sufficiently close to it).The bad news is that every time I change the voltage over Rload it seems to bias the temperature reading on my sensors by a large margin.I've attached a screenshot of a chart showing my 4 temperature sensors readings temp0-temp3 connected to A0-A3 respectively (in degrees C).It also has current4 which is the current in micro amps.Prior to hooking up the uCurrent the temperature sensors did not change in the fashion they now are when current went through Rload.They would increase steadily based on the actual heat.The effect on the temperature sensors appears to be most concentrated in temp0 (corresponding to A0).The other sensors also fluctuate but no where near the same degree.When I use a DMM to measure current there is no similar fluctuation.I'm sure I'm missing something fundamental regarding the operation of the uCurrent and how it is working in my system.Let me know if there are any additional details I can provide.Any help would be appreciated.Peter

author: Simon
author_rank: Unknown
timestamp: July 27, 2015, 07:37:25 am
content: Hello Peter, I've not fully understood your setup. You say something about using a voltage divider to get different voltages from the 9V battery, you are aware of course that this is bad practice unless you are drawing small currents else the load has an effect on your divider. The uCurrent will still have a burden voltage albeit much lower.Also be careful of the power switch, if you pull it all the way down it will short the input, this is so that you can change range without interrupting your circuit. So if your changing range you flick the power switch to short, change the range switch and then switch back again to normal on position.

author: peter64
author_rank: Newbie
timestamp: July 27, 2015, 08:11:30 am
content: Thanks Simon for your fast reply.I've attached an image of a circuit diagram that will hopefully help show what I'm doing. One thing to add is that the uCurrent is being powered by a separate 3V c2032 battery.I'm just having difficulty understanding why having the uCurrent in the circuit at all should effect the temperature sensors.I could understand if it had a burden load which resulted in a change of the power dissipated by Rload. But I can't understand why it would have any effect on the Arduinos other analog inputs.Let me know if I can provide any further details to help you understand the issue better.The current flowing through Rload is some where in the order of 1mA so I think it should be ok.Thanks again,Peter

author: Simon
author_rank: Unknown
timestamp: July 27, 2015, 11:50:39 am
content: I see your problem, remember that the two negative sockets on the uCurrent are connected together so you have the negative current sense on the positive side of your load, this is basically connecting the positive side of your load to GND. It would be better to put the ucurrent on the negative side of the load.

author: Simon
author_rank: Unknown
timestamp: July 27, 2015, 11:51:39 am
content: having said that the uCurrent is as you say on it's own battery and the load is also on it's own battery

author: peter64
author_rank: Newbie
timestamp: July 27, 2015, 12:21:17 pm
content: Thanks again Simon for your help.I tried as you said to put the uCurrent after the load. It didn't appear to have any effect. I included my logged data below.I wonder if the uCurrent needs to have it's battery negative tied to the same Arduino Due 5VGND that the uCurrent V- is tied too, so it isn't floating any more.Would that break the uCurrent if I tried that and if not, is there any reason to think it might help?Quote

author: Jeroen3
author_rank: Super Contributor
timestamp: July 27, 2015, 12:40:15 pm
content: Quote from: peter64 on July 27, 2015, 12:21:17 pmYou have connected the negative output terminal to GND of the Arduino. So it is not floating anymore.Also, connecting battery negative to anywhere would render the virtual ground useless, probably killing some parts.http://www.eevblog.com/files/uCurrentRev5schematic.pdfThe opamp U2 is generating Vbat/2 virtual ground that you have connected to the output gnd.

author: peter64
author_rank: Newbie
timestamp: July 27, 2015, 01:04:18 pm
content: Thanks Jeroen for the schematic, and explaining why I shouldn't wire the battery terminal to anything.I'm really curious whats going on and why its causing the voltage on other analog inputs on the arduino due to change.If anyone else has any thoughts or things that I could test I'm happy to take voltage and current measurements else where in the circuit while the uCurrent is running.

author: peter64
author_rank: Newbie
timestamp: July 27, 2015, 01:25:52 pm
content: I was doing some hunting online to see if I could find anything Arduino related that might give clues, but I'm a bit out of my league with this.I was looking for any reference of ADC inputs being dependent on other ADC inputs. This is all I came up with but I can honestly say I don't understand if the uCurrent would be a cause of this ADC input dependence. (http://www.eevblog.com/files/uCurrentRev5schematic.pdf)http://mjlorton.com/forum/index.php?topic=439.0Quote

author: peter64
author_rank: Newbie
timestamp: July 27, 2015, 01:51:31 pm
content: The more I read, I'm pretty sure the issue lies in how the Due ADC is working.It makes sense because the order I am reading the inputs is temp0 -> temp1 -> temp2 -> temp3 -> current4 -> temp0.Since temp0 follows current4 it is probably experiencing the most distortion as the value settles.I will need to try and tweak the Due ADC settling time to see if this fixes the value.I will update here once i figure out how with the result.

author: Simon
author_rank: Unknown
timestamp: July 27, 2015, 03:42:03 pm
content: Well as it's an arduino I'd expect the analogue libraries to handle timings, the analogue clock is limited to make sure there is enough time for the sample and hold capacitor to charge to discharge as it's the same ADC and front end for all 8 channels. maybe put a delay in after the 4th channel read

author: peter64
author_rank: Newbie
timestamp: July 28, 2015, 12:55:11 am
content: Just to update that I've resolved my issue.1) delaying after reading didn't help didn't help.2) changing the adc tracking time and prescaler did helpQuote3) the most effective solution however was just to read the same adc input 105 times and discard the first 5 before moving to the next adc input and reading it 105 times. reading and dropping the first 5 results eliminated almost all the noise. this worked in my case because I am time averaging values for increased precision.

author: Simon
author_rank: Unknown
timestamp: July 28, 2015, 05:58:05 am
content: sounds like the arduino library guffed up.