Compatibility between WEMOS D1, UNO and NANO

This is a request for information.
I currently use an Arduino Nano. I have a WEMOS D1.
I did read somewhere that the WEMOS D1 emulates an Arduino Uno. (Can't find it anymore)
The point is that AVR_ATmega328P is defined with all three boards: Arduino Nano, Arduino Uno, and WEMOS D1. Which suggests there are some levels of compatibility. The information I like to get is:
1/ Does the WEMOS D1 emulate the ATmega328P chipset?
2/ If yes where can I find information?
3/ If 1 is yes. The selection of the Arduino nano also makes the "avr/interrupts.h" library available, the selection of the LOLIN(WEMOS D1 R1) does not. What does that mean? (incompatible? , manual include?, ....) An alternative library is:.....)

I would appreciate any suggestions for this Request For Information.
Kind regards,
Jan Flikweert

Where did you read that? The WEMOS D1 contains a completely different processor (ESP8266) than the UNO or Nano. And it does not emulate a 386P. But both can be programmed with the Arduino IDE ( if the board manager for ESP8266 is installed). And you must select the WEMOS D1 in IDE when compiling for WEMOS D1.
And not every library that works with UNO/Nano does work with WEMOS D1. It especially depends wether the HW is addressed directly.

1 Like

Hello MicroBahner,
As I said I cannot find the message anymore, but the thing is the WEMOS D1 recognizes AVR_ATmega328P This is used in programs to identify UNO and NANO boards. (LEONARDO does not recognize it!) It is defined among a lot of other AVR specifics when you select the WEMOS D1 board. I know ESP8266 is another processor but that does not mean that emulation of an AVR board is not possible. If you do something wrong the board comes back to you with Python error messages. Then Python is known for emulation. Emulating an AVR instruction set is one of the 83 projects according to GITHUB. So, if it does emulate a UNO as far as its instruction set concerns then that offers access to a lot of libraries.

I am just trying to find persons that have experience and this forum is one of places where I can find the experience in this area.

So, I am waiting. Thanks for the response
Jan Flikweert

What do you mean by "recognizes"?

Do you mean that some C preprocessor symbol is defined, when you select "wemos D1" board, that identifies the MCU as an atmega328? I doubt that...

Yes, that is what I mean. If you select the LOLIN(WEMOS D1 R1) board this identifier is defined. It is not defined when you select a board like the LEONARDO.

Just use:
#if defined(AVR_ATmega328P) and it takes this route!
(Note the 2 underscores in front and behind AVR_ATMEGA328P)

Thanks for the response.
Kind regards
Jan Flikweert

image

PaulRB,
I found this on AliExpress:
image
A lot of advertisements for WeMos D1 R2 V2.1.0 WiFi UNO. It says Uno based.
Now , I am still searching.
Regards,
Jan

Here's a better picture of that board:


It is an ESP8266 based board that has the form factor of an Arduino UNO. I suspect that is where the compatibility ends.

I don't know off the top of my head if the ESP8266 is 5V tolerant - I'm primarily an AVR user. I guess you can plug in Arduino UNO shields, but whether they will work correctly and not damage the ESP8266 is the bigger question.

I think its only the formfactor of the board as @markd833 already suggested.
On AliExpress its offered as:

WeMos D1 R2 WiFi uno based ESP8266 for arduino nodemcu Compatible

It doesn't tell UNO compatible. The atmega386 has far more IO's than the ESP8266. How will you emulate those? If you look at the board you see that many pins are connected in parallel or not connected at all.

if I compile this little sketch,

void setup() {
  // put your setup code here, to run once:
  Serial.begin(74880);
  Serial.println();
  #if defined(__AVR_ATmega328P__)
    Serial.println("__AVR_ATmega328P__ is defined");
  #else
    Serial.println("__AVR_ATmega328P__ is NOT defined");
  #endif

}

void loop() {
  // put your main code here, to run repeatedly:

}

it shows
__AVR_ATmega328P__ is defined
on UNO/Nano and
__AVR_ATmega328P__ is NOT defined
when loading on an ESP8266 Board. ( Lolin(Wemos) D1 R2 & Mini )

Which ESP8266 core do you have installed?

1 Like

I have both D1 R1 and D1 R2. The first one is about 7 month old the other is new.
I used the board selection mechanism of the Railunio software and extended it a bid.:

// __JF Issue: UNO and NANO use same detection macro!!!!
#if defined(__AVR_ATmega328P__)      //
//#define __WEMOSD1__ 1 // 
//#define __NANO__ 1
#define __BOARD__ "Arduino NANO,Uno or WMOSD1"  
#elif defined(__AVR_ATmega32U4__)
#define __LEONARDO__ 1
#define __BOARD__ "Arduino Leonardo"
#elif defined(__AVR_ATmega2560__)     //__JF added
#define __MEGA__ 1
#define __BOARD__ "Arduino MEGA"
#else
#define __BOARD__ "Board undefined"
#endif

I used it in a test program and for me unfortunately the recognition of AVR_ATmega328P disappeared. So you are right
Excuse.
This topic can be closed.
Thanks,
Regards,
Jan

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.