OLED Lcd Display With Arduino Uno Programming

OLED Screen With Arduino Uno Programming

OLED (Organic Light Emitting Diodes) is a flat light emitting technology, made by placing a series of organic thin films between two conductors.

When electrical current is applied, a bright light is emitted.

OLEDs are emissive display that do not require a backlight and so are thinner and more efficient than LCD displays (which do require a white backlight).

 

 

The OLED screen will be displaying our data.

This screen size is quite compact and the screen is impressively bright. The Adafruit OLED screen can be controlled using SPI or I2C interface, which can be adjusted at the back of the screen.

You can use a more affordable screen as well, but be careful which one you purchase as the screen needs to work with the header files we are going to use via Adafruit’s libraries.

OLED Screen With Arduino Connection

OLED Pin Arduino Connection
Vin 5V Dc
Gnd Ground
SCL A5
SDA A4

It is a very small display made of 128 by 64 individual OLED pixels and no backlight is required. That OLED display is monochrome (white color), but there are other models with several colors.
This display uses I2C communication. This means that it communicates with the Arduino using just 2 pins.

ALL SENSOR DETAILS:

1. HC-05 – Bluetooth
2. Mpu 6050 accelerometer-gyroscope- -module
3. Flame-sensor
4. Rotary-encoder
5. Force-sensor-fsr400
6. Current-sensor-acs712
7. Flex-sensor
8. IR-sensor-tcrt5000
9. Pulse-sensor-pin
10. Color-sensor-tcs230
11. SD-card-module
12. Oled-with-arduino
13. Addressable-rgb-led-strip-ws1812
14. Relay-module
15. TFT-1-8-display-st7735r
16. 8×8-dot-matrix-display-max7219
17. Smoke-sensor-mq-2
18. Ultrasonic-sensor-HC-sr04
19. PIR-motion-sensor-hc-sr501
20. Tilt-sensor-sw-520d
21. Microphone-sound-sensor
22. Reed-switch-reed-sensor
23. Rfid-reader-Em18
24. Rfid-tag
25. RTC-real-time-clock-ds1307
26. Temperature-sensor-ds18b20
27. Moisture-sensor
28. Rain-sensor
29. Pressure-sensor
30. Accelerometer
31. MOC-3021-circuit
32. DHT11-DHT22-temperature-and-humidity-sensor

OLED’s APPLICATIONS

OLEDs are used to create digital displays in devices such as television screens, computer monitors, portable systems such as mobile phones, digital media players, car radios, digital cameras, car lighting, handheld games consoles and PDAs.

Such portable applications favor the high light output of OLEDs for readability in sunlight and their low power drain. Intense research has yielded OLEDs with remarkable color fidelity, device efficiencies and operational stability.

According to the type of manufacture and the nature of their use, OLED’s.

1. Passive-matrix OLED (PMOLED).
2. Active-matrix OLED (AMOLED).
3. Transparent OLED.
4. Top-emitting OLED.
5. Foldable OLED.

OLED AND TEMPERATURE SENSOR WITH ARDUINO UNO CIRCUIT:

In this example you will display the temperature and humidity in the OLED display.

The aim of this project is to get familiar with the OLED display.

The temperature and humidity will be measured using the DHT11 temperature and humidity sensor.

If you’re not familiar with the DHT11 sensor we recommend that you check the DHT11/22 guide.

OLED AND TEMPERATURE SENSOR WITH ARDUINO UNO CODE:

Copy and paste the below givenArduino code or Download full sketch from below given link:
//Circuito.io is an automatic generator of schematics and code for off
//The shelf hardware combinations.
// Include Libraries
#include “Arduino.h”
#include “DHT.h”
#include “Wire.h”
#include “SPI.h”
#include “Adafruit_SSD1306.h”
#include “Adafruit_GFX.h”
// Pin Definitions
#define DHT_PIN_DATA 2
#define OLED128X64_PIN_RST 5
#define OLED128X64_PIN_DC 4
#define OLED128X64_PIN_CS 3
// Global variables and defines
// object initialization
#define SSD1306_LCDHEIGHT 64
Adafruit_SSD1306 oLed128x64(OLED128X64_PIN_DC, OLED128X64_PIN_RST, OLED128X64_PIN_CS);
DHT dht(DHT_PIN_DATA);
// define vars for testing menu
const int timeout = 10000; //define timeout of 10 sec
char menuOption = 0;
long time0;
// Setup the essentials for your circuit to work. It runs first every time your circuit is powered with electricity.
void setup()
{
// Setup Serial which is useful for debugging
// Use the Serial Monitor to view printed messages
Serial.begin(9600);
while (!Serial) ; // wait for serial port to connect. Needed for native USB
Serial.println(“start”);
dht.begin();
oLed128x64.begin(SSD1306_SWITCHCAPVCC); // by default, we’ll generate the high voltage from the 3.3v line internally! (neat!)
oLed128x64.clearDisplay(); // Clear the buffer.
oLed128x64.display();
menuOption = menu();
}
// Main logic of your circuit. It defines the interaction between the components you selected. After setup, it runs over and over again, in an eternal loop.
void loop()

{
if(menuOption == ‘1’) {
// DHT22/11 Humidity and Temperature Sensor – Test Code
// Reading humidity in %
float dhtHumidity = dht.readHumidity();
// Read temperature in Celsius, for Fahrenheit use .readTempF()
float dhtTempC = dht.readTempC();
Serial.print(F(“Humidity: “)); Serial.print(dhtHumidity); Serial.print(F(” [%]\t”));
Serial.print(F(“Temp: “)); Serial.print(dhtTempC); Serial.println(F(” [C]”));
}
else if(menuOption == ‘2’) {
// Monochrome 1.3 inch 128×64 OLED graphic display – Test Code
oLed128x64.setTextSize(1);
oLed128x64.setTextColor(WHITE);
oLed128x64.setCursor(0, 10);
oLed128x64.clearDisplay();
oLed128x64.println(“Circuito.io Rocks!”);
oLed128x64.display();
delay(1);
oLed128x64.startscrollright(0x00, 0x0F);
delay(2000);
oLed128x64.stopscroll();
delay(1000);
oLed128x64.startscrollleft(0x00, 0x0F);
delay(2000);
oLed128x64.stopscroll();
}

if (millis() – time0 > timeout)
{
menuOption = menu();
}
}
// Menu function for selecting the components to be tested
// Follow serial monitor for instrcutions
char menu()
{
Serial.println(F(“\nWhich component would you like to test?”));
Serial.println(F(“(1) DHT22/11 Humidity and Temperature Sensor”));
Serial.println(F(“(2) Monochrome 1.3 inch 128×64 OLED graphic display”));
Serial.println(F(“(menu) send anything else or press on board reset button\n”));
while (!Serial.available());
// Read data from serial monitor if received
while (Serial.available())

{
char c = Serial.read();
if (isAlphaNumeric(c))
{
if(c == ‘1’)
Serial.println(F(“Now Testing DHT22/11 Humidity and Temperature Sensor”));
else if(c == ‘2’)
Serial.println(F(“Now Testing Monochrome 1.3 inch 128×64 OLED graphic display”));
else
{
Serial.println(F(“illegal input!”));
return 0;
}
time0 = millis();
return c;
}
}
}

Download Full Arduino Sketch code Here.OLED With temp After Downloaded extract and compile with Arduino IDE the upload and test yourself.

Subramanian
Subramanian

Subramanian MK, currently serving as a workshop instructor at Sakthi Polytechnic College, Erode Tamil Nadu. With a career spanning 25 + years, Subramanian MK has dedicated himself to advancing knowledge in Electronics and Communication Engineering (ECE). His passion for exploring new technologies has led to the development of numerous projects, showcasing expertise in IoT and PCB design.

Articles: 510

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

×

Hi, How can I help you?

×