Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 20 of 20

Thread: seeed OLED library

  1. #1
    Junior Member
    Join Date
    Nov 2018
    Posts
    6

    seeed OLED library

    Hello,

    I am a beginner trying to get this oled display work on a teensyLC :
    http://wiki.seeedstudio.com/Grove-OL...play_0.96inch/
    Click image for larger version. 

Name:	Grove-OLED-0.96.png 
Views:	5 
Size:	210.5 KB 
ID:	15250

    The SeeedOLED.h seems not to work, as the example programs won't work.
    https://github.com/Seeed-Studio/OLED_Display_128X64

    One curious thing is that it is not needed to declare the SCL SDA pins attached to the device.

    Thank you for your ideas or advice!

  2. #2
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,774
    If you tell us what exactly does not work...
    Compiling? Hardware? It seems to be for the 5 V Arduinos..and has levelshifters..no I2C Pullups.How is it connected?

  3. #3
    Junior Member
    Join Date
    Nov 2018
    Posts
    6
    Thank you for your answer!
    It is compiling fine, I added some code to print on serial and this works ok, only the OLED part doesn't work. Nothing is displayed.
    I have put the voltage of the OLED on the "5V" pin, and powered the Teensy LC by usb
    I haven't put any resistor, should I?

  4. #4
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,069
    Arduinos have integrated pull-up resistors on the SCL and SDA lines. Teensys don't. You have to terminate the I2C bus externally.

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,691
    Maybe it has 10K resistors? Found this schematic, but had to click a few links on Seeed's site, so not 100% sure if this is really the right schematic for that product.

    https://github.com/SeeedDocument/Gro...SD1308_1.0.pdf

    @DavidDC - to help you, we really need to see a photo of how you've actually connected the wires.

  6. #6
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,774
    I think it's this one - indeed there are 10k pullups on the 3v3 side.
    https://github.com/SeeedDocument/Gro...8x64_v0.9b.pdf
    The "5V" side (3v3 from teensy on I2C) does not need to have pullups ? I learned something...

    edit: err, no, there is a label "+5V".. did not see it.. so there are pullups to +5V

    The Teensy LC is NOT 5V tolerant :-(
    Can you load the BLINK-Sketch to test if it works ?

  7. #7
    Junior Member
    Join Date
    Nov 2018
    Posts
    6
    Hello,
    Here is the wiring :
    Click image for larger version. 

Name:	Schematic01-SEEED OLED.jpg 
Views:	6 
Size:	78.0 KB 
ID:	15264

    And here is the code used :

    #include <Wire.h>
    #include <SeeedOLED.h>

    void setup()
    {
    Wire.begin();
    SeeedOled.init(); //initialze SEEED OLED display

    SeeedOled.clearDisplay(); //clear the screen and set start position to top left corner
    SeeedOled.setNormalDisplay(); //Set display to normal mode (i.e non-inverse mode)
    SeeedOled.setPageMode(); //Set addressing mode to Page Mode
    SeeedOled.setTextXY(0,0); //Set the cursor to Xth Page, Yth Column
    SeeedOled.putString("Hello World!"); //Print the String
    }

    void loop()
    {
    Serial.begin(9600);
    Serial.println("Hello World");
    delay(1000);
    }

    And the blink sketch works fine

  8. #8
    Junior Member
    Join Date
    Nov 2018
    Posts
    6
    Quote Originally Posted by Theremingenieur View Post
    Arduinos have integrated pull-up resistors on the SCL and SDA lines. Teensys don't. You have to terminate the I2C bus externally.
    Could you tell me how to wire the termination of the i2C bus and the value of the resistance? Thank you !
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	ds18b20-copia.jpg 
Views:	3 
Size:	23.5 KB 
ID:	15276  

  9. #9
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,069
    You need 2 resistors, 1 from SDA to +3.3V and one from SCL to +3.3V. 3k3 for both would be a good starting point.

    Lesson for advanced readers:
    The optimal termination resistance of an I2C bus depends on the bus capacitance and inductance. If the bus capacitance and the termination resistor values are both high, the signal ramps (transitions from low to high or from high to low) might take too much time, lead to timing conflicts and increase the power dissipation in the I2C drivers. If the bus inductance is high, "ringing" might occur with too high or with too low termination. That means that voltage peaks even above the allowed voltages might theoretically occur and the ramp timing will be imprecise again, just to cite a few typical examples of what can go wrong.
    The professional way of designing an optimal I2C bus termination is to build a prototype with an average resistor value (1kOhm/Volt) and with a wiring length, inductance, and capacitance similar to the planned PCB layout in mass production (thus taking parasitic copper stripe capacitances and inductances into account). Then to look at the SDA and SCL signals with an oscilloscope and modifying the resistor values until you observe the most clean waveforms with quick ramps but without ringing.

  10. #10
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,774
    if the linked schematic is correct, there are 10k resistors to 5v.

  11. #11
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,069
    If I understood well, he is using a Teensy LC. Thus using pull-up resistors to +5V might damage the Teensy.

  12. #12
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,774
    yes. the current is not high, it might survive that(??) but I don't know how to get that working - additional levelshifters? that would mean 3v-5v-3v.

  13. #13
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,774
    i'd remove the onboard levelshifters.

  14. #14
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,069
    Quote Originally Posted by Frank B View Post
    yes. the current is not high, it might survive that(??) but I don't know how to get that working - additional levelshifters? that would mean 3v-5v-3v.
    Best would be to drop that display as it is clearly designed for 5V Arduinos and look for a 3.3V compatible one (starting from 4$ on eBay...). Besides of that, the integrated level shifters on this display using series MOS transistors are incredibly slow and imprecise. If I'd be forced to stay with exactly that display, I'd unsolder R1 to R4 and Q3, Q4 and connect directly to LSDA and LSCL with 3.3k resistors towards 3.3V.

  15. #15
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,774
    David, the last picture you have posted is OneWire bus, not I2C. Dont try to add more resistors to 5v.

  16. #16
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,069
    Quote Originally Posted by Frank B View Post
    i'd remove the onboard levelshifters.
    Synchronicity...

  17. #17
    Junior Member
    Join Date
    Nov 2018
    Posts
    6
    Quote Originally Posted by Theremingenieur View Post
    You need 2 resistors, 1 from SDA to +3.3V and one from SCL to +3.3V. 3k3 for both would be a good starting point.
    Thank you! I will try that and post the result.

  18. #18
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    2,828
    You might try the Adafruit SSD1306 library that is included in the Teensy release:


    You would need to edit the hardware/teensy/avr/libraries/Adafruit_SSD1306/Adafruit_SSD1306.h file to change the size of the display to 128x64:

    Code:
       #define SSD1306_128_64
    // #define SSD1306_128_32
    I've not used the Seeed OLED display. The OLED displays I've used from Adafruit and Dig-ole both worked with 3.3v input. So you might try hooking it up to the 3.3v power and ground.

    Run the Examples -> Wire -> Scanner program, and see if it finds the device. If it doesn't, then you need to investigate adding 2 separate pull-up resistors, one between SCL (19/A5) and 3.3v and the other between SDA (18/A4) and 3.3v. Typically you would want 2.2K resistors, but you could use the 4.7K resistors used in 5v systems (as I understand it, if you have the higher resistors, you might not be able to run the i2c bus at higher speeds, but the default speed should work).

    If it doesn't work, you likely need to use level shifting up to 5v. For i2c, you want level shifting that goes both ways. Some level shifters to consider include:


    Or alternatively get a display that works with 3.3v. An alternative connection technology is SPI. It uses different pinouts, but it doesn't need pull-up resistors:
    Last edited by MichaelMeissner; 12-03-2018 at 04:12 PM.

  19. #19
    Junior Member
    Join Date
    Nov 2018
    Posts
    6
    I tryed all of the solutions proposed, it still doesn't work...
    Either the display is damaged or not fitted for this puspose.
    I will go for a proper oled display based on SSD1306

    Thanks to you all!

  20. #20
    Senior Member
    Join Date
    Oct 2015
    Location
    Roma (IT, EU)
    Posts
    107
    With the LC, I use this one ("AZDelivery")
    https://www.amazon.it/AZDelivery-Dis...s=oled+ssd1306

    with SSD1306 library (included with Teensyduino).

    Works a treat.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •