Comments on: ESP32 ADC – Read Analog Values with Arduino IDE https://randomnerdtutorials.com/esp32-adc-analog-read-arduino-ide/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Thu, 13 Nov 2025 17:26:57 +0000 hourly 1 https://wordpress.org/?v=6.8.5 By: Dejan https://randomnerdtutorials.com/esp32-adc-analog-read-arduino-ide/#comment-1123476 Thu, 13 Nov 2025 17:26:57 +0000 https://randomnerdtutorials.com/?p=85752#comment-1123476 I just noticed, you didn’t said a word for two channels of ADC on ESP32. There are ADC1 and ADC2. When using the WiFi or the Bluetooth, you can not use the ADC2.

]]>
By: Ray Jones https://randomnerdtutorials.com/esp32-adc-analog-read-arduino-ide/#comment-1081296 Tue, 12 Aug 2025 22:24:04 +0000 https://randomnerdtutorials.com/?p=85752#comment-1081296 In reply to Bernie.

Would not a purist actually go for the unambiguous types?

eg uint8_t, int32_t etc.

No if buts or maybes.
But as the article is for an ESP32, an int is the native integer size of 32 bits.

What may come as even more of a surprise though is you may well save memory space, but using 8 bit integers can also increase code space. I discovered this when getting desperate to reduce the code footprint, and found that replacing uint8_t with int reduced code space, especially via function call parameters!

A clear case of what the book says may not meet real world expectations!

]]>
By: Bernie https://randomnerdtutorials.com/esp32-adc-analog-read-arduino-ide/#comment-1081285 Tue, 12 Aug 2025 21:21:02 +0000 https://randomnerdtutorials.com/?p=85752#comment-1081285 As a purist, I would like to take issue with this statement:

int potValue = 0;

The type int bothers me. On an 8 bit MCU, int can be just a byte. In this case, it will overflow and carry the wrong value. Or if the MCU is 32 bits, int will be a long, and it is a waste, because the value is less than 1024. Imagine you have the following arrays:
static int A[10000];
static short B[10000];
Then A will take twice the memory of B, if int is long. If values are shorts, then array A will waste 20,000 precious static bytes.

Also not that for a static, potValue is initialized to 0 by default by the compiler. No need to assign it to zero. I doubt code would be generated for that, but it makes the source look cleaner without the “= 0”.

Just sayin …

]]>
By: Martin https://randomnerdtutorials.com/esp32-adc-analog-read-arduino-ide/#comment-1006368 Sat, 08 Feb 2025 19:19:51 +0000 https://randomnerdtutorials.com/?p=85752#comment-1006368 In reply to Mark Kelly.

Are you using a LIN or LOG potentiometer?

]]>
By: lettcco https://randomnerdtutorials.com/esp32-adc-analog-read-arduino-ide/#comment-986861 Tue, 26 Nov 2024 22:34:27 +0000 https://randomnerdtutorials.com/?p=85752#comment-986861 Can you comment on analogReadMilliVolts() vs analogRead()? I am interested in using the former, knowing that max V is 2.865 but is a lot more precise. Thanks!

]]>
By: We https://randomnerdtutorials.com/esp32-adc-analog-read-arduino-ide/#comment-983760 Sun, 17 Nov 2024 02:49:49 +0000 https://randomnerdtutorials.com/?p=85752#comment-983760 In reply to Chris.

Other comments above convey this same information. When the esp32 looks at an analog input, if attenuation is set to 0dB, then it maps the values 0-4095 to voltages 0-1100 mV. I’ve seen that the default is 0dB. To change the behavior of the esp32 one must change the attenuation. To get full range 0-4095 mapped to 0-3300 mV the attenuation should be 11 dB. By changing attenuation, I think the esp32 routes the signal through internal voltage divider resistors before reading its value.

]]>
By: Martin Jakobsen https://randomnerdtutorials.com/esp32-adc-analog-read-arduino-ide/#comment-976878 Tue, 29 Oct 2024 06:54:55 +0000 https://randomnerdtutorials.com/?p=85752#comment-976878 In reply to John.

Have you tried turning off the WiFi/Bluetooth radio while sampling?

]]>
By: John https://randomnerdtutorials.com/esp32-adc-analog-read-arduino-ide/#comment-976573 Mon, 28 Oct 2024 03:26:01 +0000 https://randomnerdtutorials.com/?p=85752#comment-976573 I am getting huge noise problems with the A/D inputs on the Wroom ESP32 revc part. I have a 10K pot, connected to gnd and 3.3v pins. wiper is connected to A6 (34), although it doesn’t seem to matter which port I use. If I run in a loop sampling the port everything seems to work properly, but if I don’t touch the pot knob, my readings are all over the place.. usually within 15-20 but sometimes jumps of over 200. I’ve put .1uF cap on analog pin, tried filter cap on 3.3v supply, fiddled with attenuation, makes no difference. Same configuration on Uno is rock solid. This happens with all three processors I tried. Any ideas?

]]>
By: Paul Cas https://randomnerdtutorials.com/esp32-adc-analog-read-arduino-ide/#comment-966562 Fri, 04 Oct 2024 18:55:08 +0000 https://randomnerdtutorials.com/?p=85752#comment-966562 I am trying to set up more then 4 Pot meters to the ADC Channels.

I keep getting cross talk and interference between all of the different potentiometers. Can you do a guide for dealing with this?

I know i have a problem with capacitors but this would be helpful!

]]>
By: Marcos https://randomnerdtutorials.com/esp32-adc-analog-read-arduino-ide/#comment-909331 Wed, 24 Apr 2024 13:56:40 +0000 https://randomnerdtutorials.com/?p=85752#comment-909331 In reply to Blackneron.

Thank you! I will do your steps yet but I was wondering why when I receive 1.72V it interprets as 1.51V, and 370mV as 290mV, when all the inputs were tested in laboratory before…

]]>