I'm working on a smart power controller and I have a few remaining questions before I commit to my next couple purchases.
Project Objective: Operate a DC current regulator, for a load which has a varying resistance, and requires a fixed current of 2ma (configurable range 0.5ma - 2.0ma). Pretty simple, right?
I chose these breakout boards but haven't purchased yet:
Current Sensor: INA219 High Side DC Current Sensor Breakout - 26V ±3.2A Max [STEMMA QT] : ID 904 : $9.95 : Adafruit Industries, Unique & fun DIY electronics and kits
Power Source Controller: MCP4725 Breakout Board - 12-Bit DAC with I2C Interface [STEMMA QT / qwiic] : ID 935 : $4.95 : Adafruit Industries, Unique & fun DIY electronics and kits
This diagram roughly shows how I started the project using whatever components I already had:
So the low pass filter seems to work, but the response time isn't fast, which is why I am considering the MCP4725 DAC board.
My main questions are:
• Should I isolate the powersource of the duino from the powersource to the load? If so, how? And what voltage should I use for the power source to the load, or how do I figure out what voltage to use? A 24v battery had been recommended.
What are R1 C1 and D1 for
Surely its more efficient if the transistor is completely On or Off (Class D amplifier) ?
R1 and C1 form a low pass filter to operate the transistor to vary the power. That's what I'm thinking of replacing with the MCP4725 DAC.
Ah OK. My missunderstanding
It thought you were making a switch mode constant current controller, not a linear one.
What is the load ? A battery ? or some other device ?
BTW. I'm not sure your circuit will work with just one sensor input.
You can determine the voltage across the load R3, but unless R3 is a know constant resistance (ie not something like a battery), you will not be able to determine the current through R3
You would be better off sensing both sides of R2 to determine the voltage across R2, which would give you the current as I presume R2 is a fixed resistance
There is also the issue with the value of R2 to give enough voltage to be measurable by the ADC i,e for max resolution, at max current the voltage across R2 would be 5v (or just under)
Normally this means that R2 ends up being not such a low value resistor e.g.
R2 would need to be 5/0.0002 = 25k. But this would need to be a 5W resistor !
Hence depending on the value of R3, you would need a large enough supply voltage e.g. 12V in would give approx 5V out with the volt drop in R2 and the transistor.
BTW. This thread should probably be moved to the electronics section
However if R3 a known constant, then this would not be an issue
The load would be another device, and the resistance does vary.
Thanks for going into detail for me. I don't have any formal EE training. I experimented with the low side sensing and it seems to me that the arduino won't be as precise as I need. I ordered two of the INA219 breakout boards to try one on the high side and one on the low side.
I ordered two of the INA219 breakout boards to try one on the high side and one on the low side
I'm not sure you need 2 of these, looking at the block diagram it seems to imply that it has 2 inputs, i.e one each side of the shunt resistor
However looking at the spec, I don't think this is going to be very much better than using the Arduino on its own
e.g. the device seems to contain a comparator with a 12 bit ADC, but it can cope with inputs of differential of 26 (or possibly 52V), and I can't see any form of pre-scaler in the block diagram before the ADC
But looking a bit further down the spec there seem to be some sort of controls in the I2C registers that perhaps have this effect.
So perhaps it would be better than using the Arduino ADC lines
I guess you'll carefully need to read the spec (if you've not already done so)
Hi, if you only need 2mA current regulation, why use an arduino.
Have you googled to see the number of single transistor current sources that only use a couple of components?
What is the load that needs constant current rather than voltage at that low level?
The OP has not indicated quite why they need to do this but they need
(configurable range 0.5ma - 2.0ma)
I agree that if he just wants a 2ma constant current device it would be very easy to build an analogue circuit to do it.
But the OP seems to need configurable constant current
Hi, roger, yes but all you need is to use a configurable resistor, ie a pot. LOL
I’d love to know exactly what the application is.
yes but all you need is to use a configurable resistor, ie a pot. LOL
Or if you wanted to have Arduino control, I guess you could use one of those "digital pot" chips (never used one myself).
I hope you guys don't mind, but I don't want to get into the details of what the load is.
I have looked at building this as a simple circuit of few components. The internet overwhelmingly seems to think that the LM317 does everything I could ever need. I've run some spice simulations on this chip and it doesn't provide the kind of control I'm looking for.
• Device automatically regulates current as load resistance changes.
• Device runs for configured duration of time before powering down.
• Power rise and fall is always smooth / gradual.
Looks like the load resistance is around the range of 1k to 1.5k ohms.
I received the current sensors from Adafruit and started playing with them. Doesn't seem to be making things any easier. Would it be possible to increase the accuracy of the voltage reading from analogRead() if I used a voltage divider to lower the reference voltage?
I'm going to start a new thread in the electronics section as Roger suggested. I think this boils down to the situation that I am trying to recreate the same type of current measuring circuit that any common multimeter would use, and I'm learning as I go.