← All journal entries
Aug 04, 2026

First ESP32 sensor rig — reading raw analog values

electronicsesp32sensors2 min read

What I worked on

Wired up an ESP32 dev board to a basic photoresistor voltage divider and got it reading analog values over serial. Nothing fancy — the goal was just to prove the whole chain works before I build anything more complex on top of it: sensor → ADC → serial → my eyes.

What I learned

  • The ESP32's ADC is 12-bit (0–4095), not 10-bit like the classic Arduino Uno I'm used to. That tripped me up for a few minutes because my mental math assumed a 0–1023 range.
  • ESP32 ADC2 pins conflict with Wi-Fi — if Wi-Fi is active, ADC2 readings get unreliable. I moved my sensor to an ADC1 pin instead.
  • analogReadResolution() lets you configure the ADC resolution, which is useful if I want to match behavior across an Uno-based prototype and an ESP32-based one later.

Problems / debugging

Readings were jumping around a lot more than I expected — swinging by ±150 out of 4095 even with a static light source. Turned out I didn't have a stable ground reference; the breadboard rail wasn't actually connected to the ESP32 GND on that side. Once I ran a dedicated ground wire directly to the sensor's divider, the noise dropped to a few counts.

Decisions

I'm going to standardize on ESP32 as my main "brain" for sensor projects going forward, and treat the Arduino Uno as a fallback for anything that doesn't need Wi-Fi/Bluetooth. Simpler to keep one mental model of pin behavior.

Things I didn't fully understand

Why exactly the ADC1/ADC2 + Wi-Fi conflict exists at a hardware level — I know it's real and I worked around it, but I want to actually read the datasheet section on it rather than just trusting a forum post.

Experiments

Tried averaging 10 consecutive readings in software as a cheap low-pass filter instead of adding a hardware capacitor. Worked well enough for now — stable to about ±3 counts.

Tomorrow's plan

Add a second sensor (a basic thermistor) and get both streaming over serial at once, formatted as CSV so I can plot it later.

Links / resources