Is Wemos D1 R32 compatible with Arduino Uno?

Yes and NO !

Yes, it is partially compatible, hardware and software as syntax, but certain predefined constants do not exist. For example A0…A5 does not exist for ESP32 and in conclusion you have to map/define them, see details here: Wemos D1 R32 – IO pin assignment for Arduino UNO.

Wemos D1 R32 compatible Arduino Uno Board

Moreover, the analog data ranges are different. The Arduino UNO has values between 0 and 1023 and the ESP32 has between 0 and 4095, that is, the arduino samples with 10-bit precision and the ESP32 with 12-bit precision.

ADC does not return usable data at marginal voltages, i.e. close to 0v and 3.3v. In practice, the values below 0.2v and those exceeding 3.1v are no longer distinguishable!

Some pins cannot be used, for example A0 and A1 cannot be used reliably, even if they are connected to the ground, the voltage fluctuates slightly above zero!
Here’s why:

A0 & A1 is GPIO2 & GPIO4 in ESP32 and these can sense variations in anything that holds an electrical charge, because at the hardware level they are internal capacitive touch sensors. At the hardware level in UNO ESP32, pin A0 (GPIO2 in ESP32) is already connected to ground through a blue LED.

Example of reading data on analog pins accessible by default (A0-A5), all being connected to GND:

A0 = 31
A1 = 55
A2 = 0
A3 = 0
A4 = 0
A5 = 0

In practice: precision, maximum/minimum intervals, the value of ports/pins, voltage values and other predefined and fixed data should not be done directly but always through references, which will be able to change dynamically by identifying the hardware board used.

Moreover, the shields, sensors, or any other additional elements must be used as dynamic modules in the code. It is much easier to change and adapt a component when everything is well prepared from the beginning, modular and flexible.

P.S. After a lot of information collected online, I came to the conclusion that ESP32 cannot be used in projects that require high precision or critical safety in operation. For hobby projects, however, it is useful.

byrev Written by:

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *