The WeMos D1 mini and its sensor and actuator shields
Introduction
We have seen that the ESP01 can be programmed with micro Python and that there are add-on sensor boards available. However, when we connect the sensor board we loose the serial connection to the PC. This can be corrected by soldering extra connectors to the top of the ESP01 board but this is fiddly and needs good soldering equipment and good soldering skills. The other option is to get access to the ESP01 through WiFi using WebRepl
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
The processor board uses an Espressif ESP8266 processor chip and 4 MBytes of flash are installed on the board.
You will find a description of the pinout at
https://www.likecircuit.com/wemos-d1-mini-pinout
For convenience I copied the basic information here.
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.
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:
Here is an overview table showing the devices and the
Module |
Connections |
Functionality |
1 button shield |
D3: GPIO 0 |
on / off push button |
WS2812B RGB shield |
D2: GPIO 4 |
addressable rgb LED |
DS1307 RTC and data logger |
D1: GPIO 5 I2C SCL D2: GPIO 4 I2C SDA D5: GPIO 14 SPI Clock D6: GPIO 12 SPI MOSI D7: GPIO 13 SPI MISO D8: GPIO 15 SPI CS |
Real Time Clock SD card interface |
Buzzer shield |
D5 (default GPIO 14 D6 GPIO 12 D7 GPIO 13 D8 GPIO 15 |
passive buzzer |
BMP180 shield |
D1 GPIO 5 I2C SCL D2 GPIO 4 I2C SDA |
I2C barometric pressure sensor and temperature sensor |
DHT11 shield |
D4 GPIO 2 |
temperature and humidity sensor |
OLED shield |
D1 GPIO 5 I2C SLC D2 GPIO 4 I2C SDA |
64x48 pixel display with SSD1036 I2C controller |
DD18B20 shield |
D2 GPIO 4 |
1-wire digital temperature sensor |
SHT30 shield |
D1 GPIO 5 I2C SCL D2 GPIO 4 I2C SDA |
I2C temperature and humidity sensor |
LED Matrix shield |
D5 GPIO 14 CLK D7 GPIO 13 Din |
8x8 LED Matrix |
ir connections:
For each of the devices I create 2 directories:
- a driver directory containing programs testing the module without Cayenne communication
- a cayenne directory for the final program
You can find the code written for the workshop on github:
https://github.com/uraich/MicroPython_IoTDemos.
Comments