Makeshift DAC + Charge pump with an Arduino - Page 1
Forum section: electronics / beginners

author: John_doe
author_rank: Regular Contributor
timestamp: November 26, 2020, 02:28:08 am
content: Hello everyone,I'm building a small project: A battery capacity meter with an INA226 module and I thought to myself, if I already have the current and voltage measuring capability, why not add functionality to measure the RDSon of a MOSFET at a user selectable Vgs (I already have an LCD and controls).the meter will use a 7.5v power source and I don't really want to add a second source or a DAC IC. So I looked online for simple solutions to create a higher, PWM controlled, voltage and found instructions for this:And trying to simulate the circuit seems to be working, when I lower the PWM I get a higher voltage:https://tinyurl.com/y25o2ls6My question is: Is there a better solution? And by better I mean cheaper/simpler while still functional (also, less current consumption is better, as this will run on a battery).Please note:-This will only be used to control the gate voltage, so basically, zero current draw. And the gate capacitance is not an issue because the MOSFET will be on long before the measurement starts.-Output voltage stability and accuracy is not critical, ±100mV is acceptable (but if it's free, more accuracy = better).-Minimum voltage I require is 12V but higher is better (up to 20V).Thanks.

author: Kleinstein
author_rank: Super Contributor
timestamp: November 26, 2020, 10:08:20 am
content: One could make the resistor values larger, to reduce the current and lower the cross over frequency.For the 2 signals there are 2 options: one is to have a separate clock for the charge pump and PWM part. If the frequency is different one would need an additional capacitor after the charge pump.If a related signal (the charge pump signal as the inverse of the PM signal) is used, one should change the resistor values: what is now 10 K should get smaller (like 1K) and what is not 6.8 K can get larger, like 47 K or maybe 100 K.An alternative version could use a weak charge pump (e.g. 100pF capacitors) and a relatively high value divider to measure the actual output voltage. To get down to zero one would need 2 stages. This may be more accurate if the 7.5 V for the supply is not regulated. For a fast turn off one may still want the MOSFET. As a side effect one may be able to measure the gate charge too (without the large filter cap). Small fets would still need a filter cap.I would not worry so much about the current for the DAC. By far the larger current would be from the FET itself. So it can be important to measure quite fast. So speed of the DAC can become an issue.

author: John_doe
author_rank: Regular Contributor
timestamp: November 26, 2020, 11:33:57 am
content: Thank you Kleinstein (That means "little stone", right?).I'm having a hard time understanding everything you said, but I'll try to make it out anyway.Quote from: Kleinstein on November 26, 2020, 10:08:20 amYes, I was actually meaning to tweak with the values if this circuit was to be used eventually.Quote from: Kleinstein on November 26, 2020, 10:08:20 amThe frequencies I used in the simulation (the link in my OP) are the ones that I plan to use in the final circuit, I.E. 32KHz for the pump (E.G. "tone(D8, 32000);" ) and ~1KHz for the PWM (the default Arduino PWM frequency for pin 6).They seem to work in the simulation without the additional cap... Do they have to be in some sort of sync?Quote from: Kleinstein on November 26, 2020, 10:08:20 amI can't seem to understand the circuit you suggest, think you can make a quick crude sketch?Quote from: Kleinstein on November 26, 2020, 10:08:20 amYou mean ID? If so, not to worry, I'm switching it with another MOSFET for only a short time.

author: Kleinstein
author_rank: Super Contributor
timestamp: November 26, 2020, 12:18:55 pm
content: For the version shown, it helps if the 2 frequencies are in sync. The PWM than has 3 parts: positive ( Charge pump pos, and FET off), off = neutral (Charge pump negative and FET off) and ground (FET on). Some of the µCs outputs should support directly generating to PWM signals with inverted polarity from hardware PWM. I am not sure if the Arduino software supports this or one would need to program directly to the registers. One could also use 2 channels of HW PWM to generate 2 synchronous signals and program the signal to give a useful sequence (avoid the both channels high phase, that only needs more current).With both signals out of sync it gets quite complicated, as there can be wild mixture and possibly also beat frequencies. In this case it would really help if there is an extra capacitor for filtering the charge pump signal.I have looked at the 2 stage charge pump version in a spice simulation. It kind of works, but not very good. The voltage is limited to some 8.5 V and control can be either via frequency or in a limited rage via PWM Or though an extra control loop from the ADC. It kind of needs the output cap. So measuring the gate capacitance would not really work.