Adafruit SSD1306 [SOLVED]

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:

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

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.


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:



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.


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.