Is it true that the ESP32 S3 will remove the DAC?

eriksl
Posts: 116
Joined: Thu Dec 14, 2023 3:23 pm
Location: Netherlands

Re: Is it true that the ESP32 S3 will remove the DAC?

Postby eriksl » Sat Aug 10, 2024 9:03 am

I want to use it to control a LED driver. It can be controlled using a PWM wavevorm, so that's no problem, but it also has the possibility to limit the actual current sent through the led by applying a DC voltage to a control pin. I think that's a tad better to use as there is no risk for flickering at all. My fear is that a control signal containing ripple will result in flickering after all. That's where a DAC would be ideal (actually I can see no other useful purpose for it on a microcontroller). I am not sure how much ripple would be acceptable, the datasheet doesn't mention any value and I don't want to find out after building the thing ;).

So for the moment I am contemplating between going for PWM after all (which is dead simple and has by far the largest resolution) or use the highest possible PDM frequency and try to remove some ripple using a simple filter (3 passive components max, no op-amps etc., no coils either).

MicroController
Posts: 1756
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Is it true that the ESP32 S3 will remove the DAC?

Postby MicroController » Sat Aug 10, 2024 11:16 am

eriksl wrote:
Sat Aug 10, 2024 9:03 am
My fear is that a control signal containing ripple will result in flickering after all.
Shouldn't be a problem.
Say you could perceive any flickering up to 100Hz, and you use 100KHz for the PWM. Even a simple 1st order RC low-pass @ f[c]=100Hz will reduce the voltage fluctuations from the PWM by close to 3*20dB=60dB, i.e. by a factor of 1/1000000, which corresponds to a ripple amplitude of 3.3uV after the filter.

Also, check the datasheet of the LED driver. Chances are that it supports PWM control just as well as analog, as if it had an integral LPF.
Last edited by MicroController on Sat Aug 10, 2024 11:25 am, edited 1 time in total.

eriksl
Posts: 116
Joined: Thu Dec 14, 2023 3:23 pm
Location: Netherlands

Re: Is it true that the ESP32 S3 will remove the DAC?

Postby eriksl » Sat Aug 10, 2024 11:24 am

The effectiveness of the filter depends for a large part on the load applied. I assume the load from a control input pin is very light so it will be no problem. I should look it up in the datasheet I guess.

Also I guess you meant PDM and not PWM. PWM control is no problem. The issue is achieving a pure, ripple-free DC voltage using PDM. Especially PDM because it can achieve a much higher frequency and the exact pattern of the wave is not important here, just the density.

MicroController
Posts: 1756
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Is it true that the ESP32 S3 will remove the DAC?

Postby MicroController » Sat Aug 10, 2024 11:35 am

No, I actually meant PWM because you indicated that you want a high resolution.
For very low or very high duty cycles, PDM approaches PWM, so, filter-wise, PWM can be regarded as a 'worst-case' PDM.

aliarifat794
Posts: 200
Joined: Sun Jun 23, 2024 6:18 pm

Re: Is it true that the ESP32 S3 will remove the DAC?

Postby aliarifat794 » Sat Aug 10, 2024 1:29 pm

But why actually? DAC is necessary in many projects, isn't it?

eriksl
Posts: 116
Joined: Thu Dec 14, 2023 3:23 pm
Location: Netherlands

Re: Is it true that the ESP32 S3 will remove the DAC?

Postby eriksl » Sat Aug 10, 2024 3:01 pm

No I don't think so. Any DAC on a microcontroller is always very low quality, due a.o. to interference with the digital RF clock and data signals. It's only suitable for outputting steady DC voltages (like I need now). For any other purpose, use an external, high quality DAC over I2S or SPI or use PDM. So I can imagine why Espressif dropped the module.

MicroController
Posts: 1756
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Is it true that the ESP32 S3 will remove the DAC?

Postby MicroController » Sat Aug 10, 2024 6:03 pm

aliarifat794 wrote:
Sat Aug 10, 2024 1:29 pm
But why actually? DAC is necessary in many projects, isn't it?
I feel that in 98% of cases, people are fine with just using PWM.

Btw, (some?) newer ESP's, including the S3, also have multiple channels of 8-bit PDM built into the GPIO peripheral ("sigma delta modulator"), which kind-of makes up for the lack of an actual integral DAC.

ESP_Sprite
Posts: 9773
Joined: Thu Nov 26, 2015 4:08 am

Re: Is it true that the ESP32 S3 will remove the DAC?

Postby ESP_Sprite » Sun Aug 11, 2024 12:25 am

eriksl wrote:
Sat Aug 10, 2024 11:24 am
The effectiveness of the filter depends for a large part on the load applied. I assume the load from a control input pin is very light so it will be no problem. I should look it up in the datasheet I guess.
In that case, why not follow up the filter with an opamp in a non-inverting buffer configuration? Gives you more-or-less zero load. (Or go for the Sallen-Key configuration: twice the rolloff of a RC filter and because it integrates an opamp it's also not dependent on the load.)

eriksl
Posts: 116
Joined: Thu Dec 14, 2023 3:23 pm
Location: Netherlands

Re: Is it true that the ESP32 S3 will remove the DAC?

Postby eriksl » Sun Aug 11, 2024 6:58 am

That's what I figured, but I don't think the simple stuff I want to do is warranting the additional components like an opamp. Let's see what the input impedance of the control pin is and see if it's high enough to create a simple passive filter.

eriksl
Posts: 116
Joined: Thu Dec 14, 2023 3:23 pm
Location: Netherlands

Re: Is it true that the ESP32 S3 will remove the DAC?

Postby eriksl » Sun Aug 11, 2024 7:12 am

Hmmm no specification of the input impedance, but it's mentioned that there is a 200 kOhm pull-up, so the impedance is probably even higher. The example uses a generator frequency of 1 MHz, but I can't find any actual limits in the documents. 1 MHz would be very good though, easily to filter passively.

Apparently, when using a first order RC filter, using a capacitor of 470 nF and the intrinsic impedance of the control pin (200 kOhm), you'll get a -3 dB cutoff point of around 2 Hz. That will do I guess ;).

But if the frequency could be set even higher, it would be great.

Who is online

Users browsing this forum: adrianomunin and 89 guests