Author Topic: how to increase DAC (digital to analog converter ) output voltage ?  (Read 2401 times)

0 Members and 1 Guest are viewing this topic.

Offline ranganatennakoonTopic starter

  • Contributor
  • Posts: 37
  • Country: lk
the ESP32 DAC can handle 0 to 3.3  Volts but I want 0 to 12 Volts DAC output. How can I do this task ?
Thanks every one !
 

Online magic

  • Super Contributor
  • ***
  • Posts: 6758
  • Country: pl
Re: how to increase DAC (digital to analog converter ) output voltage ?
« Reply #1 on: January 27, 2023, 06:41:15 pm »
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.
« Last Edit: January 27, 2023, 06:43:21 pm by magic »
 
The following users thanked this post: Sherlock Holmes

Offline ranganatennakoonTopic starter

  • Contributor
  • Posts: 37
  • Country: lk
Re: how to increase DAC (digital to analog converter ) output voltage ?
« Reply #2 on: January 27, 2023, 06:46:01 pm »
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
« Last Edit: January 27, 2023, 06:52:17 pm by ranganatennakoon »
 

Online magic

  • Super Contributor
  • ***
  • Posts: 6758
  • Country: pl
Re: how to increase DAC (digital to analog converter ) output voltage ?
« Reply #3 on: January 27, 2023, 07:07:35 pm »
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 available

With 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.
 
The following users thanked this post: ranganatennakoon

Offline bidrohini

  • Regular Contributor
  • *
  • Posts: 201
  • Country: bd
Re: how to increase DAC (digital to analog converter ) output voltage ?
« Reply #4 on: January 28, 2023, 10:28:19 am »
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.
 
The following users thanked this post: DarkMode

Offline ranganatennakoonTopic starter

  • Contributor
  • Posts: 37
  • Country: lk
Re: how to increase DAC (digital to analog converter ) output voltage ?
« Reply #5 on: January 28, 2023, 05:28:01 pm »



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 !
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14445
  • Country: fr
Re: how to increase DAC (digital to analog converter ) output voltage ?
« Reply #6 on: January 28, 2023, 07:24:04 pm »
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.
 
The following users thanked this post: ranganatennakoon

Online magic

  • Super Contributor
  • ***
  • Posts: 6758
  • Country: pl
Re: how to increase DAC (digital to analog converter ) output voltage ?
« Reply #7 on: January 28, 2023, 08:20:58 pm »
Right.

With 14V or higher supply and output loading to ground even the crappy LM358 could do, unless other specs preclude its use.
 
The following users thanked this post: ranganatennakoon

Offline peter-h

  • Super Contributor
  • ***
  • Posts: 3694
  • Country: gb
  • Doing electronics since the 1960s...
Re: how to increase DAC (digital to analog converter ) output voltage ?
« Reply #8 on: January 29, 2023, 01:01:28 pm »
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.

Quote
even a rail-to-rail opamp will always have a few mV of offset above ground if powered with a single supply.

Only if you are using it to sink some current :) If 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.
« Last Edit: January 29, 2023, 01:05:10 pm by peter-h »
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf