#21 Two Equal Displays on One Arduino I2C Bus (Tutorial)

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ก.ย. 2015
  • In the previous tutorial I showed how to connect several devices to the same I2C bus. All devices had to be different (different sensors, different displays):
    • #20 Tutorial: Multiple...
    Here I show how you can connect two devices of the same kind to one I2C bus.
    This needs a few steps more.
    I use two Heltec SSD1306 OLED displays and a BMP085 for the demonstration.
    The content can be also used for ESP8266 or for STM32 Boards like the Maple Mini.
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 97

  • @-MrDontCare-
    @-MrDontCare- ปีที่แล้ว +6

    Looks like I am 7 years late to this game. 😂Great video, now I can use both of my screens.

    • @AndreasSpiess
      @AndreasSpiess  ปีที่แล้ว +1

      Some problems do not go away ;-)

  • @yuchoy1
    @yuchoy1 7 ปีที่แล้ว +4

    This was very helpful to me, even though I am using a Nodemcu Lua devkit! I am using the cheap generic OLED displays from Ebay, but needed info on using two of them on I2C bus. Thanks!

  • @XerotoLabs
    @XerotoLabs 8 ปีที่แล้ว

    very nice , and though not the topic , i like how you hold the small OLED . I never thought to use my extra hand stand that way .

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว

      +XerotoLabs I am a lazy guy by birth! So I always search simple solutions...

  • @countcustoms7134
    @countcustoms7134 6 ปีที่แล้ว +1

    Great work Andreas, This is exactly what I was looking for

  • @jackisgoofingoff5510
    @jackisgoofingoff5510 7 หลายเดือนก่อน +2

    Is it possible to drive the third screen? Or shall I use SPI communication instead?

  • @ehsankeshtgar6734
    @ehsankeshtgar6734 8 ปีที่แล้ว

    very useful and informative. Thanks

  • @alphonsesynrem28
    @alphonsesynrem28 5 ปีที่แล้ว

    Just excellent guide and tuition for me. Thank you so much.

  • @DanielBos
    @DanielBos 8 ปีที่แล้ว +3

    The I²C address on the OLED isn't doubled, rather each I²C device has two addresses, one for reading, one for writing.
    To be precise, the address 0x3C is a 7-bit address. When you communicate, an 8th bit is added to indicate the direction, resulting in 0x78 and 0x79 addresses on the bus.

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว

      +Daniel Bos You are right, the 8th bit is used to indicate direction.Usually you do not have to care about it because the library knows this, too. This is, why the scanner sketch only shows one address per module.

  • @kevorkarackellian389
    @kevorkarackellian389 5 ปีที่แล้ว +1

    Another great video! Thank you.
    Would you consider adding your sketches in the future as an aid to some of us with limited programing experience? It helps me a lot to see how others code - especially if comments are included in the sketch.
    Thank you again for your work. It is a lot of effort and greatly appreciated.

    • @AndreasSpiess
      @AndreasSpiess  5 ปีที่แล้ว

      If there is anything to share you find the link in the description of the video. But not always ;-)

  • @anthonyminiaci80
    @anthonyminiaci80 5 ปีที่แล้ว +1

    Hi, have you gotten this project to run in full resolution? I have done this but only in 128 x 32, when you try to run it in 128 x 64 it stalls and flashes between the 2 oled screens

  • @tristunalekzander5608
    @tristunalekzander5608 4 ปีที่แล้ว

    This is helpful if I wanted to do the exact same thing you are doing otherwise I still have no idea how to tell my Arduino how to find my devices by their addresses.

    • @AndreasSpiess
      @AndreasSpiess  4 ปีที่แล้ว

      There are many tutorials on using I2C on Arduino

    • @tristunalekzander5608
      @tristunalekzander5608 4 ปีที่แล้ว

      @@AndreasSpiess I know and they're all like yours lol turns out, I'm a noob and I didn't even need to specify the addresses of my devices because they already do that in their libraries so it was just a matter of setting up the I2C bus. Though I am still confused about pull-up resistors.

  • @1larrydom1
    @1larrydom1 6 ปีที่แล้ว +1

    Andreas, thank you for the great video! I am trying to connect 10 identical 20x4 lcd displays to an Arduino to show the exact same information. I am not sure yet how to do this with I2C, but think it can be done after watching your video. Any ideas? Larry

    • @AndreasSpiess
      @AndreasSpiess  6 ปีที่แล้ว +1

      Just try it with an increasing number. Then, you see, if you will experience problems. But you have to solve the problem of addressing. Most displays only support 2 addresses.

    • @daisydomic
      @daisydomic 5 ปีที่แล้ว

      Where is the problem? If all should show the same then all connect to the same pins. Make sure that it is enough for everyone.

  • @bluedeath996
    @bluedeath996 7 ปีที่แล้ว +1

    The 128x32 OLEDS I have don't appear to have anything to change the address, is there something I can bodge wire or a software solution?

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว

      Mine have an address selector on the back where you can change the address with a soldering iron

  • @larryfostano6626
    @larryfostano6626 2 ปีที่แล้ว

    Is it possible for a SSD1306 to get locked out and not display? Reason I ask is because I had a 1306 OLED working , I removed it and reinstalled it in a different Arduino nano , it no longer will display. I have checked the back of the display and there is a 662 voltage regulator on it , checking with a volt meter and 5vdc applied ,I get 5vdc to the top center and 3.3 to the lower pin and also ground. I checked the D1 with a Fluke meter and I get.535v in one direction and 1.88 v in the other direction.Thank you

    • @AndreasSpiess
      @AndreasSpiess  2 ปีที่แล้ว

      I do not think that these OLEDs have any memory to stay locked after a power-cycle. So you either have a wrong sketch, a wrong connection, or a defective OLED. Just move it back to where it worked or replace ii with a different one and you will know if the OLED is defective.

  • @ThomasPalowitchSr
    @ThomasPalowitchSr 7 ปีที่แล้ว

    Nice. Short & sweet.

  • @jeophilip4353
    @jeophilip4353 6 ปีที่แล้ว

    Can i use this TCA9548A 1-to-8 I2C multiplexer for connecting 4no.s of mpu-6050 to an Arduino?

    • @AndreasSpiess
      @AndreasSpiess  6 ปีที่แล้ว

      Maybe. But I assume the libraries do not work anymore. You can connect 2 6050 (you can choose between 2 addresses)

  • @ennaiarindhal3141
    @ennaiarindhal3141 3 ปีที่แล้ว

    Can you share circuit diagram for two flow sensors and two oled connect in same nodemcuesp8266???? Help me

    • @AndreasSpiess
      @AndreasSpiess  3 ปีที่แล้ว

      I am a TH-camr and not a consultant :-(

  • @JshDav
    @JshDav 5 หลายเดือนก่อน

    Does this only work with the Adafruit_SSD1306 library?
    I purchased some 1.54" OLEDs based off CH1116 (Advertised as SSD1309 on the listing) and I have only been able to control them using the Adafruit_SH1106G library so far.
    This is fine and I can address both of my screens set to different addresses separately, but as soon as I have both display1 and display2 initialized the screens just spit out garbage... I've been looking at a whole lot of example code and trying lost of different variations and it works if I have either screen commented out but just wont play ball with both... It's doing my head in 😅

    • @JshDav
      @JshDav 5 หลายเดือนก่อน

      #include
      #include
      #include
      #define SCREEN_WIDTH 128
      #define SCREEN_HEIGHT 64
      #define OLED_RESET -1
      Adafruit_SH1106G display1 (SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET)
      Adafruit_SH1106G display2 (SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
      void setup() {
      display1.begin(0x3c, true);
      //display2.begin(0x3d, true);
      display1.display();
      //display2.display();
      delay(2000);
      display1.clearDisplay();
      display1.setTextColor(1);
      display1.setTextSize(1);
      }
      void loop(){
      display1.println("test");
      display1.display();
      delay(1000);
      }

    • @AndreasSpiess
      @AndreasSpiess  5 หลายเดือนก่อน

      1. Does the lcode work witth one display only?
      2. Did you change the address of the second display (soldering)?

    • @JshDav
      @JshDav 5 หลายเดือนก่อน

      Yes I changed the address of the second screen and without making any wiring changes I can successfully address either screen, but when try to use both at the same time they both stop working @@AndreasSpiess

    • @AndreasSpiess
      @AndreasSpiess  5 หลายเดือนก่อน

      @@JshDav So it must be the library. Maybe you open an issue on their project?

  • @moisesramirez7963
    @moisesramirez7963 7 ปีที่แล้ว

    Excuse me, i have been working on a project and now i need to connect two BMP 180 to the same I2C bus.
    How can i change the addresse?
    Thanks!

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว +2

      The BMP180 has a unchangeable address. So, you can only attach one to your I2C bus. Ot you have to use I2C multiplexing. But then, the libraries will not work anymore.

    • @moisesramirez7963
      @moisesramirez7963 7 ปีที่แล้ว +1

      :( Is there any problem if i connect one BMP180 and one BMP280?
      Thanks

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว +1

      +Moisés Ram if they do not have the same address and if the libraries work together, this should work.

    • @ritzrocks98
      @ritzrocks98 5 ปีที่แล้ว

      I am stuck in the same problem. +Moisés Ram , Did you find an alternative to it? I have already bought two BMP 180, didn't know if this will ever be the problem

  • @avejst
    @avejst 6 ปีที่แล้ว

    Thanks for sharing 😀👍

  • @felixbaum2180
    @felixbaum2180 5 ปีที่แล้ว +1

    I have to use 4 of the same sensors at once... How do i do that?

    • @AndreasSpiess
      @AndreasSpiess  5 ปีที่แล้ว +1

      Maybe you can change the address of the chip? otherwise, you have to use an I2C switch like the TCA9548A

  • @Legantmar
    @Legantmar 7 ปีที่แล้ว

    This displays have only two different adress ?
    How can I connect 5 dispalys OLED I2C to arduino ?

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว

      You can use something like that: learn.adafruit.com/adafruit-tca9548a-1-to-8-i2c-multiplexer-breakout/overview

    • @Legantmar
      @Legantmar 7 ปีที่แล้ว

      thank you Andreas!
      it is nice idea

    • @KunalGautam
      @KunalGautam 6 ปีที่แล้ว

      Thank you Andreas, this is what I was looking for. TCA9548a

  • @umaxr1
    @umaxr1 7 ปีที่แล้ว

    where do the pins of scl and sda of the oled go????

    • @AndreasSpiess
      @AndreasSpiess  7 ปีที่แล้ว

      to the SDA/SCL pins of the Arduino

  • @ennaiarindhal3141
    @ennaiarindhal3141 3 ปีที่แล้ว

    Wiring diagram for two oled display in esp8266??

  • @FusselCNC
    @FusselCNC 4 ปีที่แล้ว

    Kann man auch 2 Unterschiedliche Oleds ansteuern? hab leider 0,91" oleds erwischt ohne Bus Jumper :(

    • @AndreasSpiess
      @AndreasSpiess  4 ปีที่แล้ว

      Wenn beide die gleiche Adresse haben brauchst du zwei I2C Busse. Ein ESP32 hat das, sonst musst du mach „I2C Expander“ suchen

    • @FusselCNC
      @FusselCNC 4 ปีที่แล้ว

      @@AndreasSpiess ok, danke dir :) werd mal danach schauen.

  • @TaufikMasruri
    @TaufikMasruri 4 ปีที่แล้ว

    can i use 1 esp and display to 3 OLED display? thanks

    • @AndreasSpiess
      @AndreasSpiess  4 ปีที่แล้ว +1

      Why not? It also can use I2C

    • @TaufikMasruri
      @TaufikMasruri 4 ปีที่แล้ว

      @@AndreasSpiess did you mean can do it without other module (TCA9548A, base other comment of this video)?

  • @CrazyCoupleDIY
    @CrazyCoupleDIY 6 ปีที่แล้ว

    Awesome, thats exactly what i was after

    • @AndreasSpiess
      @AndreasSpiess  6 ปีที่แล้ว

      :-)

    • @CrazyCoupleDIY
      @CrazyCoupleDIY 6 ปีที่แล้ว +1

      Just one question,
      How can I attach more than 2
      Should I use the PCF8574P or is there any other way to achieve this

  • @paralysekid
    @paralysekid 5 ปีที่แล้ว

    Thank you so much

  • @87Edvin
    @87Edvin 6 ปีที่แล้ว +1

    Do you have the source code, I would like to take a look. Thanks

    • @AndreasSpiess
      @AndreasSpiess  6 ปีที่แล้ว

      I do not have a source code, but I think, you can build your own sketch by adding the few lines of code shown in the video.

    • @87Edvin
      @87Edvin 6 ปีที่แล้ว

      Andreas Spiess I was more interested to see how you read the data from the i2c sensor and send it to the displays. Thanks

  • @stevemke
    @stevemke 8 ปีที่แล้ว

    Is the code for this demo available?

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว +2

      +stevemke I put it on Github:
      github.com/SensorsIot/Two-OLEDs-on-the-same-I2C-Bus

  • @TaniaKisha
    @TaniaKisha 2 ปีที่แล้ว

    What if no resistor at all?

    • @AndreasSpiess
      @AndreasSpiess  2 ปีที่แล้ว

      Usually this is not a good idea because the device will select one of the two address (and maybe even change it from time to time)

  • @quocna0211
    @quocna0211 4 ปีที่แล้ว

    I need the code to connect the slaves. i am so glad when you send me the code

  • @grisse333
    @grisse333 4 ปีที่แล้ว

    Und wie macht man 2 LCD mit einem Raspberry Pi ? Bitte

    • @AndreasSpiess
      @AndreasSpiess  4 ปีที่แล้ว

      Keine Ahnung. Noch nie versucht.

  • @Dr.supervillain
    @Dr.supervillain 2 ปีที่แล้ว

    wish i could do this without desodering. i'll have to use a multiplexer

    • @AndreasSpiess
      @AndreasSpiess  2 ปีที่แล้ว

      Also a good possibility if your library supports it.

  • @GemGamerYT
    @GemGamerYT 5 ปีที่แล้ว

    Bruh you saved my ass

  • @prmajiq
    @prmajiq 5 ปีที่แล้ว

    where is the source

    • @AndreasSpiess
      @AndreasSpiess  5 ปีที่แล้ว +1

      There is none.

    • @prmajiq
      @prmajiq 5 ปีที่แล้ว

      @@AndreasSpiess github.com/SensorsIot/I2C_1-Video

  • @a6ustin1990
    @a6ustin1990 8 ปีที่แล้ว

    You should check out your thumb with a doctor.

    • @AndreasSpiess
      @AndreasSpiess  8 ปีที่แล้ว +1

      +Agustín Martínez I am glad that I still have it because it was nearly ripped-off my hand because it came between the chain and the cogwheel of my motor cycle. So, I have to live with it.

  • @MrSasha3050
    @MrSasha3050 6 ปีที่แล้ว +1

    Nothing helpful 😎, only 2 displays. If you try to make it with 4 or 6 displays thinking it will be great.

    • @AndreasSpiess
      @AndreasSpiess  6 ปีที่แล้ว

      Thanks for your feedback.

    • @kaoshavoc
      @kaoshavoc 6 ปีที่แล้ว

      You can always use one of several other communication types to lots of displays. Such as SPI. Or even using shift registers to communicate with many displays.