I recently purchased the module advertised
here
A Yellow+ Blue 128X64 0.96" SPI Serial OLED LCD Display Module.
I have found references to similar modules but mine has 6 pins vcc,gnd,clk,mosi,cs,d/c has anyone seen any information anywhere about this type of oled?
I have found a set of SPI connections
cs , rst , d/c , clk , data ,
I have d/c , cs , mosi , clk
do they convert to
cs - cs
rst
d/c - d/c
clk - clk
data - mosi
I am just trying to get the info before I wire something up.
Hi and welcome. You are correct about those pins. This type of display is quite common and it does not seem to matter that they have no reset pin. I used one like this for one of my Conway's Game Of Life experiments.
Paul
Hi Paul, thanks for the comments I will connect it up tomorrow and try it.
I don't know if you are still keeping an eye on this Paul but I would appreciate your input.
Or alternatively assistance from anyone.
I have downloaded the necessary libraries and the program below to try to run this unit
/*********************************************************************
This is an example sketch for our Monochrome Nokia 5110 LCD Displays
Pick one up today in the adafruit shop!
------> http://www.adafruit.com/products/338
These displays use SPI to communicate, 4 or 5 pins are required to
interface
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, check license.txt for more information
All text above, and the splash screen must be included in any redistribution
*********************************************************************/
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
// Software SPI (slower updates, more flexible pin options):
// pin 7 - Serial clock out (SCLK)
// pin 6 - Serial data out (DIN)
// pin 5 - Data/Command select (D/C)
// pin 4 - LCD chip select (CS)
// pin 3 - LCD reset (RST)
//Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 4, 3);
Adafruit_PCD8544 display = Adafruit_PCD8544(9, 10, 12, 11,13);
//(clk,din,d/c,cs,rst)
// Hardware SPI (faster, but must use certain hardware pins):
// SCK is LCD serial clock (SCLK) - this is pin 13 on Arduino Uno
// MOSI is LCD DIN - this is pin 11 on an Arduino Uno
// pin 5 - Data/Command select (D/C)
// pin 4 - LCD chip select (CS)
// pin 3 - LCD reset (RST)
// Adafruit_PCD8544 display = Adafruit_PCD8544(5, 4, 3);
// Note with hardware SPI MISO and SS pins aren't used but will still be read
// and written to during SPI transfer. Be careful sharing these pins!
#define NUMFLAKES 10
#define XPOS 0
#define YPOS 1
#define DELTAY 2
#define LOGO16_GLCD_HEIGHT 16
#define LOGO16_GLCD_WIDTH 16
static const unsigned char PROGMEM logo16_glcd_bmp[] =
{ B00000000, B11000000,
B00000001, B11000000,
B00000001, B11000000,
B00000011, B11100000,
B11110011, B11100000,
B11111110, B11111000,
B01111110, B11111111,
B00110011, B10011111,
B00011111, B11111100,
B00001101, B01110000,
B00011011, B10100000,
B00111111, B11100000,
B00111111, B11110000,
B01111100, B11110000,
B01110000, B01110000,
B00000000, B00110000 };
void setup() {
Serial.begin(9600);
display.begin();
// init done
// you can change the contrast around to adapt the display
// for the best viewing!
display.setContrast(50);
display.display(); // show splashscreen
delay(2000);
display.clearDisplay(); // clears the screen and buffer
// draw a single pixel
display.drawPixel(10, 10, BLACK);
display.display();
delay(2000);
display.clearDisplay();
// draw many lines
testdrawline();
display.display();
delay(2000);
display.clearDisplay();
// draw rectangles
testdrawrect();
display.display();
delay(2000);
display.clearDisplay();
// draw multiple rectangles
testfillrect();
display.display();
delay(2000);
display.clearDisplay();
// draw mulitple circles
testdrawcircle();
display.display();
delay(2000);
display.clearDisplay();
// draw a circle, 10 pixel radius
display.fillCircle(display.width()/2, display.height()/2, 10, BLACK);
display.display();
delay(2000);
display.clearDisplay();
testdrawroundrect();
delay(2000);
display.clearDisplay();
testfillroundrect();
delay(2000);
display.clearDisplay();
testdrawtriangle();
delay(2000);
display.clearDisplay();
testfilltriangle();
delay(2000);
display.clearDisplay();
// draw the first ~12 characters in the font
testdrawchar();
display.display();
delay(2000);
display.clearDisplay();
// text display tests
display.setTextSize(1);
display.setTextColor(BLACK);
display.setCursor(0,0);
display.println("Hello, world!");
display.setTextColor(WHITE, BLACK); // 'inverted' text
display.println(3.141592);
display.setTextSize(2);
display.setTextColor(BLACK);
display.print("0x"); display.println(0xDEADBEEF, HEX);
display.display();
delay(2000);
// rotation example
display.clearDisplay();
display.setRotation(1); // rotate 90 degrees counter clockwise, can also use values of 2 and 3 to go further.
display.setTextSize(1);
display.setTextColor(BLACK);
display.setCursor(0,0);
display.println("Rotation");
display.setTextSize(2);
display.println("Example!");
display.display();
delay(2000);
// revert back to no rotation
display.setRotation(0);
// miniature bitmap display
display.clearDisplay();
display.drawBitmap(30, 16, logo16_glcd_bmp, 16, 16, 1);
display.display();
// invert the display
display.invertDisplay(true);
delay(1000);
display.invertDisplay(false);
delay(1000);
// draw a bitmap icon and 'animate' movement
testdrawbitmap(logo16_glcd_bmp, LOGO16_GLCD_WIDTH, LOGO16_GLCD_HEIGHT);
}
void loop() {
}
void testdrawbitmap(const uint8_t *bitmap, uint8_t w, uint8_t h) {
uint8_t icons[NUMFLAKES][3];
randomSeed(666); // whatever seed
// initialize
for (uint8_t f=0; f< NUMFLAKES; f++) {
icons[f][XPOS] = random(display.width());
icons[f][YPOS] = 0;
icons[f][DELTAY] = random(5) + 1;
Serial.print("x: ");
Serial.print(icons[f][XPOS], DEC);
Serial.print(" y: ");
Serial.print(icons[f][YPOS], DEC);
Serial.print(" dy: ");
Serial.println(icons[f][DELTAY], DEC);
}
while (1) {
// draw each icon
for (uint8_t f=0; f< NUMFLAKES; f++) {
display.drawBitmap(icons[f][XPOS], icons[f][YPOS], logo16_glcd_bmp, w, h, BLACK);
}
display.display();
delay(200);
// then erase it + move it
for (uint8_t f=0; f< NUMFLAKES; f++) {
display.drawBitmap(icons[f][XPOS], icons[f][YPOS], logo16_glcd_bmp, w, h, WHITE);
// move it
icons[f][YPOS] += icons[f][DELTAY];
// if its gone, reinit
if (icons[f][YPOS] > display.height()) {
icons[f][XPOS] = random(display.width());
icons[f][YPOS] = 0;
icons[f][DELTAY] = random(5) + 1;
}
}
}
}
}
void testfillroundrect(void) {
uint8_t color = BLACK;
for (int16_t i=0; i<display.height()/2-2; i+=2) {
display.fillRoundRect(i, i, display.width()-2*i, display.height()-2*i, display.height()/4, color);
if (color == WHITE) color = BLACK;
else color = WHITE;
display.display();
}
}
void testdrawrect(void) {
for (int16_t i=0; i<display.height()/2; i+=2) {
display.drawRect(i, i, display.width()-2*i, display.height()-2*i, BLACK);
display.display();
}
}
void testdrawline() {
for (int16_t i=0; i<display.width(); i+=4) {
display.drawLine(0, 0, i, display.height()-1, BLACK);
display.display();
}
for (int16_t i=0; i<display.height(); i+=4) {
display.drawLine(0, 0, display.width()-1, i, BLACK);
display.display();
}
delay(250);
display.clearDisplay();
for (int16_t i=0; i<display.width(); i+=4) {
display.drawLine(0, display.height()-1, i, 0, BLACK);
display.display();
}
for (int8_t i=display.height()-1; i>=0; i-=4) {
display.drawLine(0, display.height()-1, display.width()-1, i, BLACK);
display.display();
}
delay(250);
display.clearDisplay();
for (int16_t i=display.width()-1; i>=0; i-=4) {
display.drawLine(display.width()-1, display.height()-1, i, 0, BLACK);
display.display();
}
for (int16_t i=display.height()-1; i>=0; i-=4) {
display.drawLine(display.width()-1, display.height()-1, 0, i, BLACK);
display.display();
}
delay(250);
display.clearDisplay();
for (int16_t i=0; i<display.height(); i+=4) {
display.drawLine(display.width()-1, 0, 0, i, BLACK);
display.display();
}
for (int16_t i=0; i<display.width(); i+=4) {
display.drawLine(display.width()-1, 0, i, display.height()-1, BLACK);
display.display();
}
delay(250);
}
(I have removed some of the later code as it is too long?)
I have altered the pins in the lines
Adafruit_PCD8544 display = Adafruit_PCD8544(9, 10, 12, 11,13);
//(clk,din,d/c,cs,rst)
to match my wiring but don't even get any light or indication that anything is happening.
Do you think this sketch should work and I have done something wrong elsewhere, or do you know of a sketch and library that might work?
Thanks.
Bob
Bob, that looks like completely the wrong library & sketch for your display!
Maybe try this one.
You seem to be really struggling, so let me try and help.
This info is from where u bought the unit.
Driver IC: SSD1306
•Light color: Yellow+bluePin Definitions:
•VCC:3.3-5V
•GND: grounding
•CLK: clock module
•MOSI: Data input
•Cs: Chip select signal
•D/C: Command / data change
I suggest you download the Uglib library form here.
I will assume u know how to install the library.
Open one of the examples in the library - I suggest "Hello World".
The relevant specs for your unit is SSD1306, 128x64 and SPI.
So the constructs you are interested in would be the following:
//U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
//U8GLIB_SSD1306_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
You need to uncomment one of the above.
When you do, make sure you have matching connections.
You may need to try each construct in turn to see what works for you.
If none work, then there is the possibility that the address needs to be changed.
First try the above, before we start messing with the address.
update.............................the clk wire was just melted to the pin, corrected it now works.
thanks for your interest aisc
I have downloaded the library as you instructed
I restarted the arduino program (is that the IDE?)
I loaded the helloworld sketch and found the lines you refer to.
//U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
//U8GLIB_SSD1306_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
my wiring is clk D9, mosi D10, c/s D11, d/c D12 so I replaced the bracketed numbers in the first, second and fifth lines with (9,10,11,12). uncommenting each line one at a time as I did so. Is A0 the d/c line?
I still don't even get any light or other indication on the display.
I have checked there is 4.79 volts on the vcc - gnd lines from the arduino.
I have also tried the same thing with the sketch graphics test but with no improvement.(the void setup sets d13 for something?)'
#if defined(ARDUINO)
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
#endif
Is there any way I can just test if the unit at least lights or if I have a bad unit?
matelot:
my wiring is clk D9, mosi D10, c/s D11, d/c D12 so I replaced the bracketed numbers in the first, second and fifth lines with (9,10,11,12). uncommenting each line one at a time as I did so. Is A0 the d/c line?
As I said, there could still be an address issue, but first....
Redo the tests you did, but this time don't change the code to suit your wiring.
Change your wiring connections to suit the code.
Post your results.
sorry asic I just altered my last post the clk wire was just melted onto the pin it now works.
I didn't think you were on.
I am using the nano to do other things, I will have to send you a photo but I only have 9,10,11,12 and 13 to spare.
Glad you got it working.
thanks asic, I am slowly building a board for testing my programming ability, the oled unit is bottom right.
All the units work now.
From an earlier post I got the impression you were testing with limited pins hence you may have had other items connected.
FWIW whenever I test, I do a standalone test i.e. only the item I am testing and with minimal code.
So I keep a spare Uno just for that - it makes life easier.
Once I get a basic bit of code working, only then do I integrate it into my sketch and add whatever complexity I need.
the other units can be added into any sketch later but the pins of the nano are dedicated to each board, usually with the help of shift registers.