how to increase DAC (digital to analog converter ) output voltage ? - Page 1
Forum section: electronics / general

author: ranganatennakoon
author_rank: Contributor
timestamp: January 27, 2023, 06:36:57 pm
content: the ESP32 DAC can handle0 to 3.3 VoltsbutI want 0 to 12 Volts DAC output. How can I do this task ?Thanks every one !

author: magic
author_rank: Super Contributor
timestamp: January 27, 2023, 06:41:15 pm
content: You can't, but you can amplify the 0~3.3V output by about 4x to get into the range you want.The simplest solution is a straightforward application of an opamp and you will need at least a 12V (or a little higher) supply rail for it.

author: ranganatennakoon
author_rank: Contributor
timestamp: January 27, 2023, 06:46:01 pm
content: a rail-to-rail op amp is good, isn't it? How should that circuit be?A non inverting amplifier with a typical gain of 4

author: magic
author_rank: Super Contributor
timestamp: January 27, 2023, 07:07:35 pm
content: Exactly, the standard noninverting circuit with two resistors. For example, 1k/2k7 would give 3.7x gain which is already more than enough.The type of opamp would depend on such things as:- what signal it is- how fast it needs to change- what load will be driven- how close to 0V and 12V it needs to get- is the positive supply exactly 12V or more- is a negative supply availableWith no negative supply and only 12V positive, rail to rail output is a necessity. Even then, it will typically stop some millivolts away from each rail, depending on load.

author: bidrohini
author_rank: Regular Contributor
timestamp: January 28, 2023, 10:28:19 am
content: There are a few ways to achieve a 0-12V output range from the ESP32's DAC, which only supports 0-3.3V output. One way is to use a voltage divider circuit before the DAC output to divide the 12V down to a 0-3.3V range that the ESP32's DAC can handle. Another way is to use an operational amplifier (op-amp) circuit to amplify the 0-3.3V output from the ESP32's DAC to a 0-12V range. You should also use a voltage regulator to keep output voltage stable and a protection circuit to protect the ESP32 from over voltage.It is important to note that the ESP32's DAC output is not designed for high current loads and may not be suitable for driving devices that require high current. It is better to use an external device like a DAC chip or a voltage driver to handle high current loads.

author: ranganatennakoon
author_rank: Contributor
timestamp: January 28, 2023, 05:28:01 pm
content: so I decided set Gain is 4. thanks everyone ! @bidrohini I knew it MCU can't handle high current loads. this is just a signal !

author: SiliconWizard
author_rank: Super Contributor
timestamp: January 28, 2023, 07:24:04 pm
content: Opamp as said. Rail-to-rail is particularly important for the negative rail (ground), as the positive one can always be powered with a supply with a voltage > max output voltage. You can always use a slightly negative voltage for the negative rail to allow going down as close to 0V as possible, as even a rail-to-rail opamp will always have a few mV of offset above ground if powered with a single supply.

author: magic
author_rank: Super Contributor
timestamp: January 28, 2023, 08:20:58 pm
content: Right.With 14V or higher supply and output loading to ground even the crappy LM358 could do, unless other specs preclude its use.

author: peter-h
author_rank: Super Contributor
timestamp: January 29, 2023, 01:01:28 pm
content: The DACs in these ARM32 chips are quite primitive. They swing "rail to rail" but have relatively hi-z outputs so are not capable of sinking any current if you want anywhere near zero, or anywhere near the top.Also - I don't know the esp32 but use the 32f417 - the DAC swings 0 to Vref, where Vref can be either taken off the VCC (3.3V, but this is primitive due to VCC noise) or off an externally supplied Vref (e.g. the dirt cheap 1% accurate TL431 for a Vref=2.5V) which is much better because you get better perf all around, and no problem with the upper end because the DAC has 3.3V available to it.So to get close to GND you want an op-amp whose input Vcm includes ground. Plenty of those e.g. LM358N will do GND to +12V output from a 14V rail. If you really are using the DAC for GND to 3.3V (noisy, as I state above) and need the full swing, then you will need a rail to rail input and output op-amp like TLV2333 which is very precise but costs a lot more. You can also achieve a 12V (approx) output with a 12V rail with the TLV.QuoteOnly if you are using it to sink some currentIf whatever it is driving draws no current @GND, and the output is MOSFETs, the output voltage could be just microvolts. The TLV2333 does exactly that. The LM358 output is an NPN current sink (active below 50uA IIRC) which will go pretty low but not microvolts.So it depends on the required accuracy. I would use a simple non inverting op-amp config.Some CPUs have a buffer option, sw selectable, on the DAC, which really buggers up the voltage swing because they aren't using a rail to rail op-amp.If you have no +12V rail then you will need a DC-DC converter... For low currents there are the capacitor-switch ones. People have even tapped off a MAX232 type chip but that only gives you about +8V.