Sweet tutorial! Really like the illustrations that went along with your explanation. After looking at a few cool project videos where people are using Arduinos and other microcontrollers, it makes me wish my college had a class on these!
Macha, I am a big fan of your channel. Macha I think u did a mistake .......in the tinkercad sample which u have shown in the video .....both the power supply are connected to ground.......Shouldn't the VCC one connect to 5v power supply? btw lots of luv from India ❣
Bravo pour cette explication detaillé. Care, stvarno si precizno i ukratko objasnio IIC. Jedino sto fali po meni je kako prelazis sa 8 bitnog adressiranja na 10-to bitno adressiranje
I believe you could get way more components on the lines if you went to a 4 carrier freq using OFDM platform and using a simple B QPSK to create your binary. I've done this with PLC designs with the IPL0201 MPU. We used a balun coil and passive phase filters .01uf capacitor to reduce the 120 hz signal noise from the AC line and we transmitted the signal 12 miles on a 7620 powerline. We've been doing PLC 2 wire transmissions for decades now. I'm surprised they are just now getting around to it with arduino.
I want to read 8 rotary encoders simultaneously. Each encoder is a quadrature encoder with 2400 counts per revolution. Two interrupt pins are required to read the direction and position of each encoder. In total, I require 16 interrupt pins. But Arduino mega has only 6 interrupt pins. Should I use 2 Arduino mega as slave and 1 Arduino as Master in I2C communication ? Will this alternative work ? Is there any easy alternative to this problem
Thank you very much about this tutorial , But could you help me ? I have a question, Can any modules use I2C ? In my case , they are module sim800 and DFplayer mini module ? Sorry because my English grammar is not good :))
This is one of the only videos I've found that explains how pull up resistors can affect the speed at which data can travel on the SDA line. Fantastic video that explains how I2C works. Great job.
i know its an old video and you probably already know that but you can shorten the Serial.print commands to one like this: Serial.print(String("X0= ") + (X0) + ("X1= ") + (X1)); then when the numbers are bigger or shorter it will automatically fit them together
Bro thats not a big deal he is also a human and if he has done any mistake that does not matter because if you have used arduino or any other types of microcontroller in past u can correct the connections easily
@Blondie SL Dark matter....hmmmm I once cut open a dead flashlight battery and found it to be very dark, black as coal in fact. I just figure it got full of the dark that it was displacing with light, and died when it got full. :)
To clarify; the I2C lines are either high impedance or 0, you never drive the bus line high directly; that is achieved by de-asserting the '0' and letting the internal pull up resistors tie it to Vcc. The high impedance or low state on the bus prevents bus contention; that is a ground connecting to Vcc directly causing a short between any masters or slaves.
I hope you enjoyed this video and learned something new! If you'd like to support me making more content like this, please consider supporting me on Patreon: www.patreon.com/howtomechatronics
There is an error at the circuit diagram. Instead of 5V you're connected to a GND. However, thank you so much, I learnt a lot from your wonderful video. Merry Christmas
Like all of your videos, also this one is very educational. Thanks for uploading!! But how do you approach the problem if you want to transfer 128 bytes from a slave node to a master (e.g. Arduino or Teensy)? Do you know of any link that might help me with a code fragment?
Master put address to I2C bus. Then corrosponding slave identify and match with his own address . Then slave say Hi to master ( send ACK to master) How slave match address which is send by master . Which register compare received address and its own address . Thanks.
Google tells me that this video is in English. 52 years using English as a primary language and being a native English speaker I am fully qualified to point that Google is a liar, liar with pants on fire. This video is definitely nor in English. Epic AI fail, Google.
I really wish this video had been available when I first tried learning this protocol, it took ages wading through Datasheets and writing the code in assembler with no library! Without an Oscilloscope I would never have got it to work . Happy days ...Not.
What if I want to have two same sensors, which will have same I2C address right? I'm planning on building a weather station, which has one HDC1080 for measuring indoor temp and humidity, and one HDC1080 for outdoor.
Great video!! In pi pico we have I2C0 in Gp0 and gp1 and also in GP16 and GP17 What is the potential use of such configuration And do they have the same bus internally ?
With the gy521/MPU6050, how is all of the data able to be transferred with only one register (0x68)? does this component always transmit all of its data or can I request that it only send certain information?
1. honest: Good explanation 2. “Good old old times”, when people had no issue using slavery terms in technology, which are associated with hundreds of years of murder, torture, rape and suffering. 😢
There are a lot of Tubes about I2C but none of them make note of the fact that I2C is an abbreviation of Inter IC Communication, it was invented by Philips to help reduce the amount of communication tracking between IC's on a PCB, consequently it is a reliable communication system when used over short distances in a controlled environment, a PCB, but it was never intended to be sent overlong pieces of wiring (>200mm?). If you use this to connect to devices over long lengths of wire, especially if there are noisy items around like motors etc, be prepared for random communication problems.
i tested every library and sketch i could find. Nada. One guy said wire.h is incompatible with the chip of the mkr wifi 1010 board but i don't get why or how to fix it. All i2c tutorials use something that depends on wire.h or comes from it. If the board has dedicated i2c pins there gotta be a way to use them. I put the pins as shown in every tutorial, i don't think 2 accelerometers came already broken
Dejan, I was looking through youtube for a decent tutorial about the I2C bus as implemented on the Arduino. I have a class of high school students who could use a good demo. I didnt expect to find your EXCELLENT tutorial, one that would be useful even to professional electronics engineers. I wanted to let you know you did a nice job, and it was appreciated. Dr. Michael Vogt - North American Robotics
In the circuit diagram at 6:00, I notice GND is connected to the red and blue rail. Is this accurate or am I missing something? I thought I2C was active low? Was this a mistake in the wiring diagram?
What about if I want to use two of the same sensors? The adresses and register adresses will be the same? How can I store the informations which I got from both sensors?
Watched many videos on this protocol I was never able to grab the concept clearly and I found your tutorial and it made my life simple . Thanks man u have explained and visualised the concept neatly .
2 hours of reading and then here comes this video where everything is well explained in under 10 minutes... You tube is spoiling me...
Sweet tutorial! Really like the illustrations that went along with your explanation. After looking at a few cool project videos where people are using Arduinos and other microcontrollers, it makes me wish my college had a class on these!
Dejan Nedelkovski
it's been 8 years now or so, are you still alive bud, and did you learn this arduino and microcontrollers stuff. Anyways, hope you are doing good
Awesome video! I especially appreciated the protocol/packet breakdown. Thanks very much!
What a great video! Very clear explanation and simple demonstration on how to use it.
Thank you very much.
Thank you for this tutorial! I knew the overview of how i2c works but not the specifics. It looks similar to packets in TCP/IP.
In the breadboard diagram at 5:56 both the + and - are connected to ground on the Arduino
Macha, I am a big fan of your channel. Macha I think u did a mistake .......in the tinkercad sample which u have shown in the video .....both the power supply are connected to ground.......Shouldn't the VCC one connect to 5v power supply? btw lots of luv from India
❣
Brilliant, and exceptional narration.
Thank you. It's simple to comprehend
Great video, really appreciate it! But I really think that explaining every line of the code would've been great!
It's incredible that you can communicate with so many different devices using only 2 wires. also, the 2 SAME wires.
It saved me so much time and hassle. Good job!
Thank you brother, you help me a lot in my projects
This is fantastic! Sharing on Mondays live show. Great vid. Cheers!
Thanks! I didn't want to memorize it, but to understand it and it worked! :)
Nice explanation... the protocol I2c is very usefull, fast and need... Thank's for your time and information.
SUPERB WORK MAN!
very nice explained !
Man I don't know if it's the weed, but your explanation made me understand most of this very clearly
Verywell explained, clear, direct to the point, Thank you...
Fantastic. Apreciate your effort.
Bravo pour cette explication detaillé.
Care, stvarno si precizno i ukratko objasnio IIC.
Jedino sto fali po meni je kako prelazis sa 8 bitnog adressiranja na 10-to bitno adressiranje
Perfect explanation. Thank you.
ΤΗΑΝΚ ΥΟU.. ! A VERY CLEAR EXPLANATION OF i2C DEVICES
I'm telling that, it will be very useful for novice because I'm novice.
Thank You!
Amazingly well explained!
I believe you could get way more components on the lines if you went to a 4 carrier freq using OFDM platform and using a simple B QPSK to create your binary. I've done this with PLC designs with the IPL0201 MPU. We used a balun coil and passive phase filters .01uf capacitor to reduce the 120 hz signal noise from the AC line and we transmitted the signal 12 miles on a 7620 powerline. We've been doing PLC 2 wire transmissions for decades now. I'm surprised they are just now getting around to it with arduino.
Sounds pretty .. 🤓
Great video
Awesome tutorial
Amazing video sir!! You are brilliant :))
great video!! thanks!!
nice explanation
ur welcome
6:05 the power and ground wires (red and black) are both connected to ground on the mega?
Can you please make a comparision video on I2c, 485 and 232??? Thanks
thanks
Congratulations very good explanations. I'm subsribe.
Thanks!
Great!, Thank you for the contribution.
dejan you are great.. thankx buddy :)
Muito bom este tutorial, parabéns.
great Video
What if you have one i2c component that HAS a pull-up resistor and another i2c which requires a pull-up?
Great video. New subscriber here.
awesome!
I want to read 8 rotary encoders simultaneously. Each encoder is a quadrature encoder with 2400 counts per revolution. Two interrupt pins are required to read the direction and position of each encoder. In total, I require 16 interrupt pins. But Arduino mega has only 6 interrupt pins. Should I use 2 Arduino mega as slave and 1 Arduino as Master in I2C communication ? Will this alternative work ? Is there any easy alternative to this problem
Wow, 1024 devices on 10 bit addressing...cool.
Thank you very much about this tutorial , But could you help me ? I have a question, Can any modules use I2C ? In my case , they are module sim800 and DFplayer mini module ?
Sorry because my English grammar is not good :))
This is one of the only videos I've found that explains how pull up resistors can affect the speed at which data can travel on the SDA line. Fantastic video that explains how I2C works. Great job.
Great video
Thanks!
super, really appreciate for the tutorial. Request similar other Serial protocols SPI explanation. CAN, UART. thanks
The bit sequence was so well explained that I had to print the screenshot of it for future reference.
Very useful for beginner like me, thank you! :)
i know its an old video and you probably already know that but you can shorten the Serial.print commands to one like this:
Serial.print(String("X0= ") + (X0) + ("X1= ") + (X1)); then when the numbers are bigger or shorter it will automatically fit them together
6:00 just a headsup: You have the Arduino connected to two GNDs, with no 5V line.
Yes, that bothered me too.
@Blondie SL the white race needs you to make blond haired blue eyed babies. Stop being a degenerate and man up.
Bro thats not a big deal he is also a human and if he has done any mistake that does not matter because if you have used arduino or any other types of microcontroller in past u can correct the connections easily
@Blondie SL Well that escalated quickly.
@Blondie SL Dark matter....hmmmm I once cut open a dead flashlight battery and found it to be very dark, black as coal in fact. I just figure it got full of the dark that it was displacing with light, and died when it got full. :)
Intro RIP headphones users. But great info :)
yep I almost died I swear
Same.
Guys, any idea where i can read about the Wire.h library about what it's functions do?
To the point, simple and clear, well done! which most people struggle to explain.
~This is coming from a Professional Embedded engineer.
Glad to hear it, thanks!
I always like tutorials that show how to use sensores without relying on 3rd party libraries other than the wire one. Very useful for learning.
To clarify; the I2C lines are either high impedance or 0, you never drive the bus line high directly; that is achieved by de-asserting the '0' and letting the internal pull up resistors tie it to Vcc. The high impedance or low state on the bus prevents bus contention; that is a ground connecting to Vcc directly causing a short between any masters or slaves.
I hope you enjoyed this video and learned something new! If you'd like to support me making more content like this, please consider supporting me on Patreon: www.patreon.com/howtomechatronics
I know you can get composite video out of it or something
Great tutorial mate. Just wondering is there any tutorial on how to change address on unique slave devices.
No problem. Thanks for the video anyway really helpful.
There is an error at the circuit diagram. Instead of 5V you're connected to a GND. However, thank you so much, I learnt a lot from your wonderful video. Merry Christmas
thanks, can you tell me in the program you test for Wire.available=2?
May I take a screenshot of the diagram at 3:30 for my undergraduate research paper if I cite its origin?
This is so beginner friendly! Thank you so much. I used the same illustrations to make few students understand the same. :)
Like all of your videos, also this one is very educational. Thanks for uploading!!
But how do you approach the problem if you want to transfer 128 bytes from a slave node to a master (e.g. Arduino or Teensy)?
Do you know of any link that might help me with a code fragment?
Wire.available() returns the number of availabe bytes. So the if condition should be (Wire.available() >= 2)
Master put address to I2C bus.
Then corrosponding slave identify and match with his own address .
Then slave say Hi to master ( send ACK to master)
How slave match address which is send by master .
Which register compare received address and its own address . Thanks.
Google tells me that this video is in English. 52 years using English as a primary language and being a native English speaker I am fully qualified to point that Google is a liar, liar with pants on fire. This video is definitely nor in English.
Epic AI fail, Google.
Thank you for ur very good explain. I have one quastion. Why is in Code wire.write(8) ? Can anybodd explain that fot me thank you 8:49
I really wish this video had been available when I first tried learning this protocol, it took ages wading through Datasheets and writing the code in assembler with no library! Without an Oscilloscope I would never have got it to work . Happy days ...Not.
What if I want to have two same sensors, which will have same I2C address right?
I'm planning on building a weather station, which has one HDC1080 for measuring indoor temp and humidity, and one HDC1080 for outdoor.
Great video!!
In pi pico we have I2C0 in Gp0 and gp1 and also in GP16 and GP17
What is the potential use of such configuration
And do they have the same bus internally ?
With the gy521/MPU6050, how is all of the data able to be transferred with only one register (0x68)? does this component always transmit all of its data or can I request that it only send certain information?
1. honest: Good explanation
2. “Good old old times”, when people had no issue using slavery terms in technology, which are associated with hundreds of years of murder, torture, rape and suffering. 😢
There are a lot of Tubes about I2C but none of them make note of the fact that I2C is an abbreviation of Inter IC Communication, it was invented by Philips to help reduce the amount of communication tracking between IC's on a PCB, consequently it is a reliable communication system when used over short distances in a controlled environment, a PCB, but it was never intended to be sent overlong pieces of wiring (>200mm?). If you use this to connect to devices over long lengths of wire, especially if there are noisy items around like motors etc, be prepared for random communication problems.
i tested every library and sketch i could find. Nada. One guy said wire.h is incompatible with the chip of the mkr wifi 1010 board but i don't get why or how to fix it. All i2c tutorials use something that depends on wire.h or comes from it. If the board has dedicated i2c pins there gotta be a way to use them. I put the pins as shown in every tutorial, i don't think 2 accelerometers came already broken
patatass
brocoli
verduras
tampones
supositorios para gatos
pan
silla
0,5 magdalena
Dejan,
I was looking through youtube for a decent tutorial about the I2C bus as implemented on the Arduino. I have a class of high school students who could use a good demo. I didnt expect to find your EXCELLENT tutorial, one that would be useful even to professional electronics engineers. I wanted to let you know you did a nice job, and it was appreciated.
Dr. Michael Vogt - North American Robotics
In the circuit diagram at 6:00, I notice GND is connected to the red and blue rail. Is this accurate or am I missing something? I thought I2C was active low? Was this a mistake in the wiring diagram?
400Kbps and each data is 24bits long with their addresses. it can transfer 16,666 characters or 8 bits numbers in a sec. that is fast enough.
Program get stuck at Wire.endTransmission() command. Can anyone please provide for a solution.
You said 124 devices instead of 1024 devices (0:52 min), but great video it helped me alot, thanks :))
Very good video !!! Thanks
Is it really "Wire.available()=2"?
Excellent. I thought i2c was going to be complicated
Utterly informative video much appreciation 👍
You have both VCC and GND connected to the GND on the Arduino @ 05:56. Is this a mistake?
The real takeaway is not to use I2C in the first place... at least not off board. It’s not robust enough
Eeeeh. Why RED wire inserted into Arduino GND? Isn't it must be inserted in 5V?
Very good explanation! Thank you very much.
What about if I want to use two of the same sensors? The adresses and register adresses will be the same? How can I store the informations which I got from both sensors?
absolutely brilliant @
Where do you get data sheets? I never heat any documentation with components we buy. I need a data sheet for CJVL53L0XV2.
thanks.very well explained
Glad it was helpful!
That Fritzing diagram is wrong. Red wire connects to VCC. Rest is fine.
What are pins xda, xcl and ado used for? Do you have a video on how they can be used?
thank you
Watched many videos on this protocol I was never able to grab the concept clearly and I found your tutorial and it made my life simple . Thanks man u have explained and visualised the concept neatly .
how will you know if the particular I2C device / sensor being used already has the pullup resistor in the breakout board or not?
It should be specified on the datasheet !
thank you very much fantastic explanation