|
META TOPICPARENT |
name="AFNOGWorkshop2019" |
The WeMos D1 mini and its sensor and actuator shields
Introduction |
|
A better and only slightly more expensive solution (we are talking about ~ 3.5 US$ instead of 2.5 US$) is the Wemos D1 mini board. This boards gives up more I/O connections and many more sensor and actuator shields are readily available on the market.
The processor board |
|
> > | ESP8266 |
|
The processor board uses an Espressif ESP8266 processor chip and 4 MBytes of flash are installed on the board. |
| In contrast to a PC the WeMos D1 mini has only very limited memory resources. While 4 MBytes of flash memory is rather comfortable, the amount of RAM (80 K) is a very limiting factor. When running micro Python a mere 30 kBytes is left for your Python programs. There are essentially 2 ways to make most out of the small amount of RAM:
- You can pre-compile your programs to byte code, which takes less space in RAM
- You can code freeze driver libraries, which means you integrate their byte code into The micro Python image. This however means that you must compile your own version of micro Python and flash it into the WeMos D1 CPU.
|
|
> > | ESP32
As an alternative you have a CPU board based on the more powerful ESP32:
As for the ESP8266 there is a Micropython port for the ESP32. The drivers are essentially the same, the pinout of the board however (GPIO numbers for the pins) is different. This means that for every driver we must only change the GPIO number. Since it is possible to find out from Micropython on which platform we run (sys.platform tells you if your CPU is a "esp8266" or a "esp32") we can check for the CPU type and adapt the pin numbering as a consequence.
Here is a comparison of the pin assignments for the 2 CPUs:
ESP8266
|
RESET |
RST |
Tx |
GPIO 1 |
|
|
ADC0 |
A0 |
Rx |
GPIO 3 |
|
SCK |
GPIO 16 |
D0 |
D1 |
GPIO 5 |
SCL |
MISO |
GPIO 14 |
D5 |
D2 |
GPIO 4 |
SDA |
MOSI |
GPIO 12 |
D6 |
D3 |
GPIO 0 |
|
SS |
GPIO 13 |
D7 |
D4 |
GPIO 2 |
|
|
GPIO 15 |
D8 |
GND |
GND |
|
|
3.3V |
3V3 |
5V |
5V |
|
ESP32
|
RESET |
RST |
Tx |
|
|
ADC1 channel 0 |
GPIO 36 |
SVP |
Rx |
|
|
|
GPIO 26 |
IO26 |
IO22 |
GPIO 22 |
SCL |
SCK |
GPIO 18 |
IO18 |
IO21 |
GPIO 21 |
SDA |
MISO |
GPIO 19 |
IO19 |
IO17 |
GPIO 17 |
|
MOSI |
GPIO 23 |
IO23 |
IO16 |
GPIO 16 |
|
SS |
GPIO 5 |
IO5 |
GND |
GND |
|
|
3.3V |
3V3 |
5V |
5V |
|
Sensor Shields |
| A big number of sensor and actuator boards are available. You will find a complete list with their description at https://wiki.wemos.cc/products:d1_mini_shields
Here are the sensor shields and their test programs for the workshop: |
|
META FILEATTACHMENT |
attachment="wemosd1mini.png" attr="" comment="" date="1553073633" name="wemosd1mini.png" path="wemosd1mini.png" size="321062" user="UliRaich" version="1" |
META FILEATTACHMENT |
attachment="d1MiniPinout.png" attr="" comment="" date="1553074041" name="d1MiniPinout.png" path="d1MiniPinout.png" size="555945" user="UliRaich" version="1" |
|
|
> > |
META FILEATTACHMENT |
attachment="wemosEsp32.png" attr="" comment="" date="1557251361" name="wemosEsp32.png" path="wemosEsp32.png" size="218419" user="UliRaich" version="1" |
|