Controlling Display

Hello to everyone! I have Arduino Nano ATmega328 (old bootloader), and this display:


I can't find info about it, so I don't know how to use it. Can someone help me, pleeease?

Simply make the following connection between OLED and NANO and then upload the given test sketch:

NANO        OLED
5V          VDD
GND         GND
SDA (A4)    SDA
SCL (A5)    SCK

Sketch:

//#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels

#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

void setup()
{
  Serial.begin(9600);

  // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) 
  {
    Serial.println(F("SSD1306 allocation failed"));
    for (;;); // Don't proceed, loop forever
  }
  // Show initial display buffer contents on the screen --
  // the library initializes this with an Adafruit splash screen.
  display.display();
  delay(2000); // Pause for 2 seconds

  // Clear the buffer
  display.clearDisplay();

  // Draw a single pixel in white
  display.drawPixel(10, 10, SSD1306_WHITE);

  // Show the display buffer on the screen. You MUST call display() after
  // drawing commands to make them visible on screen!
  display.display();
  delay(2000);
  testdrawstyles();    // Draw 'stylized' characters
}

void loop() 
{
}

void testdrawstyles(void) 
{
  display.clearDisplay();
  display.setTextSize(1);             // Normal 1:1 pixel scale
  display.setTextColor(SSD1306_WHITE);        // Draw white text
  display.setCursor(0, 0);            // Start at top-left corner
  display.println(F("Hello, world!"));

  display.setTextColor(SSD1306_WHITE);
  //(SSD1306_BLACK, SSD1306_WHITE); // Draw 'inverse' text
  display.println(3.141592, 6); //6-digit after decimal point

  display.setTextSize(2);             // Draw 2X-scale text
  display.setTextColor(SSD1306_WHITE);
  display.print(F("0x")); display.println(0xDEADBEEF, HEX);

  display.display();
  delay(2000);
}

It looks like an SSD1306 OLED display with an I2C interface

Install an SSD1306 library and try the examples

Check out this project, it seems to make use of the same display model:

Is it 5V tolerant? VCC and IO?

Text version


Executing task in folder simplefoc: C:\Users\Developer\.platformio\penv\Scripts\platformio.exe run --target upload 

Processing nanoatmega328 (platform: atmelavr; board: nanoatmega328; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/nanoatmega328.html
PLATFORM: Atmel AVR (5.0.0) > Arduino Nano ATmega328
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 30KB Flash
DEBUG: Current (avr-stub) External (avr-stub, simavr)
PACKAGES:
 - framework-arduino-avr @ 5.2.0
 - tool-avrdude @ 1.60300.200527 (6.3.0)
 - toolchain-atmelavr @ 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 12 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Simple FOC @ 2.3.2
|-- LiquidCrystal_I2C @ 1.1.4
|-- GyverBME280 @ 1.5.0
|-- GyverOLED @ 1.6.1
|-- Adafruit SSD1306 @ 2.5.9
|-- Adafruit GFX Library @ 1.11.9
|-- SPI @ 1.0
Building in release mode
Compiling .pio\build\nanoatmega328\src\main.cpp.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\wiring_digital.c.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\wiring_pulse.S.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\wiring_pulse.c.o
Compiling .pio\build\nanoatmega328\FrameworkArduino\wiring_shift.c.o
src\main.cpp: In function 'void setup()':
src\main.cpp:80:3: error: 'testdrawstyles' was not declared in this scope
   testdrawstyles();    // Draw 'stylized' characters
   ^~~~~~~~~~~~~~
*** [.pio\build\nanoatmega328\src\main.cpp.o] Error 1
================================================================================================== [FAILED] Took 2.56 seconds ==================================================================================================

 *  The terminal process "C:\Users\Developer\.platformio\penv\Scripts\platformio.exe 'run', '--target', 'upload'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it.

I don't think so, because it looks different, but maybe...

Probably, it's different display

Yes, it is tolerant with 5V)
Exсuse me, what is IO?)

The signal pins, SCK and SDA (IO pins of processor).
Some TFTs have 5V VCC, but only 3.3V data lines.

I don't think so. Searching for GM009605v4 I see it's an OLED with SSD1306 chip, with I2C interface (and it surely is I2C because you can see SDA/SCL pins), so it seems exactly the same of such Instructables project. Giving it a try won't hurt you, the only issue could be the I2C address (in this case use I2C scanner as included in the Instructable to retrieve the correct address, and use it on your code).

EDIT: I mean, THIS is the display:
http://www.lcdwiki.com/0.96inch_OLED_Module_MC096VX

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.