Hi to everyone..
I am having a problem with DAC hardware for ESP32.
My code is as follows.
from machine import DAC
from machine import Pin
d = DAC(Pin(25,Pin.OUT))
d.write(0)
While I should read 0 volts on pin 25, I am reading about 0.1 volts.
This is a serious problem for me.
Does anyone have a solution suggestion on the subject.
Best Regards.
DAC Problem
Re: DAC Problem
I'm also dealing with this issue. It is not uncommon for ADC outputs not to swing rail-to-rail. It could also be the result of input offset voltage. Either way, an external circuit might be needed. I'm getting better than 0.1V, but it's still not 0.
I plan to use a low voltage rail-to-rail opamp configured as a differential amplifier to get 0 at the oputput. I'll add a small offset voltage to the (-) input to force the output to 0. Scale range can be set by the gain of the resistors. Equations can be seen here: https://www.electronics-tutorials.ws/opamp/opamp_5.html
There's a brief discussion of this issue here, https://electronics.stackexchange.com/q ... zero-volts
I'm waiting for parts. I ordered some MCP602 chips. They're about the only through-hole low-voltage, rail-to-rail opamps I found. The LM358LV (not to be confused with the LM358P) has the right specs but is only available in surface-mount.
Hope this helps.
I plan to use a low voltage rail-to-rail opamp configured as a differential amplifier to get 0 at the oputput. I'll add a small offset voltage to the (-) input to force the output to 0. Scale range can be set by the gain of the resistors. Equations can be seen here: https://www.electronics-tutorials.ws/opamp/opamp_5.html
There's a brief discussion of this issue here, https://electronics.stackexchange.com/q ... zero-volts
I'm waiting for parts. I ordered some MCP602 chips. They're about the only through-hole low-voltage, rail-to-rail opamps I found. The LM358LV (not to be confused with the LM358P) has the right specs but is only available in surface-mount.
Hope this helps.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: DAC Problem
The other option is to use a host with a decent DAC such as a Pyboard. Note that, in my testing, the ESP32 DAC is also adrift at the high end of its range.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
-
- Posts: 2
- Joined: Thu Apr 15, 2021 8:25 pm
Re: DAC Problem
Apparently we can't handle it without using extra hardware.
I will try with difference amplifier or external DAC.
Thank you very much for your answers.
I will try with difference amplifier or external DAC.
Thank you very much for your answers.
-
- Posts: 61
- Joined: Fri Feb 15, 2019 9:22 am
Re: DAC Problem
This situation is determined by the internal circuit of the chip. As described in the manual, the internal DAC output goes through an operational amplifier to the pin, and it is difficult to achieve the rail to rail output with this structure
The DAC of STM32 has a similar feature after the buffer is turned on, but the buffer of STM32 can be turned off.
The DAC of STM32 has a similar feature after the buffer is turned on, but the buffer of STM32 can be turned off.