Using Wemos D1 Mini & Oled Shield

Category : Arduino, Electronics

In this guide I’ll show you how to use the shield and it’s two buttons. Lets get to it.

Resoltion is 64×48
Button A is by default pin D3.
Button B is by default pin D4.

Buttons can be customized by soldering jumper pads under the shield.

Parts:

Wemos D1 Mini @ Aliexpress

Oled Shield @ Aliexpress

PS, be sure to get the shield with A & B buttons when you buy it, there are a few types to choose from.

Code:

There are several libraries to choose from, but I found the one from Sparkfun to be suitable for my use.

Download it, then unzip in libraries folder and restart Arduino IDE. Then paste my code:

#include <Wire.h>  // Include Wire if you're using I2C
#include <SFE_MicroOLED.h>  // Include the SFE_MicroOLED library
 
#define PIN_RESET 255  //
#define DC_JUMPER 0  // I2C Addres: 0 - 0x3C, 1 - 0x3D
 
MicroOLED oled(PIN_RESET, DC_JUMPER); // Example I2C declaration
 
void setup()
{
  // Before you can start using the OLED, call begin() to init
  // all of the pins and configure the OLED.
  oled.begin();
  // clear(ALL) will clear out the OLED's graphic memory.
  // clear(PAGE) will clear the Arduino's display buffer.
  oled.clear(ALL);  // Clear the display's memory (gets rid of artifacts)
 
  pinMode(D4, INPUT); // Setting D4 B Button as input
  pinMode(D3, INPUT); // Setting D3 A Button as input
}
 
void loop()
{
  oled.clear(PAGE);     // Clear the screen
  oled.setFontType(0);  // Set font to type 0
  oled.setCursor(0, 0); // Set cursor to top-left
  oled.print("Line 1");
  oled.setCursor(0, 8); // Set cursor to top-left
  oled.print("Line 2");
  oled.setCursor(0, 16); // Set cursor to top-left
  oled.print("Line 3");
  oled.setCursor(0, 24); // Set cursor to top-left
  oled.print("Line 4");
  oled.setCursor(0, 32); // Set cursor to top-left
  oled.print("Line 5");
  oled.setCursor(0, 40); // Set cursor to top-left
  oled.print("Line 6");
 
 
  if (digitalRead(D4) == LOW)
  {
    oled.setCursor(0, 40); // Set cursor to top-left
    oled.print("B Pushed");
 
  }
 
  if (digitalRead(D3) == LOW)
  {
    oled.setCursor(0, 32); // Set cursor to top-left
    oled.print("A Pushed");
 
  }
  oled.display();
}

You should now see this when buttons are pressed:

Thats it! Now play around with it. Hope this short guide was helpful.

Using Wemos D1 Mini with SHT30 Sensor Shield

Category : Arduino, Electronics

SHT30 is a temperature and humidity sensor, almost the same as DHT22 only much smaller. They also measure a larger range, from -40 to 125 C.

Parts:

What we need is a Wemos D1 Mini board, which can be found on Aliexpress for around 5$. And of course the SHT30 shield can also be found on Aliexpress for a few dollars.

SHT30 @ Aliexpress

Wemos D1 Mini @ Aliexpress

Code:

Next up is installing the Arduino Library for the SHT30, unzip in libraries folder and restart Arduino IDE.

Then in Arduino IDE select the example called SHT30_SHIELD, or use example code below,  just to verify that our sensor is working correctly.

#include <WEMOS_SHT3X.h>
 
SHT3X sht30(0x45);
 
void setup() {
 
  Serial.begin(115200);
 
}
 
void loop() {
 
  if(sht30.get()==0){
    Serial.print("Temperature in Celsius : ");
    Serial.println(sht30.cTemp);
    Serial.print("Temperature in Fahrenheit : ");
    Serial.println(sht30.fTemp);
    Serial.print("Relative Humidity : ");
    Serial.println(sht30.humidity);
    Serial.println();
  }
  else
  {
    Serial.println("Error!");
  }
  delay(1000);
 
}

Then open up the serial monitor and you should see it reporting temperature and humidity:

Thats it! Now play around with it. Hope this short guide was helpful.