I2C Communication | Detailed Tutorial | Arduino and NodeMCU ESP8266

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 เม.ย. 2020
  • Learn about I2C Communication | Detailed Tutorial | Arduino and NodeMCU ESP8266
    SDA Serial Data
    SCL Serial Clock
    The I2C protocol involves using two lines to send and receive data: a serial clock pin (SCL) that the Arduino or Genuino Master board pulses at a regular interval, and a serial data pin (SDA) over which data is sent between the two devices. As the clock line changes from low to high (known as the rising edge of the clock pulse), a single bit of information - that will form in sequence the address of a specific device and a a command or data - is transferred from the board to the I2C device over the SDA line. When this information is sent - bit after bit -, the called upon device executes the request and transmits it's data back - if required - to the board over the same line using the clock signal still generated by the Master on SCL as timing.
    Because the I2C protocol allows for each enabled device to have it's own unique address, and as both master and slave devices to take turns communicating over a single line, it is possible for your Arduino or Genuino board to communicate (in turn) with many devices, or other boards, while using just two pins of your microcontroller.
  • วิทยาศาสตร์และเทคโนโลยี

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

  • @garyhalsey7693
    @garyhalsey7693 4 ปีที่แล้ว +2

    Decent video and decent explanation of I2C. New subscriber!

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

      Thank you
      Watch other videos also
      Hope you like them too

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

    Thanks for this. Followed along and it all worked. Subscribed. I am in the process of adding WiFi to a number of old existing Arduino projects so will be using an ESP acting as a Master to poll the data to then onward transmit over WiFi to my Iphone. OK I have to level shift on 2 pins but that is far easier than replacing the Arduino with the ESP and have to change the voltages of my sensors. Thanks for posting. I liked the simple step-by-step approach, including your minor errors! All too often these videos are too fast and slick and do not give us time to follow along. We can alway playback at higher speeds if things are too slow, but not to have the detail in the first place is a mistake for many YT vids. (Just a note on the ESP8266NodeMCU you do not need to define the pins. Wire.begin(); works fine)

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

      Thanks for liking my work... Will improve using your feedback and best of luck for your project

  • @electronic7979
    @electronic7979 4 ปีที่แล้ว +3

    It was a useful and educational video.

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

    Well explained! I like it and I will now subscribe

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

    It works, thanks. But can't connect two esp8266. Both are to be connected D1-D1 D2-D2? Same sketches?

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

      Connection is correct....
      One need to have master code and other needs to have slave code

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

      Initialization of i2c in code is a little bit different
      Check it on google

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

    I have a doubt why you haven't mentioned the slave address in the master code for the communication.

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

      Yeah... That needs to be mentioned

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

    Hello Sir, i came across your video and tried to get the I2C working. I followed your instructions but nothing shows up when i open the serial monitor of the slave device (The Arduino). Any idea what could be the reason?

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

      I need to check your code before telling anything

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

      You can send me on jnstagr

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

      Instagram

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

    I wonder why should sda arduino connect to scl esp8266 ? Isn't that sda connect to sda right

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

      No... Sda to sda ... Scl to scl

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

    I have a problem when I try to Act my ESP32 as Slave Device And another device as the master. But It has error said " Multiple libraries were found for "Wire.h". How can I fix this problem?

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

      Esp32 cant be used as slave

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

      I tried it many times and read its documentation

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

      But ESP8266 Can be slave right?

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

      Yes esp8266 can ... But there is still a catch... Esp32 can't be used in master slave config as we do with Arduino

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

      Because esp32 works on twowire library... But try it and let me know if it works

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

    How can I make my Esp8266 as slave and Arduino Uno as master?

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

      You can do that easily

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

      With same process…

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

      Just upload master code in arduino and slave code in esp8266
      Make sure to use same bitrate in both

    • @HAZIEL07
      @HAZIEL07 2 หลายเดือนก่อน

      but esp only work with 3.3 voltage on yours pins, i think you need of one resistive divisor

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

    Πολύ Καλή δουλειά αλλά στο τέλος έπρεπε να έχει και ένα παράδειγμα.