SSD1306 (1.3" 128x64 OLED) Wiring

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
ChanneledDan
 
Posts: 2
Joined: Mon Sep 17, 2012 5:42 pm

SSD1306 (1.3" 128x64 OLED) Wiring

Post by ChanneledDan »

Hi all,

I must admit that I'm completely new to hardware hacking... My ultimate goal is to be able to output text (and simple graphics) to the 1.3" 128x64 OLED screen, product ID 938.

If anyone can point me in the right direction, I can try to do my own research. If someone could at least explain what the pins are in this picture: http://www.adafruit.com/images/large/ID938beef_LRG.jpg
and how I might go about wiring it up to a Raspberry Pi, that would be great.

I assume the one in the picture is hooked up to an Arduino, would it also be possible to use a RPI?

So far I've only figured out that it's connected using SPI, so:
Data - data in
Clk - clock required for SPI
RST - ???
Vin - power input (3.3v?)
Gnd - ground

Mind filling in the blanks/correcting me?

Thanks so much for the help!

User avatar
adafruit_support_bill
 
Posts: 88154
Joined: Sat Feb 07, 2009 10:11 am

Re: SSD1306 (1.3" 128x64 OLED) Wiring

Post by adafruit_support_bill »

RST is the reset pin. It should be possible to drive this with a Raspberry Pi, but if you are just getting started, the Arduino is an easier path. We have tutorials and supported Arduino libraries for this device.

ChanneledDan
 
Posts: 2
Joined: Mon Sep 17, 2012 5:42 pm

Re: SSD1306 (1.3" 128x64 OLED) Wiring

Post by ChanneledDan »

Yes, I've noticed that it would probably be easier going with Arduino, and I am still considering going that route.

The thing I like about the Raspberry Pi is that its a whole Linux machine which I'm very comfortable with and I can have it do powerful things like run a server on it and output text and maybe a graph directly to the small screen.

If I can't figure this out perhaps I'll go with Raspberry Pi and the simpler 16x2 screens which I'm confident I would be able to successfully hook up and use, since they're so widely used.

Still, any resources I can find about how to interface with this OLED display would be nice. Thanks for your reply!

User avatar
adafruit_support_bill
 
Posts: 88154
Joined: Sat Feb 07, 2009 10:11 am

Re: SSD1306 (1.3" 128x64 OLED) Wiring

Post by adafruit_support_bill »

At this point, the best resource is probably a combination of the SSD1306 data sheet and the Arduino library source code. At the moment, there is a huge backlog of libraries to port to the RasPI & I don't have any ETA on the SSD1306.

GuyC
 
Posts: 3
Joined: Sun May 22, 2011 1:58 am

Re: SSD1306 (1.3" 128x64 OLED) Wiring

Post by GuyC »

If anyone else is interested in driving the Adafruit SSD1306 128x64 OLED module from a Raspberry Pi,
I've implemented the core of the library in python for the RPi. Write-up and links to source code are here:
http://guy.carpenter.id.au/gaugette/blo ... pberry-pi/.

Note that the library currently only supports the SPI 128x32 version of this module
and depends on wiringpi and the spidev python modules.

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: SSD1306 (1.3" 128x64 OLED) Wiring

Post by adafruit »

Awesome! We'll blog this up

User avatar
gsentlin
 
Posts: 5
Joined: Sun Aug 19, 2012 10:51 am

Re: SSD1306 (1.3" 128x64 OLED) Wiring

Post by gsentlin »

Hello,

I realize this is an old post, but it seems relevant. I have an SSD1306 OLED display working on my Uno. I would like to get it working on my Maple clone (Olimex STM32). Has anyone done any work porting the libraries to Maple, or perhaps the Due?

Thanks

User avatar
restless
 
Posts: 1
Joined: Tue Mar 05, 2013 6:44 am

Re: SSD1306 (1.3" 128x64 OLED) Wiring

Post by restless »

Hey guys,
i bought the 128x64 OLED and tryed to use with my Raspberry-PI. Im using the py-gaugette lib by Guyc, i know its for the x32 version.
The display seems working, but only every second line --> the lib is not for the x64 version. I tried to change some things, but no success :( Is there an other workig lib for the ss1306 with 128x64 ? or could someone help me with the py-gaugette lib?

hope for help :)

Thanks!

EDIT: Now i got a solution for 64 rows version :) ill submit it if im finished. Thanks GuyC for ur lib!

EDIT2:
If someone want to use the gaugette-lib, go to ssd1306.py

search for:
1)
self.command(self.SET_MULTIPLEX, 0x1F)
and change it to
self.command(self.SET_MULTIPLEX, 0x3F)

2)
self.command(self.SET_COM_PINS, 0x02)
and change it to
self.command(self.SET_COM_PINS, 0x12)

next step is, change the variable "rows" to 64 and then the main part is working. Scroll and some other features might need an optimization too, but i haven't tested.


sry for my bad english, but i hope i could help people with the same problem :P

User avatar
mike808
 
Posts: 74
Joined: Sat May 25, 2013 10:22 pm

Re: SSD1306 (1.3" 128x64 OLED) Wiring

Post by mike808 »

I am getting by board on Monday and I wanted to do the same (connect to raspberry pi), but drive from a c++ program. was curious if anyone was able to do so and if there are any examples? i've seem some for a different display (Digole), but not sure if that code is compatible with Adafruit's one. Does anyone know? any help is greatly appreciated.

automa
 
Posts: 2
Joined: Wed Jul 31, 2013 4:04 pm

Re: SSD1306 (1.3" 128x64 OLED) Wiring

Post by automa »

Hello everyone!

just got the 1.3" 128x64 OLED (ID 938) display for my Pi and tried to use the py-gaugette lib with the modifications stated by Restless. It seems all the required libs are installed, though when i connect the pins according to Guys instruction: http://guy.carpenter.id.au/gaugette/blo ... pberry-pi/
Image

nothing happens on the display. The sample code in the py-gaugette lib ssd1306_test.py outputs the following error:

Code: Select all

pi@raspberrypi ~/py-gaugette-1.1/py-gaugette-1.1/samples $ python ssd1306_test.py
Traceback (most recent call last):
  File "ssd1306_test.py", line 8, in <module>
    led = gaugette.ssd1306.SSD1306(reset_pin=RESET_PIN, dc_pin=DC_PIN)
  File "/usr/local/lib/python2.7/dist-packages/gaugette/ssd1306.py", line 114, in __init__
    self.spi.open(bus, device)
IOError: [Errno 2] No such file or directory
pi@raspberrypi ~/py-gaugette-1.1/py-gaugette-1.1/samples $
I guess it is about the wiring of the GPIO which i did as on the image.
Do i need to set something up in the libs WiringPi or SPIDev?
Anyone got this display running with a Pi?

I'd appreciate any help for a beginner. Thanks.

User avatar
radiatortwo
 
Posts: 2
Joined: Thu Aug 01, 2013 7:16 pm

Re: SSD1306 (1.3" 128x64 OLED) Wiring

Post by radiatortwo »

I´m assuming you are using Raspbian Wheezy as OS. The problem is it can´t find the spi bus interface. Because in Linux everything is a file, even the spi bus is seen like this and you get the error:

Code: Select all

IOError: [Errno 2] No such file or directory
In Raspbian Wheezy the standard is that spi and i2c are blacklisted.
You have to remove spi from the blacklist in the config.

Just comment out the two lines in the following file:

/etc/modprobe.d/raspi-blacklist.conf

Change it from:

Code: Select all

# blacklist spi and i2c by default (many users don't need them)

blacklist spi-bcm2708
blacklist i2c-bcm2708
to

Code: Select all

# blacklist spi and i2c by default (many users don't need them)

#blacklist spi-bcm2708
#blacklist i2c-bcm2708
After a restart you should be able to run the sample.

I got it running without any problems.
Only difference:
I´m using it with wiringPi2 because the older version is deprecated.
You just have to change the lines in the file "/py-gaugette/gaugette/ssd1306.py" that contain wiringpi to wiringpi2 and compile it again.

Also if somebody is interested I will translate the graphics functions in the adafruit library which are missing by now in the py-gaugette library. This just has to wait a few days. The Bresenham line algorithm is already working, but I have no time in the next days.

Hope I could help you with that.

automa
 
Posts: 2
Joined: Wed Jul 31, 2013 4:04 pm

Re: SSD1306 (1.3" 128x64 OLED) Wiring

Post by automa »

Hello RadiatorTwo,

thanks for your help!
I do indeed use Raspbian Wheezy and was able to fix my mistakes with your help about spi/i2c blacklisting. I also loaded wirpingPi2 and new compiled py-gaugette.

Unfortunately I'm running in another problem.. would you help me another time please?
When calling the test-script, my putty-cursor halts in a new empty line but still no output on the OLED.

Code: Select all

pi@raspberrypi ~/py-gaugette-1.1/py-gaugette-1.1/samples $ sudo python ssd1306_test.py
<cursor>
After a minute or so of waiting Ctrl+C results in the following:

Code: Select all

pi@raspberrypi ~/py-gaugette-1.1/py-gaugette-1.1/samples $ sudo python ssd1306_test.py
^CTraceback (most recent call last):
  File "ssd1306_test.py", line 21, in <module>
    led.draw_text2(0,16,text,2)
  File "/usr/local/lib/python2.7/dist-packages/gaugette/ssd1306.py", line 254, in draw_text2
    self.draw_pixel(px,py,mask & 0x1)
  File "/usr/local/lib/python2.7/dist-packages/gaugette/ssd1306.py", line 224, in draw_pixel
    self.bitmap.draw_pixel(x,y,on)
  File "/usr/local/lib/python2.7/dist-packages/gaugette/ssd1306.py", line 299, in draw_pixel
    if (x<0 or x>=self.cols or y<0 or y>=self.rows):
KeyboardInterrupt
pi@raspberrypi ~/py-gaugette-1.1/py-gaugette-1.1/samples $
Now I'm wondering if my display is O.K.?
Thank you very much!!!

User avatar
radiatortwo
 
Posts: 2
Joined: Thu Aug 01, 2013 7:16 pm

Re: SSD1306 (1.3" 128x64 OLED) Wiring

Post by radiatortwo »

Sorry for late answer. Been busy for a few days...

When running the script and the cursor just stays where it is that means everything is running fine.
The test script is just running in a loop and only ends when you interrupt it. (Or an error occurs...)

I think you have to check your wiring on the display.

I am using the adafruit pi cobbler on a breadboard right now.
If you're also using a breadboard, check if the wires are really connected.
The pins of my wires are a bit thin and sometimes they don't have enough contact.

Because the 128x32 is slightly different in the description of the pins than the 128x64 display here the wiring I have with a 128x64 display:

Code: Select all

Data -> MOSI (GPIO 10)
Clk -> SCLK (GPIO 11)
SA0/DC -> RXD (GPIO 15)
Rst -> TXD (GPIO 14)
Cs -> CE0 (GPIO 8)
3v3 -> unused output from display (can be used as indicator that the display is on)
Vin -> any 3v3 or 5v0 pin
Gnd -> any Gnd pin

GuyC
 
Posts: 3
Joined: Sun May 22, 2011 1:58 am

Re: SSD1306 (1.3" 128x64 OLED) Wiring

Post by GuyC »

From version 1.2 the py-gaugette library https://github.com/guyc/py-gaugette includes support for the 128x64 display. It uses the setup changes proposed by Restless earlier in this thread.

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”