Adafruit SSD1306 [SOLVED]

@freddyroosevelt, now I have rewired my own breadboard to use exactly your jumper wires colors, to make things match when providing a pic of my working setup.
And in the course of doing so I realized, that I swapped around the SPI pins. I don’t know how often I read over that very part of my own post and even after @peekay123 has given you the correct pin numbers, I didn’t realize my error.
I got myself fooled by this part of the original library and took D0, D1 as the OLED pin names and matched them with the Particle SPI pins MOSI (A5) and CLK (A3)

// If using software SPI (the default case):
#define OLED_MOSI   D0
#define OLED_CLK    D1

Sorry for that :flushed:

So the correct and tested pinout should look like this

So what I actually should have given you is

// use hardware SPI
// OLED_D0 -> A3 (SPI CLK)
// OLED_D1 -> A5 (SPI MOSI)
#define OLED_DC D3
#define OLED_CS D4
#define OLED_RESET D5

(I have corrected all the above quotations accordingly)

Sorry again :blush:

4 Likes

no problem, I’m really trying to get this thing to work. Thanks I will try that and see if that works.

Problem Solved with Oled finally working with my Core and Photon!!!

Thanks a lot: @ScruffR @LukeUSMC @peekay123 it took me some time but i finally got it working lol

@ScruffR that last image setup was the correct way.

3 Likes

@johnwargo: Since this is your thread (but has drifted off but got some running setups) I’d like to mark this [SOLVED].
If you don’t see it solved, please comment - maybe we can help to solve your issues too.

1 Like

What does your final code look like for this ?

Not speaking for @freddyroosevelt, but my final code (which produces exactly what Freddy’s snap shows) is nothing else than the original sample SSD1306_128x64_SPI.ino with the alterations of post #8.

1 Like

Its the same code from the github - SSD1306_128x64_spi.ino as @ScruffR said. From @peekay123 repo located here: https://github.com/pkourany/Adafruit_SSD1306

Just make sure after you download the repo, once you’re in your project you should only have the:

Adafruit_GFX.cpp,
Adafruit_GFX.h,
Adadfruit_SSD1306.cpp,
Adafruit.h
and the ssd1306_128x64_spi.ino files only.

I have the exact code from that. Hope that helps.

@cr_huber, to add to Freddy’s post:
He is using Particle Dev, hence he’s using the github repo files and is pointing out the filelist.

If you are using Particle Build (Web IDE) - as I understand -, you’ll not need the files in your file tabs but only hit USE THIS EXAMPLE for said sample file.

If you are not that familiar with the libraries feature of Particle Build, have a read here
Library search, forkable library examples, and private libraries shipped to IDE

Hey guys!

Ok, so I have two brand new photons here (also have a few of the old Sparc cores). I would like to use them with the OLED 128x32 display I2C version. The particle IDE is still less than intuitive for someone used to a larger environment (if we ever get the Particle env hooked into Visual Studio? I will be in heaven).

In any case… I am trying to follow along here. I wire up the items and “include in this app” the appropriate 1306 community library and then it all goes wrong. It seems the library is built for the larger version of the display and of course it’s read only since it is an included library.

So whats the play here? Fork the library? Copy / paste the code by hand into my app? Is there a decent example of this that you guys can point me at so I am not wasting your time?

Feel free to just give me a strong hint, I am not a novice to development or Arduino, just this environment.

Ken

Have you got CLI installed?
Or Particle Dev?
These two options will be a bit easier to use with a fork or a downloaded ZIP of the SSD1306 library.

I just installed the Particle Dev so that I can work on this locally. I am a reasonable Atom user, so this works well for me :slight_smile:

In this case you just have to be aware of some things.
Each project needs its own directory, which only contains one .INO file and the required .H/.CPP files, any other file needs to be excluded from the build via an entry in a spark.ignore file in that directory.
To be able to build the project, you should open the project folder (Open Folder ...) rather than the .INO file.
Particle Dev does not trigger a firmware update, hence when your device is running an old system firmware version (or a new version gets released), you need to “manually” update the system firmware, since Dev always targets the most recent version.

1 Like

Ok, sounds reasonable enough :smile:

I’ll see about putting the right files in place now.

1 Like

Thanks, Yes this works for me on the Photon. It may be obvious but it should be pointed out that in Feddy’s file list for the Particle Dev, “Adafruit.h” should read “Adafruit_SSD1306.h”

1 Like

I’ve followed all the steps suggested, however when I attempt to flash I get “Flash unsuccessful” and when I expand I get “Request Timed Out” I’ve tried changing networks and still get the same issue. Any suggestions?

I wanted to add a post for 2018 on this thread. If you follow the above wire diagram and instructions from @ScruffR and use the code posted from @peekay123 this will work without fail. Thanks guys for all your hard work. Keeps noobs like me in the game.

Look at those pretty stars. Now to dive in and try and change the code to post some useful data… after I stare at the stars for another 20 min. :joy:

Cheers,
Tom

2 Likes

For anyone interested I was able to combine this tutorial with the SD Card logger from @rickkas7. I did use a modified code for the OLED off of hackster that is for the electron. As I do all my testing on a Photon and breadboard before moving over to the Electron. I wanted to be able to add the screen to see how things were working while away from the web… that and it seemed like a fun thing to geek out on.

2 Likes

I’m using the SSD1306 128x32 display with I2C. Text that is blown up to size 4 is very rough.
It seems that the setFont() was taken out of @peekay123 's port of the Adafruit_GFX library.
So I would like to change the font, and barring that, increase resolution of the default font at larger sizes.

@PopQuiz, the font scaling used by Adafruit is very basic. If you are using the Adafruit_mfGFX library can you can create custom fonts of whatever size and resolution you want with the understanding that every font will use up flash space. @RWB created a lot of fonts for his applications using this approach.

1 Like

AHA! That was what I needed. I see the mfGFX library has that method. Many thanks.

2 Likes