Programmatic way to determine if ESP8266 is Wemos D1 Mini? #16399
Replies: 3 comments
-
Usually you would inspect the But if you're using the
Yes, you can do this, create a custom board configuration and set |
Beta Was this translation helpful? Give feedback.
-
ESP8266s are very generic, and even real LOLIN D1 mini modules from wemos.cc have used different ESP828x modules: from the canned AI Thinker ESP-12S in V2.2.0 to bare ESP-8266EX in V4.0.0. They have always used WinChipHead/QinHeng Electronics CH340 USB UARTs. The standard D1 mini has 4MB of flash, the D1 mini Pro 16MB, and the D1 mini Lite 1MB (ESP-8285).
import os, esp
if os.uname()[0] == "esp8266":
if esp.flash_size() == 2**22: # ESP-8266EX, 4 MB flash
print("I have the same spec as a LOLIN D1 mini from wemos.cc")
elif esp.flash_size() == 2**24: # ESP-8266EX, 16 MB flash
print(
"I have the same spec as a LOLIN D1 mini Pro from wemos.cc"
)
elif esp.flash_size() == 2**20: # ESP-8285, 1 MB flash
print(
"I have the same spec as a LOLIN D1 mini Lite from wemos.cc"
)
else:
print("I am not a LOLIN D1 mini from wemos.cc")
else:
print("I am not a LOLIN D1 mini from wemos.cc") The original LOLIN D1 used the same form factor as the Arduino Uno. And then there are all of the clones, some of which use such tiny power regulators I'm surprised they can start the SoC at all. You might be able to dig out some wisdom from the old-school 8266 heads at /r/esp8266. There used to be endless threads over there about how to tell "real" from "fake" |
Beta Was this translation helpful? Give feedback.
-
Yes, I am currently using GENERIC at the moment. The idea was to have as transportable code as possible, hence why I was thinking I would use unique_id and keep a static list as reference. But the ideas presented are great! |
Beta Was this translation helpful? Give feedback.
-
Programmatic way to determine if ESP8266 is Wemos D1 Mini? Some hidden magic someone knows of? Dirty kludge?
I suspect there is not a way to determine this within MP, other than maybe creating a custom MP image that customizes something, say the MP version string or Firmware information string. Other option, that comes to mind, is to have a simple tuple or list as a global in my code that is the unique_id value of all of the D1s I happen to have?
Beta Was this translation helpful? Give feedback.
All reactions