Community Forum
    • Blog
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    New Adafruit generic OLED display driver for Raspberry PI

    Scheduled Pinned Locked Moved Blog articles comments
    driver1.30.96i2ciic
    53 Posts 20 Posters 40.8k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M Offline
      Mr_Tom
      last edited by

      Hi, Charles. Any progress with testing the library on a PI v2? Is the BCM2836 extremely different than the BCM2835?

      1 Reply Last reply Reply Quote
      • Meng QiM Offline
        Meng Qi
        last edited by Meng Qi

        Thank you for the detailed blog post. I followed your instructions and got 2 problems :

        1. there is no libi2c available, the only thing similar I've found is libi2c-dev so I installed that;
        2. I got error messages while trying to "sudo make" within the example folder, here is a photo showing the result.
          http://i.imgur.com/MkWvXbC.jpg

        Btw I am on a Pi B V2. One strange thing is that when I ran "sudo i2cdetect -y 1" there is nothing on the table. But while I tried to use Adafruit_SSD1306 library, the oled would respond (weirdly).

        Thanks

        1 Reply Last reply Reply Quote
        • CharlesC Offline
          Charles
          last edited by

          @Meng-Qi

          the i2c smbus_ is a know problem

          you just need to intall again lm-sensors package (even if correctly installed) then all shoud go fine. Something obvious I’d like to understand, but it seems to work.

          look below how I resolved it.

          root@pi03:~/github/ArduiPi_SSD1306/examples# make
          g++ -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -Wall  -lssd1306 ssd1306_demo.cpp -o ssd1306_demo
          /usr/local/lib/libssd1306.so: undefined reference to `i2c_smbus_write_i2c_block_data'
          /usr/local/lib/libssd1306.so: undefined reference to `i2c_smbus_write_byte_data'
          /usr/local/lib/libssd1306.so: undefined reference to `i2c_smbus_write_word_data'
          collect2: ld returned 1 exit status
          make: *** [ssd1306_demo] Error 1
          root@pi03:~/github/ArduiPi_SSD1306/examples# dpkg --get-selections | grep i2c
          i2c-tools                                       install
          libi2c-dev                                      install
          root@pi03:~/github/ArduiPi_SSD1306/examples#  dpkg --get-selections | grep lm
          lm-sensors                                      install
          root@pi03:~/github/ArduiPi_SSD1306/examples# apt-get install lm-sensors
          Reading package lists... Done
          Building dependency tree
          Reading state information... Done
          lm-sensors is already the newest version.
          The following packages were automatically installed and are no longer required:
            libblas3gf liblapack3gf
          Use 'apt-get autoremove' to remove them.
          0 upgraded, 0 newly installed, 0 to remove and 14 not upgraded.
          root@pi03:~/github/ArduiPi_SSD1306/examples# make clean
          rm -rf ssd1306_demo teleinfo-oled
          root@pi03:~/github/ArduiPi_SSD1306/examples# cd ..
          root@pi03:~/github/ArduiPi_SSD1306# make clean
          rm -rf *.o libssd1306.* /usr/local/lib/libssd1306.*
          root@pi03:~/github/ArduiPi_SSD1306# make
          g++ -Wall -fPIC -fno-rtti -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -c Adafruit_SSD1306.cpp
          ./ArduiPi_SSD1306.h:51:21: warning: ‘oled_type_str’ defined but not used [-Wunused-variable]
          g++ -Wall -fPIC -fno-rtti -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -c Adafruit_GFX.cpp
          ./ArduiPi_SSD1306.h:51:21: warning: ‘oled_type_str’ defined but not used [-Wunused-variable]
          gcc -Wall -fPIC -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -c bcm2835.c
          g++ -shared -Wl,-soname,libssd1306.so.1 -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s  -o libssd1306.so.1.0 Adafruit_SSD1306.o Adafruit_GFX.o bcm2835.o
          [Install Library]
          [Install Headers]
          root@pi03:~/github/ArduiPi_SSD1306# cd examples/
          root@pi03:~/github/ArduiPi_SSD1306/examples# make
          g++ -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -Wall  -lssd1306 ssd1306_demo.cpp -o ssd1306_demo
          g++ -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -Wall  -lssd1306 teleinfo-oled.cpp -o teleinfo-oled
          root@pi03:~/github/ArduiPi_SSD1306/examples#
          
          

          For the i2cbus detection, nothing to do with my lib, i2cdetect is a tool distribued with your linux distro.

          So to be sure I've just gone on my PI V2 to test

          root@pi01(rw):~/ArduiPi_OLED/examples# i2cdetect -y 1
               0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
          00:          -- -- -- -- -- -- -- -- -- -- -- -- --
          10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
          20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
          30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- --
          40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
          50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
          60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
          70: -- -- -- -- -- -- -- --
          
          root@pi01(rw):~/ArduiPi_OLED/examples# ./oled_demo -o 3
          x: 9y: 0dy: 3
          x: 30y: 0dy: 2
          x: 111y: 0dy: 2
          x: 81y: 0dy: 4
          x: 41y: 0dy: 2
          x: 85y: 0dy: 5
          
          

          So @Mr_Tom yes it works on Pi V2 (at least in I2C mode) but should be the same for SPI; look below

          V2-OLED.jpg

          1 Reply Last reply Reply Quote
          • Meng QiM Offline
            Meng Qi
            last edited by

            I've got the lm-sensors module in there, and the make on examples worked.

            But only still I can't get my Pi to recognize my oled screen, and I have another device on the i2c bus which works perfectly.
            I just ordered another oled (a seeed 96*96) to see if that would work.

            Thank you for your detailed reply!

            1 Reply Last reply Reply Quote
            • CharlesC Offline
              Charles
              last edited by

              Meng,

              Even if Seeed OLED will be seen, it won't work because it"s another driver in it (SSD1308) and I didn't port this one in the example code, something I wanted to do but never had time do do it.

              By the way Seeed OLED 96x96 is the best OLED I ever saw, excellent display and gray level.

              1 Reply Last reply Reply Quote
              • CharlesC Offline
                Charles
                last edited by

                Meng
                did you tried your non working OLED on an Arduino with I2CScan sketch just to see ?

                1 Reply Last reply Reply Quote
                • Meng QiM Offline
                  Meng Qi
                  last edited by

                  Hi, Charles,

                  I've tested my oled with I2CScan, and it wasn't detected... maybe a broken one. And I have another oled screen here which can be detected on Arduino, but not on Pi.

                  Here is a library by Seeed themselves : https://github.com/DexterInd/GrovePi/tree/master/Software/Python/grove_oled
                  I'll see if that would work once the oled screen arrives. Happy to know that it looks amazing.

                  1 Reply Last reply Reply Quote
                  • CharlesC Offline
                    Charles
                    last edited by

                    Meng,
                    yeah Seeed library works fine on Arduino, but not sure there is a port on Raspberry Pi

                    1 Reply Last reply Reply Quote
                    • Meng QiM Offline
                      Meng Qi
                      last edited by Meng Qi

                      This 96*96 oled screen is detected by my Pi and it is working with Seeed's own library, and it would also put out stuff while running your oled_demo.

                      Does your library has a manual? It doesn't looks like python when I peek into your library files... Sorry I am quite a beginner. Thank you.

                      I use my Pi to generate sound, and if I do oled operations within the same piece of .py file that does sound, any oled writing operations would block the sound. But if I open 2 terminal instances (I am using SSH), and run sound code on one, oled code on another, it wouldn't block the sound. So it is certainly not a CPU speed issue...

                      Why does this happen? And if I make my Pi running some python code at boot, how I can make the codes running like within multiple terminals?

                      Thank you!

                      1 Reply Last reply Reply Quote
                      • G Offline
                        gbona
                        last edited by

                        I also try to run it on RPi2 with an SPI OLED 128x64 and ran into the same problem. The program freezes in display.begin(). What can be wrong?

                        1 Reply Last reply Reply Quote
                        • CharlesC Offline
                          Charles
                          last edited by

                          Hi gbona,
                          Did you checked that your I2C oled is visible with i2cdetect ? If so does his I2C address is 0x3C ?

                          1 Reply Last reply Reply Quote
                          • B Offline
                            boik
                            last edited by

                            Hi Charles. I am trying to use your library to drive a 128x64 SPI OLED display I got from the internet. It is advertised as being SSD1106 (which I assume means SH1106). I have hacked the CS detect line of your code to force it to use SPI instead of the default I2C (this display has no CS pin). I am getting something on the display, but quite garbled.

                            Here is a video of it running your OLED_demo. https://youtu.be/bETtabNliYc

                            Are these symptoms familiar to you. Any ideas of what might need tweaking.

                            Many thanks

                            Graham

                            1 Reply Last reply Reply Quote
                            • CharlesC Offline
                              Charles
                              last edited by

                              @boik,
                              Strange, first time I see SPI oled without CS line, would you mind post a picture of the back ?

                              You're right I forgot to add SPI option for SH1106 in oled_demo.

                              1 Reply Last reply Reply Quote
                              • B Offline
                                boik
                                last edited by

                                Hi Charles,

                                [IMG]http://i68.tinypic.com/6zwsjl.jpg[/IMG]

                                Heres a pic of it running the circle, square, triangle cross demo. Just displays the bottom 8 lines of the image but at the top of the OLED.

                                [IMG]http://i64.tinypic.com/2mhbn7k.jpg[/IMG]

                                Not sure if this forum accepts IMG tags?

                                Graham

                                1 Reply Last reply Reply Quote
                                • D Offline
                                  Deennoo
                                  last edited by

                                  Hello Charles

                                  I got a freebox server out of ordre.

                                  There is a ssd1327 screen on it.

                                  If i send you the pcb pictures can you help me to find the good pin to plug it to my PI ?

                                  M 1 Reply Last reply Reply Quote
                                  • CharlesC Offline
                                    Charles
                                    last edited by

                                    @Deennoo
                                    you can post the picture on the forum, may be some other will know, because I'm not sure I will.

                                    1 Reply Last reply Reply Quote
                                    • M Offline
                                      Matthieu Laborie @Deennoo
                                      last edited by

                                      @Deennoo

                                      Hi, did you succeed getting the freebox server Oled Display work with a raspberry or Arduino? Did you find any wiring schema, or source code. I would like to reuse the whole SSD1327 and CAP1066 pad of the freebox.

                                      Regards

                                      1 Reply Last reply Reply Quote
                                      • A Offline
                                        akdracom
                                        last edited by

                                        I followed your procedures and up to the part of :

                                        git clone https://github.com/hallard/ArduiPi_OLED

                                        and received the following error message and can't go further :

                                        fatal: could not create work tree dir 'ArduiPi_OLED'.: No space left on device

                                        I am using a 8GB SD card and I think I have enough space - don't I ?

                                        I then issued df -Bm command to check space with following :

                                        Filesystem 1M-blocks Used Available Use% Mounted on
                                        /dev/root 4196M 4087M 0M 100% /
                                        devtmpfs 483M 0M 483M 0% /dev
                                        tmpfs 487M 0M 487M 0% /dev/shm
                                        tmpfs 487M 7M 481M 2% /run
                                        tmpfs 5M 1M 5M 1% /run/lock
                                        tmpfs 487M 0M 487M 0% /sys/fs/cgroup
                                        /dev/mmcblk0p6 63M 20M 44M 31% /boot
                                        tmpfs 98M 0M 98M 0% /run/user/1000

                                        Am I running out of memory or what, please advise - thanks

                                        1 Reply Last reply Reply Quote
                                        • A Offline
                                          akdracom
                                          last edited by

                                          I forget to mention that in my SD card - I also have installed a media player OS (OpenElec) in addition to the Raspian OS

                                          1 Reply Last reply Reply Quote
                                          • CharlesC Offline
                                            Charles
                                            last edited by

                                            @akdracom
                                            your're missing space on SD card 100% on /dev/root, you're SD seems to be formatted to 4GB

                                            May be trying raspiconfig and select the menu to expand filesystem to use full SD Size (8GB) will help

                                            1 Reply Last reply Reply Quote
                                            • First post
                                              Last post

                                            3

                                            Online

                                            5.7k

                                            Users

                                            534

                                            Topics

                                            5.0k

                                            Posts

                                            Top Topics

                                            • Denky 4 - Domoticz - Triphasé -
                                              Nicolas BernaertsN
                                              Nicolas Bernaerts
                                              0
                                              7
                                              249

                                            • Denky D4 et Linky Standard TInfo Rx Non Configuré
                                              CharlesC
                                              Charles
                                              0
                                              5
                                              282

                                            • CC1101
                                              CharlesC
                                              Charles
                                              0
                                              2
                                              117

                                            Popular Tags

                                            teleinfo
                                            24 topics
                                            arduino
                                            19 topics
                                            remora
                                            16 topics
                                            esp8266
                                            10 topics
                                            arduipi
                                            10 topics
                                            wifinfo
                                            7 topics
                                            raspberry
                                            7 topics
                                            broadcast
                                            7 topics
                                            Copyright © 2022 Charles-Henri Hallard | Return to blog page | Powered by NodeBB