ESP32 C3: Confused about ADC settings

For general Flowcode discussion that does not belong in the other sections.
Post Reply
MJU20
Posts: 338
http://meble-kuchenne.info.pl
Joined: Tue Dec 08, 2020 5:11 pm
Has thanked: 93 times
Been thanked: 67 times

Flowcode v10 ESP32 C3: Confused about ADC settings

Post by MJU20 »

I'm using an ESP32 C3 super mini to send data to an MQTT server.

Between every publish, I sample a voltage on AN0 using an FC10 ADC component.
I return the sampled voltage and aim to get as close to the actual voltage as possible.
However, I have never needed to use the ADC before, and now I am confused about the settings.

I am using a voltage divider with 390K and 110K resistors.
The expected input voltage could be as high as 5V, but the ESP32 C3 reference voltage is approximately 1.1V:
Per design the ESP32-C3 ADC reference voltage is 1100 mV, however the true reference voltage can range from 1000 mV to 1200 mV among different chips. To minimize this difference, hardware calibration is introduced.
Now I need to configure the FC ADC component:

- Vref Voltage is set to 500 (5V).
- Vref option is set to 950 mV (changing this doesn't affect the output).

I need to multiply the measured value by 2.81 to get an accurate reading (compared to my multimeter).
Is this a reasonable value, or am I overlooking something?

The voltage divider is chosen so that the maximum voltage never exceeds the 1.1V reference voltage.

Could someone please help me understand what might be going wrong?

medelec35
Matrix Staff
Posts: 1950
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 624 times
Been thanked: 656 times

Re: ESP32 C3: Confused about ADC settings

Post by medelec35 »

Hello
If you want to the closest voltage possible, then I would suggest to use the GetVoltage since that is affected by Vref voltage adjustments within properties.
GetByte/GetAverageByte or GetInt/GetAverageInt are not.

You can adjust Vref voltage until the voltage agrees with Multimeter set to the volts range.
Martin

jgu1
Posts: 789
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 680 times
Been thanked: 176 times

Re: ESP32 C3: Confused about ADC settings

Post by jgu1 »

Hello MJU20!

I will not hijack, but are you able to compile the ESP32 C3 super mini? I cannot compile, please.

Br Jorgen

MJU20
Posts: 338
Joined: Tue Dec 08, 2020 5:11 pm
Has thanked: 93 times
Been thanked: 67 times

Re: ESP32 C3: Confused about ADC settings

Post by MJU20 »

medelec35 wrote:
Thu May 08, 2025 9:30 am
Hello
If you want to the closest voltage possible, then I would suggest to use the GetVoltage since that is affected by Vref voltage adjustments within properties.
GetByte/GetAverageByte or GetInt/GetAverageInt are not.

You can adjust Vref voltage until the voltage agrees with Multimeter set to the volts range.
Thank you for your response. Recently, I haven't been receiving any emails when there's a response in a topic where I indicated that I wanted a notification. My email settings are correct.

But again, thank you for your reply. I thought there might be a more technical, mathematical approach. :D

I did what you suggested: I measured the voltage of the battery I wanted to monitor using the ADC and read the value from the GetVoltage macro. This gave me a strange value that I had to correct with a factor (measured value = macro value * factor).

I was hoping for a more scientific explanation without having to use a multimeter.

@jgu1: Yes, I can compile it, I have ESP-IDF 5.3 installed and have no issues with the ESP32-C3-Supermini.

jgu1
Posts: 789
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 680 times
Been thanked: 176 times

Re: ESP32 C3: Confused about ADC settings

Post by jgu1 »

Hi MJU20!

Thank you for answer, thats odd, I also use 5.3.1 but I cannot compile none of the C model? I see that there are also the same issue with the C model as with the S3 model as I desribe here: viewtopic.php?t=3150

Br Jorgen

KikeRico
Posts: 23
Joined: Wed Aug 10, 2022 1:42 am
Location: Mexico
Has thanked: 2 times
Been thanked: 8 times

Re: ESP32 C3: Confused about ADC settings

Post by KikeRico »

Hi, I read the issue. But take in account that for ESP32 all voltage mustbe between 0V and 3.3 V any value below or above these values must damage the IC, inlcuded the ADC converters :!:
Then I suggest to you check your before your circuit and do the proper arragement to input the signal as you wish.
Attachments
ESP32 ADC input voltage.JPG
ESP32 ADC input voltage.JPG (39.5 KiB) Viewed 258 times

jgu1
Posts: 789
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 680 times
Been thanked: 176 times

Flowcode v10 Re: ESP32 C3: Confused about ADC settings

Post by jgu1 »

Hi KikeRico!

Thank you for your advice. I am aware of the 3,3Volt and this is not the issue. I have not started a project with the ESP32 C3 yet. I have only try to compile a simple program ( loop and a delay) to Hex, and this is not possible, get error already in the begining of compiling. This is for all the C3 device.

The odd thing for me, you and MJU20 have no problem. I also use ESP 5.3.1?

But anyway, There are so many devices i Flowcode10 so I use the S3 device instead, it work. ;)

Br Jorgen

medelec35
Matrix Staff
Posts: 1950
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 624 times
Been thanked: 656 times

Re: ESP32 C3: Confused about ADC settings

Post by medelec35 »

Hi Jorgen.
For people that installed 5.1 and above following the guide on the wiki some time ago, are the only people that the ESP C3 will work for.
Currently anyone who tries that now will face further issues due to the updates expressif have put in place.
Unfortunately, we have no control over that, so we are looking at a potential solution.
If you are one of those people and have not deleted the 5.1+ directory, hen you could have a chance in getting your C3 to work.
Martin

jgu1
Posts: 789
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 680 times
Been thanked: 176 times

Flowcode v10 Re: ESP32 C3: Confused about ADC settings

Post by jgu1 »

Ok Martin, it make sense, no rush, I was just wondering why I couldn't compile and i work for some other thank´s, I have patience and I still use the S3 device ;)

Jorgen

Post Reply