I like the dev board they are using to monitor the clock, current and mode etc… and wouldn’t mind making a little one myself just to monitor current consumption of a circuit accurately. Whats the best method to monitor currents at that accuracy? I would like to take power from one source to power up the LCD and then power the peripheral board from that, so it can be like a plug-in to insert between power supply and board to monitor current. Any guidance as where to start would be brill thanks.
You can monitor current flow to ground (low side) using a current-to-voltage converter or transconductance op amp. The current flows into the op amp’s inverting input with the non-inverting input held at ground. That makes the inverting input be a virtual ground and thus no voltage drop along that current flow connection (as opposed to flowing the current through a resistor and then measuring the voltage drop across that resistor). A resistor from op amp output to inverting input converts the current to a voltage at the op amp output and V=-i*R. So R=10 megohms would produce 1 V for 100 nA.
About -1V actually (depending on how good your op-amp is). This tactic depends on having a negative supply available, because it pulls the 10M resistor below ground far enough that the 100nA across it doesn’t result in much of an offset relative to ground. However, in essence you really are still just measuring voltage across a resistor. Your accuracy will depend heavily on the resistor tolerance, and how much money you pay for the amplifier. Many op-amps have input currents near 20nA.
You would have to switch a short to ground in and out of the circuit, so you could actually run the PIC and set it into sleep mode, then pull out the short so you can measure current through the device without resetting.
Thanks for the advice I’ll have a look at some amps today see what I can find.
With an ADC 8-bit I would only have 1024 resolution, and because I want to measure 1nA, that would limit me to about 1mA at the top end. I would like to have another stage running either parallel to this one, or only when the range is above 1mA, that has a 1mA bit giving a new range of 1 to 1024mA. What is the best way to implement this, just another setup the same with a different resolution, or something different?
Measuring with LSB of 1 nA over 8 bits (1024) means a top end of 1 uA not 1 mA. You need another factor of 1000 to get to 1 mA. You can change ranges by using a switch (mechanical or solid state) to change feedback/gain scaling resistors and just use one op amp. Do you want auto-scaling ?
Ah ye sorry thats what I meant, I would need 3 stages then. Auto-scale would be nice but if it adds a lot of complexity just manual switching will do. I guess the simpliest would be to switching the resistor on the feedback of the amp. Could I do this purely with PIC pins or would it require switches?
The PIC cannot do the switchign direclty. You need another device such as mechanical or solid state relay. So at that point you may as well just use 3 op amps (quad op amps are available) with different resistors.