2

members

Easy Basics: Project 057b White 0.96" I2C OLED display module, DHT 11,21,22 module

of Acoptex.com in UNO

Basics: Project 057b

Project name: White 0.96" I2C OLED display module, DHT 11,21,22 module

Tags: Arduino Uno, Arduino, 0.96" I2C, White OLED display module, 128x64, 128x32, GMS096A, Adafruit Monochrome OLED, SSD1306, DHT 11,21,22 module, humidity and temperature sensor

Attachments: library1, library2, library4, library5, sketch1

In this project, you needed these parts (Dear visitors. You can support our project buy clicking on the links of parts and buying them or donate us to keep this website alive. Thank you):

1.Arduino Uno R3 (you can also use the other version of Arduino)

2. 0.96" I2C OLED display module 1 pc

3.Arduino IDE ( you can download it from here  )

4.Jumper cables F-M

5. Breadboard 1 pc

6. DHT11 or DHT21 or DHT22 module 1pc

7. Resistor 1 pc 10 KOhm (if 4 pin sensor used - see picture of Arduino and sensor 4 pin connections)

General

We will learn how to connect 0.96" I2C OLED display module and DHT11 or DHT21 or DHT22 module to Arduino board and use it.

Understanding the DHT humidity and temperature sensor

You can read more about it here.

Understanding the 0.96" I2C OLED display module

OLED (Organic Light-Emitting Diode) is a self light-emitting technology composed of a thin, multi-layered organic film placed between an anode and cathode. In contrast to LCD technology, OLED does not require a backlight. OLED possesses high application potential for virtually all types of displays and is regarded as the ultimate technology for the next generation of flat-panel displays.

OLEDs basic structure consists of organic materials positioned between the cathode and the anode, which is composed of electric conductive transparent Indium Tin Oxide (ITO). The organic materials compose a multi-layered thin film, which includes the Hole Transporting Layer (HTL), Emission Layer (EML) and the Electron Transporting Layer (ETL). By applying the appropriate electric voltage, holes and electrons are injected into the EML from the anode and the cathode, respectively. The holes and electrons combine inside the EML to form excitons, after which electro luminescence occurs. The transfer material, emission layer material and choice of electrode are the key factors that determine the quality of OLED components.

These displays are small, only about 1" diameter, but very readable due to the high contrast of an OLED display. This display is made of 128x64 individual white OLED pixels, each one is turned on or off by the controller chip. Because the display makes its own light, no backlight is required. This reduces the power required to run the OLED and is why the display has such high contrast and crisp. 

It can be used with either an SPI or I2C interface (depends on the maker) - selectable by soldering two jumpers on the back. The design is completely 5V-ready, with an onboard regulator and built in boost converter. It's easier than ever to connect directly to your 3V or 5V microcontroller without needing any kind of level shifter!

The driver chip, SSD1306 can communicate in multiple ways including I2C (I²C, IIC or Inter-Integrated Circuit), SPI and 8-bit parallel. However, only the 128x64 display has all these interfaces available. 

Features:

  • Diagonal Screen Size:0.96"
  • Number of Pixels:128 x 64
  • Color Depth:White
  • Dimension:27.8 x27.3x 4.3 mm
  • Working Voltage: 3.3~ 5V DC
  • Power: 0.06W Max
  • Viewing Angle: >160 Degree
  • Driver IC:SSD1306
  • Brightness ( cd/m2):150 (Typ) @ 5V
  • Interface: I2C
  • Adafruit board/chip uses I2C 7-bit address between 0x3C-0x3D, selectable with jumpers

You can find the SSD1306 datasheet here

Signals and connections of the DHT module

There are 3 : VCC (+5V), Data, GND (-)

Signals and connections of the 0.96" I2C OLED display module

The nice thing about the 128x64 OLEDs is that they can be used with I2C (+ a reset line) or SPI. SPI is generally faster than I2C but uses more pins. It's also easier for some microcontrollers to use SPI. 

Make sure that you connect the power pins correctly. Some modules have GND and VCC swapped around. Don't blow up your display!

Data - Connected to I2C SDA if Adafruit OLED display module

Clk - SCK (Serial Clock) - SPI communication.The clock pulses which synchronize data transmission generated by the master. Connect to I2C SCL if Adafruit OLED display module.

SA0 (DC or D/C) - This is Data/Command control pin. When it is pulled HIGH , the data at D[7:0] is treated as data. When it is pulled LOW, the data at D[7:0] will be transferred to the command register. In I2C mode, this pin acts as SA0 for slave address selection.

RST (RES) - This pin is reset signal input. When the pin is pulled LOW, initialization of the chip is executed. Keep this pin HIGH during normal operation.

CS - (Chip Select) - the pin that the master can use to enable and disable specific devices.

3.3vo (3.3v) - this is the power pin. Should be connected to +3.3 VDC pin of Arduino board.

Vin - this is the power pin. 3 to 5V power supply. All OLEDs are safe to use with 3.3V logic and power.

VCC - this is the power pin. Can be connected to +5VDC or +3.3VDC pin of Arduino board (depends on the display module). All OLEDs are safe to use with 3.3V logic and power.

GND - ground. Connected to Arduino board GND pin.

SDA - Serial Data Line. Connected to Arduino Uno SDA or Analog pin A4. 

SCL - Serial Clock Line. Connected to Arduino Uno SCL or Analog pin A5.

D0 - Master In Slave Out (MISO) - SPI communication. The Slave line for sending data to the master. 

DI (DIN) - Master Out/Slave In (MOSI). SPI communication. The Master line for sending data to the peripherals. 

NC - Not in use. 

Wiring

1. I2C interface with 3 pin DHT sensor module

The display can be used with any I2C microcontroller. Because the I2C interface is for 'writing' to the display only, you'll still have to buffer the entire 512 byte frame in the microcontroller RAM - you can't read data from the OLED (even though I2C is a bidirectional protocol). 

1a) Standard or Adafruit white 0.96" I2C OLED display module

0.96" I2C OLED display module -> Arduino Uno

SCL -> SCL (A5)
SDA -> SDA (A4)
VCC (Vin)-> 3.3V, can be 5V (depends on display module)
GND ->GND

2. I2C interface with 4 pin DHT sensor module (resistor 10 KOhm required)

Step by Step instruction

  1. Do wiring. 
  2. Open Arduino IDE.
  3. Plug your Adruino Uno board into your PC and select the correct board and com port
  4. Find your I2C address. Each device has an I2C address that it uses to  accept commands or send messages. Load the sketch over at http://playground.arduino.cc/Main/I2cScanner and follow the instructions to use it.  By opening up the Serial monitor window after you upload the sketch, Arduino will scan the address range looking for a reply.  The scanner can detect it (0x78, 0x7A,0x3C,0x3D) (for example, in our case 0x3C)
  5. Modify the bold part in the line display.begin(SSD1306_SWITCHCAPVCC, 0x3C); 
  6. Modify sketch for your sensor (DHT11 or DHT21 or DHT 22).
  7. Verify and upload the sketch to your Adruino Uno.
  8. If it will be problem with compilation - remove 2 files from the library - DHT_U.cpp and DHT_U.h
  9. You will see humidity, temperature readings on OLED display module.

Summary

We learnt how to connect 0.96" I2C OLED display module and DHT11 or DHT21 or DHT22 module to Arduino board and use it.

Library

  • All libraries attached on the begining of the project description
  • Adafruit_SSD1306 library. Download, unzip  and add to libraries in our PC, for example C:\Users\toshiba\Documents\Arduino\libraries. This link you can find in Preferences of Adruino IDE program which installed in your PC. You can read about it here.The SSD1306 driver library is used to initialize the display and provide low level display functions.
  • Adafruit_GFX library. Download, unzip  and add to libraries in our PC, for example C:\Users\toshiba\Documents\Arduino\libraries. This link you can find in Preferences of Adruino IDE program which installed in your PC. You can read about it here.The GFX library provides graphics functions for displaying text, drawing lines and circles, etc. 
  • Wire library included in Arduino IDE.
  • Adafruit_Sensor library included.Download, unzip  and add to libraries in our PC, for example C:\Users\toshiba\Documents\Arduino\libraries. This link you can find in Preferences of Adruino IDE program which installed in your PC. 
  • DHT-sensor library included. You will need to unzip and add the DHT-sensor-library-master library to libraries in your PC, for example C:\Users\toshiba\Documents\Arduino\libraries OR
  • You can install it in Arduino IDE too: select Sketch-> Include library->Manage your libraries->type DHT in Filter your search line and you will see DHT sensor library by Adafruit->More info->select version->install
  • If it will be problem with compilation - remove 2 files from the library - DHT_U.cpp and DHT_U.h.

Sketch

  • See attachments on the begining of this project


Other projects of Acoptex.com
Easy Merry Xmas to everyone of Acoptex.com, Not selected 24-12-2019

« Go back to category
Is this project fake? Report it!   
Recommend to a friend
Published at 03-02-2018
Viewed: 3120 times