Category Archives: ESP32

ESP32 Analog Input – analogRead

AnalogRead does indeed work on the ESP32.  Many sites and posts that claim that the Analog to Digital converter of the ESP32 doesn’t work.  I have tested analogRead using the code below and it works as expected.  The code below compiles and downloads to my ESP32 Development board and produces correct results.  The input pin is the seventh pin from the top on the left hand side of the ESP32 Development Board.

#define RLED 16
#define InPin 33

int x ;

void setup() {
   Serial.begin(115200);
   pinMode(RLED, OUTPUT);
}

void loop()
{
   digitalWrite(RLED, LOW);
   delay(100);
   x = analogRead( InPin );
   Serial.println( x );
   digitalWrite(RLED, HIGH);
   delay(100);
}

Have fun!

ESP32 Board Selection in Arduino

I receive many questions in a week on the correct setup of the Arduino Environment to program the ESP32 development board.   At this point it doesn’t seem to matter which board you select and I always use “Esp32 Dev Module” as my selection.  The rest of the setting can be seen in the screen capture below.

ESP32 Arduino Setup

ESP32 Arduino Setup

The upload speed is fast and it works just like an Arduino board.  Press the upload button and the code magically appears in the module memory.  No buttons to press, just works.

ESP32 Development Board-Again Part 2

If you compare the first revision of the ESP32 Development board to the current version you will see that the ESP32 module doesn’t extend past the edge of the printed circuit board as it did before.  I extended the PCB and had the area under the antenna routed out.  This serves two purposes.  The ESP32 module is designed to have the antenna sit out in free space.  The antenna is not supposed to sit on top of the PCB, the design guide by Espressif makes that very clear.  The measurements that they did and documented show clearly that there is a significant loss in performance when the antenna sits on top of the PCB.  The module’s PCB is much thinner than the standard 1.6mm PCB and they obviously designed the antenna for the thin pcb.  User reviews of some of the other ESP32 boards on the market confirm that the ones where the module sits completely on top of the PCB have poor RF performance.

The second purpose of having the PCB extend all the way to the top of the module’s  PCB is to allow me to manufacture the boards in a panel.  If the module extends past the PCB then you can only place them next to each other in the panel.  This leads to a long and narrow panel which bends in the reflow oven preventing the modules from sitting flush with the PCB.  I ended up breaking the panels in half to get a less flexible panel.  An additional benefit is that the thicker PCB protect the module’s PCB during shipping.