LCD category

Using I2C SSD1306 OLED Display With Arduino

Sometimes it may be necessary to use a display when making a hardware project, but one confusing thing is the size of the display and the required pins to control it. This tutorial will show you how to use a small I2C OLED display with Arduino using only two wires.

The display used in this tutorial has a very small (2.7 x 2.8cm) OLED screen, that is similar to Arduino Pro Mini size, with 128 x 64 screen resolution. The OLED Driver IC is SSD1306, a single-chip CMOS OLED/PLED driver with controller for organic / polymer light emitting diode dot-matrix graphic display system. The module has only 4 pins, two of them are the supply pins, while the others are SCL and SDA, I2C protocol pins, which will be used to control the display.

Using I2C SSD1306 OLED Display With Arduino – [Link]

One wire controls LCD module

Rex Niven @  edn.com has a design idea on how to drive a character LCD using only one wire.

This hardware interface Design Idea reduces the connection to just one wire, allowing a basic microcontroller with limited I/O to drive a large display, either directly, through a standard interface, or even an opto-isolator.

One wire controls LCD module – [Link]

Design HMI For Your Projects Easily With Nextion

Nextion display by ITead allows users to design their own interfaces all by themselves, even if they don’t have any coding background knowledge and can go with different platforms. This tool is the best solution to replace traditional TFT LCD and LED Nixie tube. Customers can use the software – Nextion Editor to design interfaces.

With the new capacitive 7-inch Nextion, you can build your own HMI with minimal design effort since all of the data and control signals are provided by the device to interface directly to the display. This offers enormous advantage to the designer in development time and cost saving and takes away all of the burden of low level design.

Nextion will help you quickly design visually in hours not weeks, turn long coding work into simple drag and drop operation, at a reasonable cost. What you only need, is interface a serial port to Nextion disply hardware. Check this demo to see how quickly and easily an application can be designed by dragging and dropping objections to the virtual screen on a WYSIWYG design IDE – Nextion Editor.

This is the second version of Nextion, where you can find a capacitive multi-touch display and a good looking bezel along with additional features in the software IDE. Below are the specifications of new Nextion:

Nextion is now live on a crowdfunding campaign on Indiegogo and still has 15 days to go. You can pre-order Nextion RTP now for $55. More details can be found at the official website.

gen4 3.2”, The New Intelligent Display Modules

4D Systems, the manufacturer of intelligent graphics solutions, has announced a new 3.2” smart display module as part of the ‘ gen4 ’ series, which had been designed specifically for ease of integration and use, with careful consideration for space requirements and functionality.

These modules features a 3.2” color TFT display with options for Cover Lens Bezel (CLB), Resistive Touch and Capacitive Touch. The display is capable of Touch Detection, microSD memory Storage, GPIO and Communications, along with multiple millisecond resolution timers, and Audio Generation. gen4 modules have 30 pin ZIF socket for a 30 pin FPC cable, for easy and simple connection to an application or a motherboard.

The gen4 display modules are powered by the 4D Systems Diablo16 graphics processor that offers an array of functionality and options for any Designer / Integrator / User. Diablo16 is a custom embedded 4DGL graphics controller designed to interface with many popular OLED and LCD display panels.

gen4 display modules features:

  • Powerful 3.2” Intelligent LCD-TFT display module powered by DIABLO16.
  • 240 x 320 Resolution, RGB 65K true to life colours, TFT Screen with integrated 4-wire Resistive Touch Panel (on DT model only).
  • 6 banks of 32750 bytes of Flash memory for User Application Code and Data.
  • 32Kb of SRAM purely for the User.
  • 16 General Purpose I/O pins for user interfacing, which include 4 configurable Analog Inputs.
  • The GPIO is variously configurable for alternative functions such as:
    • 3x I2C channels available.
    • 1x SPI dedicated for SD Card and 3x configurable SPI channels available.
    • 1x dedicated and 3x configurable TTL Serial comm ports available.
    • Up to 6 GPIO can be used as Pin Counters.
    • Up to 6 GPIO for PWM (simple and Servo).
    • Up to 10 GPIO for Pulse Output.
    • Up to 14 GPIO can be configured for Quadrature Encoder Inputs (2 channels).
  • 30pin FPC connection, for all signals, power, communications, GPIO and programming.
  • On-board latch type micro-SD memory card connector for multimedia storage and data logging purposes.
  • DOS compatible file access (FAT16 format) as well as low level access to card memory.
  • Dedicated PWM Audio pin driven by WAV files from micro-SD card, and for sound generation, for an external amplifier.
  • Display full colour images, animations, icons and video clips.
  • Supports all available Windows fonts.
  • 4.0V to 5.5V range operation (single supply).
  • Module dimensions:
    • (D): 95.7 x 57.1 x 6.3mm.
    • (D-CLB): 98.8 x 72.6 x 7.4mm.
    • (DT): 95.7 x 57.1 x 7.5mm.
    • (DCT-CLB): 98.8 x 72.6 x 8.3mm.
  • 4x mounting tabs with 3.2mm holes for mechanical mounting using M3 screws.
  • RoHS and REACH compliant.
  • CE Compliant – please ask for CE declarations from our Support Team.

The intelligent gen4 displays can be programmed via Workshop4 IDE. It provides an integrated software development platform for all of the 4D family of processors and modules. The IDE combines the Editor, Compiler, Linker and Downloader to develop complete 4DGL application code.

gen4 modules are available in 4 models:

  • gen4-uLCD-32D (non Touch, without Cover Lens Bezel)
  • gen4-uLCD-32DT (Resistive Touch, without Cover Lens Bezel)
  • gen4-uLCD-32D-CLB (non Touch, Cover Lens Bezel)
  • gen4-uLCD-32DCT-CLB (Capacitive Touch, with Cover Lens Bezel)

The module is available on the official website with a range of $55 to $79 including interface board, 150mm FFC cable, and a quick start guide. Starter kits are also available from $75 to $99.

How to Set Up and Program an LCD Display on an Arduino

circuitbasics.com has a tutorial on how to setup an LCD with Arduino.

In this tutorial, I’ll explain how to set up an LCD display on an Arduino, and show you all the functions available to program it (with examples). The display I’m using here is a 16×2 LCD display that I bought for under $10 on Amazon. LCDs are really useful in projects that output data, and they can make your project a lot more interesting and interactive.

How to Set Up and Program an LCD Display on an Arduino – [Link]

4Duino – An Introduction and a Weather API Demo


We covered 4Duino in one of our previous blog posts. 4Duino is a 2.4” Arduino based programmable display module. In our article today, we are presenting a hands-on experience with this product by building a simple project. Many thanks to 4D Systems for sending us a sample and giving us a chance to try this new product.

4Duino – An Introduction and a Weather API Demo – [Link]

0.91 inch OLED display targets wearables

Winstar’s WEO012832F is a small OLED display featuring 128×32 pixels in a 0.91 inch diagonal screen, suitable for wearable devices. by Julien Happich @ edn-europe.com:

The WEO012832F module comes with a built-in SSD1306BZ controller IC, it supports an I 2C interface and a 14-pin FPC pinout.  Standard emitting colours for the WEO012832F are available in white, sky blue and yellow. The WEO012832F features a COG structure OLED display, the built-in voltage generation only requires a single 3V power supply. This lightweight 30.0×11.5×1.45mm OLED module can operate at temperatures from -40℃ to +80℃.

0.91 inch OLED display targets wearables – [Link]

Alarm System Powered By Arduino

Dejan Nedelkovski had built an Arduino security and alarm system project that uses an ultrasonic sensor for detecting objects and a buzzer for notification.

Components needed to build this simple system are: Arduino board, LCD display, 4×4 keypad, ultrasonic sensor and buzzer. The circuit can be connected as shown in the schematics below.

In order to build the project, you have to connect the buzzer with a PWM pin and the keypad pins where 4 of the 8 pins are for rows and the rest are for columns.

“The 4×4 keypad has 8 pins, 4 of them are for the rows and 4 of them for the columns of the keypad. Each button is actually a push button switch which makes a short between one row and column when pressed. So, for example, if we set the row 1 line low, and all column lines high, when we will press, for example, the button 3, due to the short between the two lines, the column 3 line will drop to low so in such a case we can register that the button 3 has been pressed.”

For connecting the LCD display and ultrasonic sensor you can check this detailed video tutorial by Dejan Nedelkovski and to see the project in action:

We want to activate the alarm by setting the A button to activate it. B button is used to change the password, and you need to enter the preset password “1234” to be able to change it.
After activating the alarm by pressing A, a 200 milliseconds sound will be produced from the buzzer showing that the alarm is now active. A message on the LCD display will appear to saying “Alarm will be activated in” and a countdown will be running afterwards until the alarm is completely active. At the end of the countdown a ” Alarm Activated” is on the display and the sensor will start working. Comparing with the initial distance at the start, the sensor will measure the distance is smaller than the initial distance, corrected by a value of 10 cms. The buzzer will  produce a sound if an object is observed as per the condition.

Here’s the complete source code of the Arduino alarm system:

/*
* Arduino Security and Alarm System
*
* by Dejan Nedelkovski,
* www.HowToMechatronics.com
*
*/
#include <LiquidCrystal.h> // includes the LiquidCrystal Library 
#include <Keypad.h>
#define buzzer 8
#define trigPin 9
#define echoPin 10
long duration;
int distance, initialDistance, currentDistance, i;
int screenOffMsg =0;
String password="1234";
String tempPassword;
boolean activated = false; // State of the alarm
boolean isActivated;
boolean activateAlarm = false;
boolean alarmActivated = false;
boolean enteredPassword; // State of the entered password to stop the alarm
boolean passChangeMode = false;
boolean passChanged = false;
const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
char keypressed;
//define the cymbols on the buttons of the keypads
char keyMap[ROWS][COLS] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};
byte rowPins[ROWS] = {14, 15, 16, 17}; //Row pinouts of the keypad
byte colPins[COLS] = {18, 19, 20, 21}; //Column pinouts of the keypad
Keypad myKeypad = Keypad( makeKeymap(keyMap), rowPins, colPins, ROWS, COLS); 
LiquidCrystal lcd(1, 2, 4, 5, 6, 7); // Creates an LC object. Parameters: (rs, enable, d4, d5, d6, d7) 
void setup() { 
  lcd.begin(16,2); 
  pinMode(buzzer, OUTPUT); // Set buzzer as an output
  pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
  pinMode(echoPin, INPUT); // Sets the echoPin as an Input
}
void loop() {
  if (activateAlarm) {
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("Alarm will be");
    lcd.setCursor(0,1);
    lcd.print("activated in");
   
    int countdown = 9; // 9 seconds count down before activating the alarm
    while (countdown != 0) {
      lcd.setCursor(13,1);
      lcd.print(countdown);
      countdown--;
      tone(buzzer, 700, 100);
      delay(1000);
    }
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("Alarm Activated!");
    initialDistance = getDistance();
    activateAlarm = false;
    alarmActivated = true;
  }
  if (alarmActivated == true){
      currentDistance = getDistance() + 10;
      if ( currentDistance < initialDistance) {
        tone(buzzer, 1000); // Send 1KHz sound signal 
        lcd.clear();
        enterPassword();
      }
    }
  if (!alarmActivated) {
    if (screenOffMsg == 0 ){
      lcd.clear();
      lcd.setCursor(0,0);
      lcd.print("A - Activate");
      lcd.setCursor(0,1);
      lcd.print("B - Change Pass");
      screenOffMsg = 1;
    }
    keypressed = myKeypad.getKey();
     if (keypressed =='A'){        //If A is pressed, activate the alarm
      tone(buzzer, 1000, 200);
      activateAlarm = true;            
    }
    else if (keypressed =='B') {
      lcd.clear();
      int i=1;
      tone(buzzer, 2000, 100);
      tempPassword = "";
      lcd.setCursor(0,0);
      lcd.print("Current Password");
      lcd.setCursor(0,1);
      lcd.print(">");
      passChangeMode = true;
      passChanged = true;   
      while(passChanged) {      
      keypressed = myKeypad.getKey();
      if (keypressed != NO_KEY){
        if (keypressed == '0' || keypressed == '1' || keypressed == '2' || keypressed == '3' ||
            keypressed == '4' || keypressed == '5' || keypressed == '6' || keypressed == '7' ||
            keypressed == '8' || keypressed == '9' ) {
         tempPassword += keypressed;
         lcd.setCursor(i,1);
         lcd.print("*");
         i++;
         tone(buzzer, 2000, 100);
        }
      }
      if (i > 5 || keypressed == '#') {
        tempPassword = "";
        i=1;
        lcd.clear();
        lcd.setCursor(0,0);
        lcd.print("Current Password");
        lcd.setCursor(0,1);
        lcd.print(">"); 
      }
      if ( keypressed == '*') {
        i=1;
        tone(buzzer, 2000, 100);
        if (password == tempPassword) {
          tempPassword="";
          lcd.clear();
          lcd.setCursor(0,0);
          lcd.print("Set New Password");
          lcd.setCursor(0,1);
          lcd.print(">");
          while(passChangeMode) {
            keypressed = myKeypad.getKey();
            if (keypressed != NO_KEY){
              if (keypressed == '0' || keypressed == '1' || keypressed == '2' || keypressed == '3' ||
                  keypressed == '4' || keypressed == '5' || keypressed == '6' || keypressed == '7' ||
                  keypressed == '8' || keypressed == '9' ) {
                tempPassword += keypressed;
                lcd.setCursor(i,1);
                lcd.print("*");
                i++;
                tone(buzzer, 2000, 100);
              }
            }
            if (i > 5 || keypressed == '#') {
              tempPassword = "";
              i=1;
              tone(buzzer, 2000, 100);
              lcd.clear();
              lcd.setCursor(0,0);
              lcd.print("Set New Password");
              lcd.setCursor(0,1);
              lcd.print(">");
            }
            if ( keypressed == '*') {
              i=1;
              tone(buzzer, 2000, 100);
              password = tempPassword;
              passChangeMode = false;
              passChanged = false;
              screenOffMsg = 0;
            }            
          }
        }
      }
    }
   }
 }
}
void enterPassword() {
  int k=5;
  tempPassword = "";
  activated = true;
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print(" *** ALARM *** ");
  lcd.setCursor(0,1);
  lcd.print("Pass>");
      while(activated) {
      keypressed = myKeypad.getKey();
      if (keypressed != NO_KEY){
        if (keypressed == '0' || keypressed == '1' || keypressed == '2' || keypressed == '3' ||
            keypressed == '4' || keypressed == '5' || keypressed == '6' || keypressed == '7' ||
            keypressed == '8' || keypressed == '9' ) {
          tempPassword += keypressed;
          lcd.setCursor(k,1);
          lcd.print("*");
          k++;
        }
      }
      if (k > 9 || keypressed == '#') {
        tempPassword = "";
        k=5;
        lcd.clear();
        lcd.setCursor(0,0);
        lcd.print(" *** ALARM *** ");
        lcd.setCursor(0,1);
        lcd.print("Pass>");
      }
      if ( keypressed == '*') {
        if ( tempPassword == password ) {
          activated = false;
          alarmActivated = false;
          noTone(buzzer);
          screenOffMsg = 0; 
        }
        else if (tempPassword != password) {
          lcd.setCursor(0,1);
          lcd.print("Wrong! Try Again");
          delay(2000);
          lcd.clear();
          lcd.setCursor(0,0);
          lcd.print(" *** ALARM *** ");
          lcd.setCursor(0,1);
          lcd.print("Pass>");
        }
      }    
    }
}
// Custom function for the Ultrasonic sensor
long getDistance(){
  //int i=10;
  
  //while( i<=10 ) {
  // Clears the trigPin
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  // Sets the trigPin on HIGH state for 10 micro seconds
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  // Reads the echoPin, returns the sound wave travel time in microseconds
  duration = pulseIn(echoPin, HIGH);
  // Calculating the distance
  distance = duration*0.034/2;
  //sumDistance += distance;
  //}
  //int averageDistance= sumDistance/10;
  return distance;
}

Check the project post to know more information and to find detailed tutorial. You can also check other posts by Dejan using this link.

RELATED POSTS

Arduino Tutorial: Menu on a Nokia 5110 LCD Display Tutorial

In this easy Arduino Tutorial educ8s.tv is going to show us how to create a Menu on a Nokia 5110 LCD display.

This is the project we are going to build. In the display a simple menu appears, and with the help of three buttons I can navigate up, or down and select a menu item. Let’s select the first option. As you can see a new a UI screen is displayed and by pressing the up and down buttons we can change the contrast of the display. If we press the middle button again, we go back to the main UI screen. If we now select the second menu item and press the middle button we can turn the backlight of the display on or off. Lastly if we navigate to the last menu item we can reset the settings for the display to the default values. Of course this is just a demonstration project, you can modify it to build your own more complex menus if you wish. Let’s now see how to build this project.

Arduino Tutorial: Menu on a Nokia 5110 LCD Display Tutorial [Link]