2

I have multiple Arduino WeMos D1 boards, with a mix of versions bought months apart. One of these boards is working but I need to update it and I am not sure if it is R1 or R2 (the pinouts are different). I do not have physical access to it (it is 200+ miles away in an area that is locked down) but I can connect through another device over WiFi.

It has the following included:

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>

#include <WiFiUdp.h> #include <ArduinoOTA.h>

So, I can even browse to a Webserver to run commands. How can I add to the code (or even replace it) to return a value that tells me which version the board is? According to this you can do it with an AT command, but I am not sure how to pass an AT command from the WebServer interface (or any other way).

EDIT: I guess I may have confused the issue with my phrasing. I can connect to the board and upload a new sketch (using OTA). My question is, can I put something in a new sketch to determine the board details and upload it. Once I get that, I can then put in a the actual sketch that I want.

Chiwda
  • 252
  • 1
  • 3
  • 11

1 Answers1

1

There's nothing you can do with your currently loaded sketch. The board can only do exactly what you have programmed it to do and nothing more.

  • There are no "AT" commands. They only exist if you load the AT firmware instead of your own firmware
  • You can't magically make your code do things it wasn't programmed to do1

However the only real differences between the two boards is the version of the ESP8266 module in use: ESP-12E vs ESP-12F, (and the only difference between those modules is the layout of the PCB antenna in order to achieve FCC certification) and the addition of some unpopulated serial and I2C pins.

Aside from that the only other differences are purely cosmetic or of no consequence to your software.

So it really doesn't matter which board you have or which you compile your code for.


1: Unless you can cause some buffer overflow and inject new code into memory to execute, but to do that you'd need to be a l33t h4x0r.


Addendum:

It appears they have two boards, named the same, with different pin arrangements (both sadly very stupidly designed, but there you are). All I can suggest is compile for one, install it, and see if it works. If it doesn't, then compile for the other and see if that works.

Or compile some special firmware that will probe what you have attached and work out what is attached where - then install and run that.

Majenko
  • 105,851
  • 5
  • 82
  • 139