Andreas is the best, I just stand in his shadow - which is a very big shadow considering that he is in Switzerland and I'm in Canada! But I do thank you for the complement.
don't do yourself short! i like your videos like the ones from andreas. I'm looking forward to your connection between a pi and an arduino. I want a (double) car-detection & aid (distance to the wall 4 my wife) in my garage directed by an pi (connecting to home-assistant) and measured with an arduino. KUTGW!
@@sledgeHammerRulez That is an interesting idea. I think I will make an arduino based ultrasonic sensor for my mom that tells her when she has pulled her car alll the way forward in the garage.
I thank you for your excellent explanation of the programs you use. You go through each and every line of code in precise detail, and that's exactly what I need. So I can't thank you enough for your attention to precise detail. Also I totally agree with "I Two C". That's perfectly acceptable and how I pronounce it too. I understand that "I Squared C" is also acceptable, but like you, I actually prefer "I Two C". Because in truth, there's nothing mathematically squared about it. You are an excellent instructor far above the norm.
Thanks Man! I am a teenager in to come in 10th, and with your help, I've made my very own I2C Keypad 4x4 Matrix and made a smart keypad door lock with it. I am going to make a PCB for that. Thanks a lot.
The readI2C() in the video isn't waiting for 100ms, it's waiting no more than 100 ms. You will break out of the while if either there is something available or you are greater than or equal to 100 ms. You then do the read only if the elapsed time is less than 100ms. The return from readI2C() is undefined if more than 100 ms occurs between the request and the waiting for a response. It only reads and sets bval if there is less than 100ms, if it is more than 100 ms you return an indeterminate value.
Outstanding tutorial. Clear, concise and fun to watch and learn. So being that I'm from Southern California you get the "woohhhoo Awesome Dude....you made I2C gnarly" award!
Very good video again! For everybody complaining about I2C or I square C, please start your own channel and do a better job. I wish you all the best but doubt you will succeed. Keep up the good work! Love IT!
Thank you Robert, it can be very dishearting to put the effort into making a video only to have some clown critize it for something as silly as "I squared C" vs "I two C". Especially when neither of them are technically correct - it's the Inter Integrated Circuit bus so it should probably be "IIC"! Maybe I should have just said "TWI" to avoid offending Mr. Perfection. I really appreciate your nice comment, hopefully there are others who feel the way you do. Thanks!
@@Dronebotworkshop the problem is that it is not possible to satisfy everybody. But nowaday it is so easy to BASH that you could be discouraged tot make this video's. Well I happen to love them andere learn a lot. Hope this helps to continue! Thanks
I truly enjoy your videos and instructional style and was pleasantly surprised to hear you mention my original favorite RU-vid teacher with the Swiss accent! The sinister part of me was waiting for you to coyly explain that the reason you decided to build a custom 4-way ultrasonic I2C sensor (unlike Mr. Spiess' 3-way sensor) is simply because 4 is clearly better than 3. Maybe zoom in to picture of two groups of puppies where 4 is clearly better than 3. No smiling, just more matter-of-fact presentation of your analysis. I'm kind of glad you didn't as I would be cleaning up a cup of coffee right now. But seriously, thank you for sharing your knowledge!
Bill - WOW! That was an amazing tutorial. I know feel confident that I could change my own sensors to be I2C items. It's like I can create a wired version of MQTT where I don't need wireless. Thank you do much for doing such a patient and well thought out tutorial.
This guy is fantastic! The two I2C vids are really good, best I’ve seen! Hoping he also does the other available interfaces...highly recommend this channel...
Hi, Bill! I just wanted to reach out and thank you personally for covering I2C, because that first episode in particular helped me learn a huge amount on the topic! I was able to massively overhaul the hardware and software of a project I'm working on for an up coming convention. I previously had an ATMega328 running animations on about 120 neopixels, while reading buttons on a control panel and polling a potentiometer for a brightness control. Since learning about I2C and how to implement two way communication between two or more microcontrollers, I've been able to use one ATMega to run the light animations, and second ATMega running the control panel. I've also been able to swap out the potentiometer for a rotary encoder AND implement IR remote functionality using a cheap slim pocket IR remote, since I learned from your videos how to use IR control in projects :) I hope you know how much you've taught people and inspired them to try new things :D Take care of yourself :) ~Azy
Simply amazing tutorial. As the newping library is available on platformio, I'm moving to visual studio code with the platformio extension instead of the arduino interface - seems a much nicer programming environment. Thanks for sharing your excellence!
andreas, the guy with the swiss accent, did an excellent video on it last sunday! I will switch also, since visual studio code is now available as addon for home-assistant as well
Awesome ! I've been using an ultrasonic sensor on a servo that sweeps left to right to avoid obstacles. The noise of the servo drive me (and many others) crazy. This solution is really silent ! Much better.
thank you! at 3:50 bit zero is mentioned, but the timing diagram shows bits one through bit N - is the diagram off-by-one - or Also it is stated "the clock signal will go high every time a data byte is sent" - perhaps sometimes you mean a single data bit?
@@vtorsi610 thanks perhaps that is what is confusing - the clock is shown clocking individual "bits", but the audio is using the word "byte" - the audio clearly shows the clock for the start "bit" - confusing use of bit and byte The wikipedia timing diagram uses the word "bit" for each clock transition - very similar image en.wikipedia.org/wiki/I%C2%B2C#Timing_diagram
When talking about sending data, you say data bytes (segment around the 4 minut mark), when I assume you mean data bits. The SDA-line can only contain one bit at a time...
Yes, this video (as your other videos) definitely inspired me to create my own master and slave I2C project. Thank you for providing the explanation and the code. :)
Many thanks for your videos. Very informative. One topic I would be interested in a video on which continues the I2C learning is whether it is possible to use I2C within an ISR (interrupt service routine). It would be useful say if a RTC (real time clock) was able to be read in an ISR as millis() does not function. This could ideally go into detail about when and how interrupts are used in I2C comms. Geoffrey, New Zealand.
Yet another really great tutorial. I did have a question about your explanation of the protocol. As you describe the data being clocked on the SDA line, you mentioned the data as being sent in bytes. I think you really meant to say that data is sent bitwise until 8 bits are sent whereas the slave can then ack or nack the byte sent. Any number of bytes and be transferred during a transaction until a Stop or Restart is encountered. Once again, really love your videos.
Thanks for wonderful explanation and demo on I2C. Please explain on SPI compared with I2C difference, applications. Finally About UART, CAN bus as well.
Like your quality tutorials. I have a question. Since you are going to send back 4 bytes of sensor data, why not just ask for 4 bytes on the master request and then have the slave just read the 4 HC-SR04's at that point of time in the order of 1, 2, 3 and 4. All the other reading between requests will not do the master any good. BillW
@@vtorsi610 he's asking why wait for 8 bytes if the slave only sends 4, if you read all 4 sensors in a defined order and pnly wait for 4 bytes instead of 8 then the communication time slave to master is halved making it possible to respond faster to sensor input.
Awesome content! Thanks for these videos! On a side note - during the first few minutes of the intro it looks like you have cat ears thanks to the pliers on the peg board behind you. Easter egg or not - still found it pretty neat... 👍👍
A caution regarding the HC-SR04. There is now a "p" version of this sensor (recognized by the missing xtal) that does not work in one wire mode. only in two wire mode.
shouldn't the code be if(millis() - entry > 100) bval = Wire.read() instead of if(millis() - entry < 100) bval = Wire.read()? To show that the time has ellapsed
I have some problem trying to understand how the readings from the sensors remain synchronized. How the Master can always recognise the 3rd sensor as the third?
It's not clear here why a data-based protocol (the 255 marker) is being used instead of multiple byte reads/writes. Am I misunderstanding the I2C spec, is it an issue with the library, a robustness issue, or something else?
I'm messed up with the theory part, what i think is the CLK signal toggles when a bit sent, not a byte. Also i expected a example communication with different sensors through I2C in the last part of the video, but it turned out to be just a combination of this and the last videos.
Bill, I actually followed a lot of what you said! I got confused a bit at the beginning but as you went through the sketches I kind of got it! It amazes me how you can make things understandable to me in my current condition.. I am so thankful. One thing I do not understand is why use i2c? everything seemed work ok before you added the second arduino? I did not understand what the advantage was.. Sorry if my questions are rather childish.. But I do have such a hard tome understanding things here in my later years.. Sheesh it never used to be this way.. Well thanks for the share and carry on my friend.. oh one other thing.. I got the DroneBot workshop news letter on april 8th has thee been a new one? or is it just once a month? I have forgotten..
You are right. Sending back five bytes would of been better. Instead the master has to request 5 times. I don't know the library but that could mean starting and stopping the bus 5x to get the readings.
Thanks for this video! How would you build a system that has upwards of 60 sensors? I2C should allow them all to be connected serially, without requiring a connection from each back to the arduino as you’ve done here, right? Would each sensor need its own microcontroller in that case?
You will definitely have a significant delay if you will use one Arduino Mega and wait for each one to measure, if you can read all of them at the same time ( assumming they will not interfer with each other ) just scale the code to acomodate all of that data, from my experience with 20 sensors and a master and slave ( 2 Megas), it was not a problem. Btw why do you need so many ?
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?
@@Dronebotworkshop And that mentality is the difference between your channel and all the other hobby electronics channels on YT, most of which are not even half as well constructed nor half as informative.
Hello @DroneBot Workshop, i am using esp32-wroom with bq24195l, but i am unable to communicate bq with esp32 via i2c. can you please tell me how i get data from BQ to ESP32 via I2C?? thank you
Hi Dronebot iam working on an MS4525DO digital airspeed sensor with I2C communication module i want it to measure velocity of air through an arduino uno,I was able to start communicating with the sensor. It does respond to changes in airflow. But I cannot get the values to come close to normal pressure reading.
Something is wrong with i2c master sketch doesn't compile for windows says expected initializer before j token right at void set up any solutions would be greatly appreciated thanks😁
Thanks for the excellent video, I have a question though hope it is the wright spot to ask. My understanding from the video that due to address conflict we cannot connect the 4 ultrasonic sensors to the same I2C bus because all of them have the same address?
sir in my project i want to send string variable from master to salve and multiple sensor data is need to send from salve to master(master is node mcu and salve is arduino uno)
Very informative video, thanks Could you please tell me how I can separate the values of dht22 as temperature and humidity... If You can make a complete tutorial on it then will be very helpful. I have dht22 connected with uno and i2c with esp8266, I want to get values from uno to esp8266 and display them over blynk app. Please favor me
Hello sir, would it work if I used an RTC module, a master arduino, and a slave arduino? I want the master to be receiving time from RTC and the slave arduino to be sending int values to the master. Then the master will take a look at values given by the rtc and slave and perform a certain operation base on those values. Example: An if else decision based on the time given by rtc and value sent by slave. If the values match the condition, the operation happens. My problem is that the rtc module is also connected in sda and scl, so how should I proceed since the master slave should also be connected via sda and scl?
hello sir, I am an arduino beginner user ,, I want to use a pressure sensor with type xgzp6857 and will be processed by arduino, this sensor uses the i2c communication protocol, I have found the i2c sensor address is 0x6D, but this sensor does not yet have a library for arduino, how can I use this sensor so that the pressure reading can be displayed on the serial monitor? maybe you have an idea for this problem? thank you
Can you make tutorial for 10-bit addresses.I tried to register on yours site but it does not accept mail.They are great tutorials, it would be nice to move on with I2C.For example, how to make address 200, and how to extract bites.Thanks
With 10 bit addresses you get a nack from the slave after the first byte of the address but the i2c register should be set for 10 bit slave address mode. The master will just send the second byte of the address and this time the slave will send back an ACK and off you go. The i2c has a lot of options that can be set up if the chip has a hardware i2c. If you are using a library then it just depends how much functionality the author included in the library.
Hi sir I have list of projects expected from u 1. Drone using arduino (TX,RX,FLIGHT CONTROOLER using arduino only) 2. Using mpu6050 module with arduino 3. Using arduino and nodemcu as iot thanks in advance
OMG! You are confusing bits and bytes at the serial line. Please, correct the data exchange explanation: The SDA contains on high clock are bits, not bytes. And the number of cycles to get a complete packet including address, plus data, etc... must be expanded explaining how bytes are constructed from bits. Remember to explain if the bus is MSB first or LSB first.