Adafruit SSD1306 Library [Ported]

Ok I changed the addresses in the code 0x3C and the display started working in that I have the adafruit splashscreen.
I tried to take a photo but it just shows a small part of the display image due to the refresh rate.

1 Like

Hi,

First post here as I’ve just dug out a Spark Core that I bought a long time ago and never got around to using until now. I have an Adafruit 128x64 OLED that I would like to connect to my Spark, I want to read the temperature off a DS18B20 ( which I’ve already had working before ) and display it on the OLED. I was looking to use the Hardware SPI and in @peekay123 library there is a bit of code in the example file below.

 // use hardware SPI
 #define OLED_DC D3
 #define OLED_CS D4
 #define OLED_RESET D5
 Adafruit_SSD1306 display(OLED_DC, OLED_RESET, OLED_CS);

So how do I wire my spark core to the OLED, does it only need the 3 wires and power and ground?

@PeteStewardson, those pins are above and beyond the SPI pins which are A3 and A5. Instead of A2 as the chip select, the library will use D4. So, the extra connections you need are:

Core     OLED
A3       CLK
A5       MOSI

:smile:

Thanks @peekay123 I’ll give this a try :slight_smile:

1 Like

I’m facing the same Problem. (How) Did you solve it?

@smnnekho, are you using an I2C display or an SPI display? Since you are running a Core, can you give more details as to which library and demo app you tried?

It looks lika an I2C due to the pin naming on the board, but are you using the correct code for I2C?

I can’t see the resostor values, but does the board not have its own on board?

@peekay123 I am using I2C because i have an RFID Scanner connected to the same Photon via SPI - Besides - i think my Display is I2C only:

SainSmart 1.3" I2C IIC Serial 128X64 OLED Module for Arduino (White)

The picture is not mine but copied from a few posts up since i replied to him and have the same problem (-;

Mine is connected like this: no resistors, SDA=D0, SCL=D1, RST=D4 and i can see the animation in the upper part of the display and the rest is random pixels…

i just used the github contents, just kept ssd1306_128x64_i2c.ino + Adafruit_GFX h/cpp + Adafruit_SSD1306 h/cpp and it compiled and executed on my photon

I had to put 4.7k resistors on my i2c display. Here is now my i2c oled is hooked up.
OLED Phonton/Core
VCC <> 3v3
GND <> GND
SCL <> 4.7k <> D1
SDA <> 4.7k <> D2

I don’t have a reset pin on my oled so I just declare it to an unused pin (D4 in my case).

@smnnekho, it is not clear if the display has pull-ups so I would add 10K ohm resistors to the Vcc (3.3v or 5v) you power your display with.

Thanks, i’ll try this when i am home. so 10K on the displays 3.3V in only? because i read something about resistors on SDA/SCL in this thread - but at least for @superholz that does no change the displays behaviour at all (and i dont think i have any of those lying around :flushed:

Sorry I did not solve it. I tried to connect the reset pin as mentioned in the link over a similar problem in Arduino. That did not solve it - either because i did not do it properly (it is a rather delicate operation) or it is simply not the right thing to do.
Would be great if you find a solution, I still have four of those displays without able to use them with the core.

@superholz, @smnnekho, does either of you have better documentation for that Sainsmart display?

I have this display.

Those are 4.7k resistors on the SCL SDA lines.Not pretty but was a temp setup to show it working.

Wired like so.
In Defines

#define OLED_RESET D4 //Not in use, no Reset Pin on OLED
Adafruit_SSD1306 display(OLED_RESET);

In Setup()

 display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3C (for the 128x64 OLED)
2 Likes

@peekay123 i have only the information from the website (pasted below). Also, adding the resistor didn’t help. But i ordererd a nextion 2,4’’ which might be even better suited for my case anyways :smiley: - wont give up on the OLED though…

Features:
high resolution : 128X64 ( and 12864LCD the same resolution , but the unit area of the pixel OLED screen more )
ultra-wide viewing angle : more than 160 ° ( maximum viewing angle display a screen )
ultra-low power consumption : Normal display 0.06W ( far below the TFT display )
wide supply range : DC 3V-5V ( without any changes directly compatible with common 3.3V and 5V power supply system )
industrial grade : Operating temperature range -30 ℃ ~ 70 ℃
ultra-small size : (L ) 27.8MM * ( W ) 27.3MM * ( thick ) 4.3MM
support for multiple operating modes: 3-wire SPI, 4 wire SPI, IIC
with chip select signal CS , you can achieve multiple SPI or IIC devices on the same bus to work
compatible with 3.3V and 5V control chip I / O level ( without any set directly compatible )
OLED screens inside the driver chips : SSD1306
Pin Description:
GND: Power ground
VCC: 3.3V or 5V power supply
D0: CLK clock
D1: MOSI data
RST: Reset
DC: data / command
CS: chip-select signal
Package include:

1x SainSmart 1.3" I2C IIC Serial 128X64 Blue OLED for Arduino UNO MEGA2560

This appears to point in the right direction (last Post). I’ll investigate further.

also interesting:

http://forum.arduino.cc/index.php?topic=159851.60

@smnnekho, here are the steps I recommend, assuming this darn display is really I2C:

  1. Connect pull-up resistors from EACH I2C line (D0 &D1 on Photon/Core) to 3.3V
  2. Flash an I2C scanner app that looks for I2C devices. This SHOULD find the device if it actually running I2C
  3. Report back the findings

:smile:

You can wire your display like mine is wired. The only difference is you have a RST pin which if you copy/paste my defines and setup() you should map RST to D4.

Dear @peekay123,

I have successfully used your library with an Adafruit-compatible display. I have seen you didn’t integrate it into a library for easy access in the Libraries in Photon Web IDE. Would you care to go the extra mile?

If not, I can offer to do it for you. I can either create the library in my own GitHub or you could offer me write permissions to a new repository on yours.

Please drop me a line!

Regards,
Mihai