ESP8266 and LCD4884 example

This LCD4884  provides a 84×48 display this LCD shield can help meet your needs. It is able to display in English, Chinese and even images, it uses the SPI interface and works Ok with a 3.3v power source

From the source code, these connections worked for me

* Connections:

* WeMos D1 Mini Nokia 5110 Description
* (ESP8266) PCD8544 LCD
* D2 (GPIO4) 0 RST Output from ESP to reset display
* D1 (GPIO5) 1 CE Output from ESP to chip select/enable display
* D6 (GPIO12) 2 DC Output from display data/command to ESP
* D7 (GPIO13) 3 Din Output from ESP SPI MOSI to display data input
* D5 (GPIO14) 4 Clk Output from ESP SPI clock
* 3V3 5 Vcc 3.3V from ESP to display
* D0 (GPIO16) 6 BL 3.3V to turn backlight on, or PWM
* G 7 Gnd Ground



You need and

There is a snag, the PCD8544 will not compile, the code below points you in the right path to get the updated source files for the library, if not Adafruit_PCD8544_Nokia_5110_LCD_library


/* Hello World
 * Display a simple message on the first line of the screen
 * Connections:
 * WeMos D1 Mini   Nokia 5110    Description
 * (ESP8266)       PCD8544 LCD
 * D2 (GPIO4)      0 RST         Output from ESP to reset display
 * D1 (GPIO5)      1 CE          Output from ESP to chip select/enable display
 * D6 (GPIO12)     2 DC          Output from display data/command to ESP
 * D7 (GPIO13)     3 Din         Output from ESP SPI MOSI to display data input
 * D5 (GPIO14)     4 Clk         Output from ESP SPI clock
 * 3V3             5 Vcc         3.3V from ESP to display
 * D0 (GPIO16)     6 BL          3.3V to turn backlight on, or PWM
 * G               7 Gnd         Ground
 * Dependencies:
 * - This pull request adds ESP8266 support:
 * -
#include <Arduino.h>
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
// Pins
const int8_t RST_PIN = D2;
const int8_t CE_PIN = D1;
const int8_t DC_PIN = D6;
//const int8_t DIN_PIN = D7;  // Uncomment for Software SPI
//const int8_t CLK_PIN = D5;  // Uncomment for Software SPI
const int8_t BL_PIN = D0;
// Software SPI with explicit CE pin.
// Adafruit_PCD8544 display = Adafruit_PCD8544(CLK_PIN, DIN_PIN, DC_PIN, CE_PIN, RST_PIN);
// Software SPI with CE tied to ground. Saves a pin but other pins can't be shared with other hardware.
// Adafruit_PCD8544(int8_t CLK_PIN, int8_t DIN_PIN, int8_t DC_PIN, int8_t RST_PIN);
// Hardware SPI based on hardware controlled SCK (SCLK) and MOSI (DIN) pins. CE is still controlled by any IO pin.
// NOTE: MISO and SS will be set as an input and output respectively, so be careful sharing those pins!
Adafruit_PCD8544 display = Adafruit_PCD8544(DC_PIN, CE_PIN, RST_PIN);
void setup() {
  Serial.println("\n\nWeMos D1 Mini + Nokia 5110 PCD8544 84x48 Monochrome LCD\nUsing Adafruit_PCD8544 and Adafruit_GFX libraries\n");
  // Turn LCD backlight on
  pinMode(BL_PIN, OUTPUT);
  digitalWrite(BL_PIN, HIGH);
  display.setContrast(60);  // Adjust for your display
  Serial.println("Show Adafruit logo bitmap");
  // Show the Adafruit logo, which is preloaded into the buffer by their library
  // display.clearDisplay();
  display.println("Hello, world!");
  Serial.println("You should now see Hello, world! on the display");
void loop() {

ESP8266 and SHT21 humidity and temperature sensor example

SHT21, the new humidity and temperature sensor of Sensirion is about to set new standards in terms of size and intelligence: Embedded in a reflow solderable Dual Flat No leads (DFN) package of 3 x 3mm foot print and 1.1mm height it provides calibrated, linearized signals in digital, I2C format.

With a completely new designed CMOSens® chip, a reworked capacitive type humidity sensor and an improved band gap temperature sensor the performance has been lifted even beyond the outstanding level of the previous sensor generation (SHT1x and SHT7x). For example, measures have been taken to stabilize the behavior at high humidity levels. Every sensor is individually calibrated and tested. Lot identification is printed on the sensor and an electronic identification code is stored on the chip – which can be read out by command.

Furthermore, the resolution of SHT21 can be changed by command (8/12bit up to 12/14bit for RH/T), low battery can be detected and a checksum helps to improve communication reliability.

SHT21 features a generation 4C CMOSens® chip. Besides the capacitive relative humidity sensor and the band gap temperature sensor, the chip contains an amplifier, A/D converter, OTP memory and a digital processing unit.

This is the breakout for the sensor that I bought.

Here is a simple schematic, again be careful as Vcc is 3.3v with this device



Lets look at the required libraries and a basic code example, there is not much to this to be honest most of the work is done in the library


You need the following library for this example –




#include <Wire.h>
#include <Sodaq_SHT2x.h>
void setup()
void loop()
Serial.print("Humidity(%RH): ");
Serial.print(" Temperature(C): ");
Serial.print(" Dewpoint(C): ");




Open the serial monitor

Humidity(%RH): 43.24
Temperature(C): 24.56
Dewpoint(C): 11.21
Humidity(%RH): 43.26
Temperature(C): 24.54
Dewpoint(C): 11.21
Humidity(%RH): 43.52
Temperature(C): 24.93
Dewpoint(C): 11.62
Humidity(%RH): 44.13
Temperature(C): 25.10
Dewpoint(C): 12.11
Humidity(%RH): 44.77
Temperature(C): 25.59
Dewpoint(C): 12.80



SHT21 Digital Humidity And Temperature Sensor Module

ESP8266 and RFID-RC522 module example

In this example we will connect an RFID-RC522 module and connect to a Wemos Mini

The microcontroller and card reader uses SPI for communication . The card reader and the tags communicate using a 13.56MHz electromagnetic field. (ISO 14443A standart tags)


  • MFRC522 chip based board
  • Operating frequency: 13.56MHz
  • Supply Voltage: 3.3V
  • Current: 13-26mA
  • Read Range: Approx 3cm with supplied card and fob
  • SPI Interface
  • Max Data Transfer Rate: 10Mbit / s
  • Dimensions: 60mm × 39mm

Datasheet for the chip that used in modules can be found at:


This is how I wired the module to my Wemos Mini as per the documentation

Wemos D1 mini
Signal Pin
RST/Reset D3



Install the RFID522 library –

This is the DumpInfo example modified – its the two pins defined at the top of the code

#include <SPI.h>
#include <MFRC522.h>
#define RST_PIN         D3         // Configurable, see typical pin layout above
#define SS_PIN          D8        // Configurable, see typical pin layout above
MFRC522 mfrc522(SS_PIN, RST_PIN);  // Create MFRC522 instance
void setup() {
	Serial.begin(9600);		// Initialize serial communications with the PC
	SPI.begin();			// Init SPI bus
	mfrc522.PCD_Init();		// Init MFRC522
	mfrc522.PCD_DumpVersionToSerial();	// Show details of PCD - MFRC522 Card Reader details
	Serial.println(F("Scan PICC to see UID, SAK, type, and data blocks..."));
void loop() {
	// Look for new cards
	if ( ! mfrc522.PICC_IsNewCardPresent()) {
	// Select one of the cards
	if ( ! mfrc522.PICC_ReadCardSerial()) {
	// Dump debug info about the card; PICC_HaltA() is automatically called



This is the output in the serial monitor

serial monitor info mfrc522

serial monitor info mfrc522

There are many other good examples in the library

I did see errors in the serial monitor windows – wdg reset, I will investigate this



1 set RFID module RC522 Kits S50 13.56 Mhz 6cm With Tags SPI Write & Read for arduino uno 2560

ESP8266 displaying a QR code on an OLED display

In this example we will display a QR code on an OLED display with an ESP8266, in this case a Wemos mini. This will require a couple of libraries to be imported into the Arduino IDE.





You will need a couple of libraries


Now for a simple example, the key line is the class constructor – you need to put in your I2C address of your OLED module and then the SDA and SCL pins

#include <Wire.h>
#include "SSD1306.h"
#include <qrcode.h>
SSD1306 display(0x3c, D1, D2);
QRcode qrcode (&display);
void setup() 
  qrcode.create("ESP8266 learning");
void loop() {}

Compile the code and upload and you should see a QR code on your OLED display, I could not quite get the QR code to fit on the Wemos mini OLED shield so I used a seperate OLED display connected

Here is my example running

esp8266 and oled displaying QR code

esp8266 and oled displaying QR code