No video

#20 Tutorial: Multiple Devices on One Arduino I2C Bus

  Рет қаралды 207,868

Andreas Spiess

Andreas Spiess

Күн бұрын

This tutorial shows how you can connect many devices (sensors and displays) to one Arduino using the I2C bus. It starts with a simple hommade bus, shows how to find out the addresses of the different devices and ends with a demo of a system with three devices connected to an Arduino Uno: A BMP085 pressure sensor, a MPR121 touch sensor, and a SSD1306 OLED display.
The tutorial applies also for Attiny, ESP8266 and STM32 boards like the Maple Mini
Links:
Level Shifters: www.aliexpress....
I2C Scanner forum.arduino.c...
Example Sketch: github.com/Sen...

Пікірлер: 314
@radeonblue1816
@radeonblue1816 2 жыл бұрын
Again, One of the channel who is explaining the things but for beginners it is hard to grasp whatever he did as he did not showed the connections.
@AndreasSpiess
@AndreasSpiess 2 жыл бұрын
You are right. This is not a channel for beginners :-(
@valmormn
@valmormn 8 жыл бұрын
Hey, guy with swiss accent. Your channel is very inspiring. Thanks for sharing your ideas!
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
+Valmor Nascimento You are welcome!
@TheRealStructurer
@TheRealStructurer 3 жыл бұрын
I'm watching this in 2021 and its still valid. I must say Andreas that you sound more secure and energetic in your newer videos, so keep them coming!
@AndreasSpiess
@AndreasSpiess 3 жыл бұрын
Thank you! I should be a little more experienced after 370 more videos...
@robertoeggenhoffner1552
@robertoeggenhoffner1552 6 жыл бұрын
Hey, guy with swiss accent, I've got an italian one.... I find very useful your teaching. Actually, I was used to plan experiments with Labview and NI instrumentation, I decided to leave both for open software and cheap devices, not only for economical concern. Thanxs for the wide presentations
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
You are welcome. Hope everything goes well...
@timmyfingaz100
@timmyfingaz100 Жыл бұрын
For a few hours I have been struggling to get 2 screens working independently, not anymore!! Simple but effective, much simpler than what I was trying to do! Thanks :)
@AndreasSpiess
@AndreasSpiess Жыл бұрын
Glad it helped!
@deangreenhough3479
@deangreenhough3479 6 жыл бұрын
Just come back to this video today for a refresher, My God, how very different you sound today........... oh my, how you have grown in such a short period of time, quiet astonishing!! Pat on the back required :-)
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
:-)
@felixFPVDrone
@felixFPVDrone 7 жыл бұрын
This episode was simple and easy to understand, even for a electronic novices like me. My main goal as a RC enthusiast is to better understand how I can utilize the I2C protocol on the flex port of my cc3d flight controller. You did a great job at explaining in detail!!!
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
Thank you for your feedback! It is always good to know that my content is useful.
@heyhogan
@heyhogan 6 жыл бұрын
Thanks for the quick video. I am doing a project with an OLED, Temp sensor, and ADXL345 sensor and was wondering about how to build the bus, so your example did give me some ideas.
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
I hope you will get it running!
@wolfrobots118
@wolfrobots118 4 жыл бұрын
I love the way you talk. It made it a lot better to understand. I subscribed.
@AndreasSpiess
@AndreasSpiess 4 жыл бұрын
Welcome aboard the channel!
@ullar8217
@ullar8217 3 ай бұрын
thanks, helpful video even 8 years later
@AndreasSpiess
@AndreasSpiess 3 ай бұрын
You are welcome!
@castro1780
@castro1780 5 жыл бұрын
Nice job explaining the theory behind I2C without getting caught up in code
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
Thank you!
@Really2950
@Really2950 8 жыл бұрын
Great video. Good for esp8266. There is also a board with ads1015 to extend the pins available on esp8266 using I2C. Good topic for video too :)
@drawingboard82
@drawingboard82 7 жыл бұрын
Very helpful, many thanks for putting the time into this!
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
:-)
@SathishKumar-if7ow
@SathishKumar-if7ow 4 жыл бұрын
How can i say thank u....🙏🙏 THANKS from the heart💚 Your experience and way of explaining....nut shell like me too understand... ( thank u internet & many unknown people across the world helps me to learn ) Thank U sir..
@AndreasSpiess
@AndreasSpiess 4 жыл бұрын
:-)
@b9robot01
@b9robot01 7 жыл бұрын
Hello Andreas, I am completely new to these type of displays and sensors but I must say that your videos are the best I have found to help me learn. I want my first project to have 2 or 3 0.96 OLed displays, each showing a different sensor output, like temp and humidity on one, time and date on the next, and on the third maybe a spectrum analyzer. Watching your videos has given me the confidence to try. I do have one question though. On this video you talk about making an IC2Bus, what is a IC2 Bus and how did you make them, that part of the video went by a little too fast for me.Thank you from a fan.
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
Thanks for your nice words! Maybe I referred to my video #12. I just Suber glue a few headers with four pins together and connect them with 4 wires (soldered). Then, I can plug as many I2C devices in and all run in parallel.
@campbellmorrison8540
@campbellmorrison8540 6 жыл бұрын
Great info thank you. I am making a retrofitable shot timer for a multi group espresso machine. Each group has a counter display triggered by sensing the valvle solenoid current. the display of the group counts in seconds and stops when the group is released. Its the in thing to know how many seconds you require to deliver a shot ie 25-30ml should be around 20-25 sec this is affected by the grind and the coffee freshness. Anyway with all displays on one bus its much easier for me to add displays depending on how many groups the machine has so your video has helped me no end thank you
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
Interesting project! Good luck!
@martinkuhnl8816
@martinkuhnl8816 Жыл бұрын
Andreas, das ist eine tolle Info, danke!
@AndreasSpiess
@AndreasSpiess Жыл бұрын
Gern geschehen
@alexdehmel535
@alexdehmel535 3 жыл бұрын
Super Channel, vielen Dank für die tollen Tutorials!
@AndreasSpiess
@AndreasSpiess 3 жыл бұрын
Gern geschehen!
@artur19846
@artur19846 8 жыл бұрын
Das Video war wunderbar! I was intersted in connecting multiple devices to a single Arduino and came across your video. Very informative. Thank you a lot. By the way, how many devices (practically) can run a single Arduino nano?
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
+Arthur K I never tried. If properly terminated it should be possible to connect more than 10 devices with a short bus length. Theorretically it is much more. Details are discussed here: electronics.stackexchange.com/questions/181953/how-many-i2c-slaves-can-a-i2c-master-support
@XerotoLabs
@XerotoLabs 9 жыл бұрын
very clear and thorough . i like how you did the bus. i think the fastest i have pushed a UNO and Nano was 400hz in I2C . for most things its 1 line of code . i was driving 2 dual Adafruit stepper motor control boards and a OLED on 1 buss .
@AndreasSpiess
@AndreasSpiess 9 жыл бұрын
+XerotoLabs I never looked on bus speed, because I never run into problems which I was able to attribute to speed issues. So, it is good to know how fast it goes. Usually, I had more issues with some sort of overall functionality... I use the "bus principle" with hot glue for many other things like power supply or debugging. This topic is on the list for a future video.
@XerotoLabs
@XerotoLabs 9 жыл бұрын
+Andreas Spiess i looked up what i did last time for faster speed for stepper motor controls. : in your setup() , use this TWBR = ((F_CPU /400000l) - 16) / 2; // Change the i2c clock to 400KHz
@AndreasSpiess
@AndreasSpiess 9 жыл бұрын
+Andreas Spiess Good to know and very simple. I think, to include this line of code in each sketch is not a bad thing to avoid any speed issues.
@XerotoLabs
@XerotoLabs 9 жыл бұрын
+Andreas Spiess i think you have to have Wire.h included too , but i think you need that just for I2C anyhow . I'm not sure why the default (IIRC) is 100KHz , i wonder now if there are other timing issues like on a ESP 8266 using I2C is supposed to some how slow the WiFi , i have not tested that . I have to say i like your buss on a wire . gives me reason to order some colored headers now.
@NeoMoonlighter
@NeoMoonlighter 6 жыл бұрын
Thanking the gods for guys like you helping me out with my project (y)
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
You are welcome!
@Dream0Asylum
@Dream0Asylum 5 жыл бұрын
I love abbreviations that are no shorter than what they're meant to stand in for.
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
:-)
@alexteh7067
@alexteh7067 7 жыл бұрын
First of all, love your channel, really eye opening and you do go into so much details. I'm wondering how to connect a single Arduino Mega to one I2c Bus to conect to multiple sensors (eg room temperature sensor, water temperature sensor, humidity sensor, automation of pumps in real time and storage of data as well as writing the sketch for them. Thanks in advance
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
You can connect up to 126 I2C devices on one bus (theoretically).
@foxbatx
@foxbatx 7 жыл бұрын
Thanks for sharing and putting a very informative presentation. I truly learned something. - Cheers -
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
Thanks for your nice words!
@Dextermorga
@Dextermorga 8 жыл бұрын
so many great videos, thank you for your time and afford.
@thesci-fibro5835
@thesci-fibro5835 3 жыл бұрын
Effort*
@adrianglezmahe
@adrianglezmahe 4 жыл бұрын
Nice and simple explanation !!!
@AndreasSpiess
@AndreasSpiess 4 жыл бұрын
Thank you!
@BGLENN-dp4tx
@BGLENN-dp4tx 6 жыл бұрын
Much appreciated AND educational. - Bill
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
Thank you!
@Reda-gx6wq
@Reda-gx6wq 6 жыл бұрын
Hello I appreciate your content, I am building a weather station with rtc clock, humidity sensor and lcd , tree of them use I2c but sometimes when I reflush the program or turn off and on the esp8266 , the i2c does not work. May you help me with this issue ? thanks
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
I cannot do remote debugging of such problems. I only suggest you try one after the other. Then you find out when it starts to create problems
@badmonkey91
@badmonkey91 2 жыл бұрын
Have you ever considered becoming a teacher? ☑ 'Put you to sleep' cadence ☑ Tell - Don't show ☑ Use abstract/boring diagrams ☑ uninteresting graphics to linger way too long You hit all the checkboxes - Bravo!
@AndreasSpiess
@AndreasSpiess 2 жыл бұрын
Thank you for your open feedback!
@ismailkhan887
@ismailkhan887 3 жыл бұрын
Thank you. That is what I was looking for.
@AndreasSpiess
@AndreasSpiess 3 жыл бұрын
You are welcome!
@patprop74
@patprop74 6 жыл бұрын
Doctor Goggle hahah Nice! very informative ! I learn more in 7 mins with your explanations then I did with Dr Goggle.
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
But still, I use it a lot ;-)
@BBhashyam
@BBhashyam 4 жыл бұрын
Great video and all the other videos as well. Instead of making a home made hub, can we use TCA9548A multiplexer which I read can be useful even in an address conflict situation? I am using 4 x sensors all with different addresses.
@babybillen2
@babybillen2 5 жыл бұрын
Is it possible to connect multiple TSL2591 to one arduino? they have the same address, but it can't be changed right?
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
The Adafruit specs say: This board/chip uses I2C 7-bit address 0x29 (fixed)
@africantech5
@africantech5 2 ай бұрын
I have put two LCD before and Both has same address and it works
@pakojaure
@pakojaure 7 жыл бұрын
Hi, A very helpful video, thank you! I am trying to use two accelerometers MPU6050 with an Arduino nano that only has one port for SCL and SDA, but I am confused because in some forums say that is needed to add pull-ups resistors with each SCL and SDA, is that right? Because how you doing it you don't need the resistors and looks easier! Thank you!
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
+Paco J Theoretically, you need pullups. Practically you can try without them. If you have problems, you still can add them. There is usually only one I2C bus, because you can connect many devices.
@pakojaure
@pakojaure 7 жыл бұрын
Andreas Spiess thank you Andreas! I have already figured out that I don't need to use the pull-up resistors because the accelerometer MPU6050 already have them, each one about 4.4K ohms for SCL and SDA. Thank you again, you helped me a lot to understand about I2C. Greetings from Mexico!
@andrekotze6050
@andrekotze6050 5 жыл бұрын
Hi Andreas, I do not know how many, but I have watched A LOT of your video's. CHEERS for the good work you do!!! always well presented!!! I have a question. Can one add libraries, initialise peripherals (LIKE LCD) or restart a device from code without resetting the arduino? Lets say my LCD lost sync because of momentary power loss, how can I get this going again with code?
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
You could maybe try to initialize the LCD from time to time. But this most probably will result in flickering. So maybe you connect both power supplies. Then both will lose power at the same moment.
@pablocolladoavila3162
@pablocolladoavila3162 7 жыл бұрын
excellent explanation!!! and great video
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
Thanks!
@GameAndJokes
@GameAndJokes 3 ай бұрын
I have a question and i hope i can find an answer basically we directly connect all the scl and sda pins in the same connection? like the wires are connected together of the Oleds and the they are connected directly to arduino scl and sda?
@AndreasSpiess
@AndreasSpiess 3 ай бұрын
I do not understand :-( Just look at the diagrams on how to connect the chips and signals.
@khalmaxroboticsgh3176
@khalmaxroboticsgh3176 5 ай бұрын
I'm working on a 4wd robot car using Arduino Mega. I am trying to synchronize the speed of all 4 wheels of the robot. I intend to read the motor speed from each motor using an AS5600 hall sensor. That means 4 hall sensors in all. I also realised the arduino mega has only one sda and scl pins so this tutorial is helpful. Can you also help me with more tips and advise on how to go about it? Thanks
@AndreasSpiess
@AndreasSpiess 5 ай бұрын
I share my knowledge on KZfaq and do not do individual consulting :-( Good luck with your project!
@JanHans
@JanHans 8 жыл бұрын
i love this video. never expect this would work against being homesick.
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
+Jan You have to help me with the connection between I2C and homesick!
@JanHans
@JanHans 8 жыл бұрын
Ich lebe momentan in Irland und da hatte ich die komische Idee, eine Eier-Inkubator-Steuerung zu bauen. Als kompletter Anfänger schaue ich viele Videos bei KZfaq an. Deines, weil ich ein I2C-Display und ein RTC in meinem Projekt verwenden möchte. Mit dem Schweizer Akzent war das dann besonders nett zu schauen. Danke!
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
+Jan aha. Jetzt verstehe ich! Wir waren letztes Jahr in Irland in den Ferien. Uns haben Land und Leute sehr gefallen.
@JanHans
@JanHans 8 жыл бұрын
Irland ist perfekt zum Ferien machen, leider aber weniger gut, um hier zu leben. Politisch kommt das Land wenig voran. Es gibt grosse Defizite, was die Infrastruktur anbelangt...
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
Das ist schade. In den Nachrichten hören wir, dass es Irland wirschaftlich gut gehe und dass die Arbeitlosigkeit sinke. Und das wäre ja schon mal was verglichen mit der Situation kurz nach der Finanzkriese...
@Son_of_Yahuah
@Son_of_Yahuah 5 жыл бұрын
I have a project where Im interfacing with at least 12 arduinos 1 being the Master .I think I have to use pull ups for power or a main power hub for all the arduinos . I like the part in the video about finding the names of each and having to write the code for each one ,,,trust me its just as bad as Im explaining it I already have a head ache lol. thanks for the video
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
You are welcome. Seems to be a quite big project ;-)
@edsoncasagrande9945
@edsoncasagrande9945 Жыл бұрын
I2C is good, but using with laser sensor there is a short limit on cable lenght. How can we extend it? I wonder using RS485 open colector hardware, if it possible or not?
@AndreasSpiess
@AndreasSpiess Жыл бұрын
You get I2C extenders. RS485 has a limit of about 1 km
@nousagi7437
@nousagi7437 9 ай бұрын
Hey Andreas, I just remembered 5 years later you had a video just like this, I'm planning to have an ESP32 master with ATTINY85 slaves, which each will take an analog input from a soil moisture capacitive sensor, I'm planning to do an array of these bundles for some plant pots and monitor each of them, and have the information sent through the same bus. Is it possible to assign an address to all slaves and access them in the order I prefer? And what would be a good method to buffer the I2C bus in case my cables are getting too long? Would really appreciate a reply from you, and thank you for all the content you upload, it's really interesting
@AndreasSpiess
@AndreasSpiess 8 ай бұрын
I once made a video where I used slave ATtinys as ultrasonic distance sensors for my robot. Maybe you watch it?
@sphuss
@sphuss 5 жыл бұрын
thanks so much - you've gpot me on the right track!
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
You are welcome!
@azolalesedi3191
@azolalesedi3191 4 жыл бұрын
great video how would i connect one current sensor to measure the variables from different devices e.g power supply,solar panels etc
@AndreasSpiess
@AndreasSpiess 4 жыл бұрын
The usual current sensors can only measure one source. So you need many of them.
@azolalesedi3191
@azolalesedi3191 4 жыл бұрын
@@AndreasSpiess okay thank you
@PilatusPorterPC6
@PilatusPorterPC6 6 жыл бұрын
Thanks. Scanner is really helpful too. : )
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
You are welcome!
@wesleymarvelous1293
@wesleymarvelous1293 4 жыл бұрын
Excellent sir
@AndreasSpiess
@AndreasSpiess 4 жыл бұрын
Thank you!
@NerdMusician
@NerdMusician 6 жыл бұрын
Great video! Can I use 16 Oled displays with this technique?
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
If your displays have different addresses, yes. But usual displays only have 2 addresses to select from
@user-wp7ql1iw2g
@user-wp7ql1iw2g 4 жыл бұрын
Hi, thanks for your sharing, it helps a lot. I’m trying to connect to two identical sensors in one arduino board and print it out the same time (max30102). And i’m having trouble with how to print both value in serial printer separately. How do i write them on the code? Thanks.
@AndreasSpiess
@AndreasSpiess 4 жыл бұрын
Unfortunately, I have no time for consulting. But I am sure you will find a solution yourself.
@BadBite
@BadBite 5 жыл бұрын
love your videos! thank you
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
You are welcome!
@timm3802
@timm3802 Жыл бұрын
Hi Andreas. Thanks for a great video - Do you have any information video how to use MultiMaster on I2C? Maybe some code examples?
@AndreasSpiess
@AndreasSpiess Жыл бұрын
No. I never needed such a scenario
@michaelpadovani9566
@michaelpadovani9566 7 жыл бұрын
Thank you so much for this informative video. I am planning on putting together the following on I2C Bus: DS3231 (RTC), BMP180, and ESP8266. Do I need to worry about adding or disabling pull-up resistors for this setup? Thanks in advance! Cheers from Maryland, USA.
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
Often you do not need it. Just try first without
@michaelpadovani9566
@michaelpadovani9566 7 жыл бұрын
New subscriber here, thanks I will try first without!
@yoannthomann
@yoannthomann 6 жыл бұрын
Hello, thank you for your videos ! I would like to make a big i2c bus (around 50m long and around 100 sensors max) for domotics (the bus will be in the walls so I would like to not have to replace the bus). What is the ideal section of the bus wires ? Do I need one or more bus extender to increase the range/stability ?
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
I do not know. Maybe you search for the specifications of the I2C bus
@JDI4DAVID
@JDI4DAVID 6 жыл бұрын
I am going to be connecting a gy9255 motion sensor and a BME280 to a 3.3 V PRO MINI. I have added pull up resistors but do I really need to? Thank you for your very helpful videos.
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
With short wires and only a few devices on the same bus, they are usually not necessary. Just try.
@jhilam3017
@jhilam3017 4 жыл бұрын
You are life saver!!!
@AndreasSpiess
@AndreasSpiess 4 жыл бұрын
Thank you!
@paulfleck2435
@paulfleck2435 5 жыл бұрын
Great Video! One question: I need to use an Arduino with many identical motor shields (It will have more motors than one shield can handle). How do I change the address of the motor shields so they are not identical? Any ideas? Thanks!
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
Your shields either allow that or you have to use a special I2C extender. Then you also have to change your code to address the respective shield first.
@jonvannatto
@jonvannatto 9 жыл бұрын
Again, great information in this video. Are you able to share the setch for this project as I have all the components and would like to build it. Also thanks for the link to the I2C Scanner. Very handy.
@AndreasSpiess
@AndreasSpiess 9 жыл бұрын
+Jon Vannatto I put the example sketch used on github: github.com/SensorsIot/I2C_1-Video
@simonthewarrior59
@simonthewarrior59 4 жыл бұрын
Hi andreas! Thanks for sharing all your knowledge. I'm working in a project with three i2c devices connected to the arduino. For now i'm working with only 2, an oled display just like the ones you used here, and a MPU6050 accelerometer module. The problem is that I'm using a library to deal with the display (OLED_I2C.h), and other libraries to deal with the accelerometer (I2Cdev.h and MPU6050.h) wich depend on Wire.h. I think the use of the bus by these libraries are in conflict because they work separately but not together. What do you suggest?
@AndreasSpiess
@AndreasSpiess 4 жыл бұрын
I suggest to try it out. It should work if the addresses are different
@simonthewarrior59
@simonthewarrior59 4 жыл бұрын
@@AndreasSpiess Yes, I'm still working on that. Thanks for replying!!
@iantang2048
@iantang2048 2 жыл бұрын
Hi! I am new to arduino, and I have a project that need to connect multi Tof10120 sensor in one UNO and I am quite confused right now. May I know where to start or would u kindly give me some advice? Thanks!
@AndreasSpiess
@AndreasSpiess 2 жыл бұрын
I suggest to enter "Tof10120 Arduino" into Google and you will find a lot of projects.
@R_Alexander029
@R_Alexander029 8 жыл бұрын
Great video. Quick question, do you need to add pull up (or pull down) resistors for SCL and SDA?
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
For short leads and only one device normally not.
@R_Alexander029
@R_Alexander029 8 жыл бұрын
Vielen Dank für deine Hilfe.
@paulodinis1981
@paulodinis1981 3 жыл бұрын
hello from Portugal. i just watched your video to ltry to learn something more about i2c. the main reason is to make some i2c devices work on flight controller i2c bus. i have some detected in betaflight and some detected in inav. i know devices are working, but not correctly deteted and i dont understand, why? i bet is fw related issue
@AndreasSpiess
@AndreasSpiess 3 жыл бұрын
Unfortunately, I cannot do remote debugging. But you should be able to exchange teh FW with a I2C scanner sketch to find out more.
@ronyroy3116
@ronyroy3116 6 жыл бұрын
how do i connect max30100 & adxl345 both with arduino to get the data from both sensor. please help me.
@MadTinker
@MadTinker 7 жыл бұрын
New to Arduino and this was great! Can I ask what you were using for pressure and temperature display?
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
Thanks! I used a GY-65 board containing a BMP085 chip
@MadTinker
@MadTinker 7 жыл бұрын
Andreas Spiess Thanks for the quick response. I should have been clearer in my question. I was interested in the display and not so much the sensors.
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
This is the display: bit.ly/2h2831l
@shrikantnikam2426
@shrikantnikam2426 2 жыл бұрын
I hope you will reply :) , I use 5 arduinos displays 5 sensor values on single i2c display it is situated 12 foot from arduinos , but at the display i want to tap data coming to display and serial print on arduino connected for tapping data it display address is 0x27 is it possible?
@AndreasSpiess
@AndreasSpiess 2 жыл бұрын
Maybe this is possible, but you have to program everything yourself. If your Arduino at the display is programmed as a slave with another address you could send all the commands to 027h as well as to the address of the Arduino. But the Arduino needs to be programmed as a slave (different library)
@techsilv5170
@techsilv5170 4 жыл бұрын
Hi great videos Just a question. Is it possible to connect 2 or more 16x2 lcd display and give them different messages
@AndreasSpiess
@AndreasSpiess 4 жыл бұрын
Should be possible to create a second display ( Adafruit_SSD1306 display2(OLED_RESET); ). But I did not try
@hubertmargreiter3508
@hubertmargreiter3508 3 жыл бұрын
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?
@AndreasSpiess
@AndreasSpiess 3 жыл бұрын
You can try it with I2C (one as a master, the other as a slave. I did this in an old video where I had 3 ultrasound detectors connected to a ATTiny asa slave. Or you use Serial. I use an ESP32 and WiFi...
@hubertmargreiter3508
@hubertmargreiter3508 3 жыл бұрын
Thanks, I will check :)
@talha_anwar
@talha_anwar 6 жыл бұрын
thanks for such an awsome video. i wish to know if i need data from two sensors simultaneously, how would it be possible. i need this data then transferred to excel
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
Maybe you watch my video about transferring data from Arduino into Excel.
@anaaremere2mere
@anaaremere2mere 7 жыл бұрын
Hello, I am new in Arduino and I was wandering if using I2C Bus I can connect together 15pcs DHL22 sensors, 10pcs MQ2 sensors, 5pcs flame sensors,......and I will stop here. Basically I am trying to create an automation for a new house. I would like to monitor temperature, humidity, gases, fire detection, blind open/close, dimmable light, some proximity sensors to detect if doors are open or closed. Is this possible as DIY or I am dreaming to big?
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
I2C buses can be used to connect many devices over the distances of a house. However, it is rarely used for that purpose. There are many videos and other sources about Home Automation on the internet.
@covingtonkua9404
@covingtonkua9404 3 жыл бұрын
Hello, I wanted to connect arduino micro (Master) to arduino nano(slave) and LCD I2C (Slave), both need SDA and SCl, is it possible to do it? Been searching around for quite a while now. Pls let me know thank you
@AndreasSpiess
@AndreasSpiess 3 жыл бұрын
Cut the problem in two and try first the LCD. If it works you search for the Arduino I2C slave software and try it out without the LCD. If both work and do not have the same address you can connect both slaves to the same lines.
@covingtonkua9404
@covingtonkua9404 3 жыл бұрын
@@AndreasSpiess thanks for the reply, will try it out soon.
@pocket_science_
@pocket_science_ 5 жыл бұрын
Could you throw some light on the "home-made" I2C device you created using male headers. How does it act as a I2C device? Thanks.
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
This was only a connection between the different wires.
@pocket_science_
@pocket_science_ 5 жыл бұрын
@@AndreasSpiess how does it act like a I2C device? What about its address?
@StarStudios007
@StarStudios007 6 жыл бұрын
I connected two oled display with same model....ssd1306....I tried to display two different things in each. But the i2c scanner shows only 0x3c address....I connected all the wires in same port for both displays.....help
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
Each display has to have its own address. There is a resistor on the Oleds to change the address. Needs soldering.
@StarStudios007
@StarStudios007 6 жыл бұрын
Andreas Spiess it worked perfectly....thank you
@edwinmannaandthelearningch4450
@edwinmannaandthelearningch4450 7 жыл бұрын
theres some website i went to that has all the latest devices listed with how to's on how to connect them Wi-Fi ect......
@Elettronica-xt7nm
@Elettronica-xt7nm 6 жыл бұрын
Beautiful Video, very interesting. I wanted to ask if it was possible to manage 32 relays over WiFi with more MCP23017. Thank you very much for the attention.
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
Seems to be possible with a Pi. So it also should be possible with an Arduino: kzfaq.info/get/bejne/o55jiMeIm53Mho0.html
@tienbuivinh5230
@tienbuivinh5230 6 жыл бұрын
Thanks for your video. Now I am wondering if I have 2 same sensors and want to connect to just one Arduino board, How can I change the address of those sensors. Can you make another video about how to do it?
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
Most of the chips have address pins where you can select amongst 2 or 4 addresses. Always read the datasheet of the sensor chips.
@tienbuivinh5230
@tienbuivinh5230 6 жыл бұрын
I am using the AM2315 sensors and could not find anything about changing the sensors' addresses via Hardware in the datasheet. I am looking for changing those sensor's address by programming. Still stuck. Could you help me on it?
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
You cannot change it through programming unless it is described in the datasheet. But only very few sensors can do that.
@w.e.4759
@w.e.4759 4 жыл бұрын
Does any one know how to identify and change address on the same modules such as VL53L0Xs? The problem with using I2C on the same type of module is that all of the same modules has the same address, which Arduino thinks it is reading only one device. I don't know how to change the addresses from hardware to different address in software. For example: VL53L0X has address of 52. If I connect six VL53L0Xs on I2C, the Arduino UNO recongnizes as one VL53L0X, instead of six. Therefore, I need to change all VL53L0X as V1 = 01, V2 = 02, V3 = 03, V4 = 04, V5 = 05, V6 = 06. I can try to use onboard pins to designate them as pin2 = SCL, pin3 = SCA, pin4 = SCL, pin5 = SCA, etc...; but this method leaves me with short on pins for other modules. I also try PCA9685 PWM, but it still read the same address. UPDATE: This link solves my problem: forum.pololu.com/t/multiple-vl53l0x-code-and-wiring-with-distance-reading/12609
@Dirt33breaks
@Dirt33breaks 4 жыл бұрын
DUDE! I have the same problem, I have been looking for this for ages, everyone normally thinks we are using different devices lol, in my case i have 2x ac5600 magnet sensors (for dj controller jog/scratch wheels/platters), I am still yet to find how to change the addresses on my sensors, there is no basic code out there for ac5600 just libraries
@w.e.4759
@w.e.4759 4 жыл бұрын
@@Dirt33breaks forum.pololu.com/t/multiple-vl53l0x-code-and-wiring-with-distance-reading/12609 This web page solved my problem, but I don't really understand that well. It has to do with XSHUT connection. Maybe the Swiss Accent Guy will come out with a video for it. I would but I don't have Swiss accent. :p
@yousef30001
@yousef30001 4 жыл бұрын
Great information. I want to use 9 Laser measuring sensors ( VL53L0X sensor ) in 1 Arduino mega controller. I need to see the results and read them at the same time. how possible?
@AndreasSpiess
@AndreasSpiess 4 жыл бұрын
Search for i2c multiplexer
@artur19846
@artur19846 8 жыл бұрын
Hallo! Does the I2C bus need independent power supply? I don't think that a single Arduino Uno's power will be sufficient for multiple devices.
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
+Arthur K The I2C bus (SDA, SCL) does not need a power supply, the devices connected to it have to set the signal level. This is why the devices have to be powered.
@artur19846
@artur19846 8 жыл бұрын
+Andreas Spiess Thanks! It got a bit clearer. Actually, I was thinking about deploying an outdoor weather station based on solar power and connecting to it multiple sensors (temp, humidity, pressure etc.)
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
That should be no problem. You need a rechargeable battery, some sort of solar panel with a regulator, and an Arduino. The Vcc of the sensors can then be conneted to the 5V or the 3.3V rail of the Arduino (depending on the needs of the sensors). The same applies to an ESP8266 if you need WiFi to connect your weather station.
@eastern815
@eastern815 3 жыл бұрын
Thank you Sir.
@AndreasSpiess
@AndreasSpiess 3 жыл бұрын
You are welcome!
@victorarmani6660
@victorarmani6660 8 жыл бұрын
Hi Andreas,I'm in the process of building a heat exchanger that requires 45 SHT31 sensirion sensors to measure temperature and humidity accurately. The sensors have i2c and voltage output capabilities. I prefer to use i2c, but would I be able to connect this many sensors? Also, I'll need the wires to run from within the tubes to the outside of the heat exchanger to the controller i.e. arduino, rasberry pi etc. The maximum length of cable is 900mm. Would this distance be of concern i.e. noise, interference etc? I'm not worried about cost, but would like to purchase equipment that would definitely work for my project. I would appreciate your thoughts. Regards,Viktor
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
+Viktor Armani Hi Viktor. 1. Theoretically you can connect up to 127 devices to the I2C bus. But all have to have their own address. Unfortunately, a SHT31 can only select between 2 addresses. So, you only can connect two devices to one I2C unless you find another way to select between them. (see chapter 3.4 of the SHT3x data sheet for a proposal). This proposal needs a distinctive line to each sensor in addition to the 4 wires of I2C. www.sensirion.com/fileadmin/user_upload/customers/sensirion/Dokumente/Humidity_and_Temperature_Sensors/Sensirion_Humidity_and_Temperature_Sensors_SHT3x_Datasheet_digital.pdf 2. I think, 900 mm is way too short. See this aricle where they were able to get up to 100 meters: www.esacademy.com/en/library/technical-articles-and-documents/miscellaneous/i2c-bus/frequently-asked-questions/i2c-faq.html Hope this helps ;-)
@victorarmani6660
@victorarmani6660 8 жыл бұрын
+Andreas Spiess Thanks for your detailed response. I've sorted out the multiple devices/address issue by using a TCA9548A 12C multiplexer. The second part I'm still working on i.e. length of cable/s.
@edu_asmaus
@edu_asmaus 5 жыл бұрын
excellent work. awesoma
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
Thank you!
@fastfest2425
@fastfest2425 20 күн бұрын
how do you know what device just by hex key?
@AndreasSpiess
@AndreasSpiess 20 күн бұрын
I showed a list with sensors and their hex code in the video
@rafigarden7824
@rafigarden7824 3 жыл бұрын
I might miss it..but do u have the wiring connection please
@AndreasSpiess
@AndreasSpiess 3 жыл бұрын
I2C devices can be connected in parallel.
@TiagoSilva-xf7it
@TiagoSilva-xf7it Жыл бұрын
I really appreciate it your video
@AndreasSpiess
@AndreasSpiess Жыл бұрын
:-)
@mousumimandal5464
@mousumimandal5464 5 жыл бұрын
Sir, i need to interface three DAC modules with arduino that will produce sine waves at 120 degree phase shift with variable frequency. . I m bit confused with it.. can u help me kindly? ::")
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
Maybe you solve the problem step after step. Find a DAC. Connect it. Produce a sine wave and check if you get to the needed frequency...
@ManuelCastillo-kq3xy
@ManuelCastillo-kq3xy 5 жыл бұрын
Hi, I tried to use your i2c Scan, but not compiling. Error is: Arduino:1.8.7 (Mac OS X), Tarjeta:"NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Enabled, 4M (3M SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200" /Users/manuelcastillo/Documents/Arduino/i2c_scan/i2c_scan.ino: In function 'void I2Cscan()': i2c_scan:171:7: error: 'TWBR' was not declared in this scope TWBR = (F_CPU/(speed[s]*1000) - 16)/2; ^ exit status 1 'TWBR' was not declared in this scope I use a ESP8266 Lolin v3. I need use 3 devices with i2c. Help me, please.
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
You have to search for an I2C scanner for the ESP8266.
@DevineIshaq107
@DevineIshaq107 7 жыл бұрын
Andreas it was intuitive . gave me a lot of insite and I am on the gateway to build the robotic suit for my grand child ,, as he has walking issues. Uncle google has many sketches for IMU 6500 but all of them give errors and are erratic. In my project there are 6 steppers for ankle knee and thigh and one for the back swing left right front back as he is not stable. will be using imu for his stability and will manage his walking . It is a difficult project and will need your generous input for using the i 2 c as there are too many things to take care of 3 imu units 8 steppers and walking route en turn around sitting standing etc etc. I am hoping for a generous Charity of knowledge Please
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
Good luck with your big project!
@gouthamvirigineni348
@gouthamvirigineni348 7 жыл бұрын
Sir I am a big fan of your blog. Presently I'm working on a project called gesture glove. In this project i want to integrate 5 MPU-6050 Sensors. The problem is I could connect only 2 MPU's, as MPU-6050 has only 0x68 and 0x69 addresses. Could you please tell me how to connect 5 MPU's to one arduino nano using i2c bus process.
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
Thanks for your comment. You can use this chip to solve your problem: www.nxp.com/documents/data_sheet/PCA9547.pdf
@Manjuju123
@Manjuju123 7 жыл бұрын
Goutham Virigineni I am having the same question but couldn't you just pull the address pin to a high using a digital io on the sensor you want to read and leave the other 4 sensor address pins to low? This should work right?
@gouthamvirigineni348
@gouthamvirigineni348 7 жыл бұрын
Yes it worked for me by using a multiplexer IC, I was able to select the required addresses. I used different array's for storing different sensor's data. I used a multiplexer in order to reduce the number of pins to address the different sensors. Please feel free to visit my channel (goutham virigineni). Th@nk you.
@DrLuc-lq8ls
@DrLuc-lq8ls 5 жыл бұрын
Wegen deinem starken Akzent habe ich schon fast gedacht dass du deutsch sprichst
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
Wir Schweizer sprechen nicht Deutsch, wir versehen es nur ;-)
@Ckcdillpickle
@Ckcdillpickle 4 жыл бұрын
couldn't you have done this project without a I2C Bus? Newbie at arduino and electronics in general, discovered I2C and I have a lot of interesting Idea that I don't know how to execute
@AndreasSpiess
@AndreasSpiess 4 жыл бұрын
No. Because the video was about I2C bus. I would start with a simple project. There are hundreds of such projects on the internet
@umeruz
@umeruz 7 жыл бұрын
i need to monitor 100 DS18B20 temperature sensors using a central arduino. is it possible..? if yes, please help me out.
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
I never worked with this device. So, I do not know. Maybe you check if somebody did it with 10 and see, if there were any problems and how he resolved it.
@RahulKhurana85
@RahulKhurana85 8 жыл бұрын
I tried connecting 2 I2C devices (which are same), but in the scan it shows only one address. So is it normal?
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
+Rahul Khurana yes, of course, if you use identical devices. To connect them at the same time to the same bus you need to change the address of one of the devices. Most modules have a possibility to do so (usually set a pin high). It should be described in the description or in "google". Come back if you do not find the info.
@RahulKhurana85
@RahulKhurana85 8 жыл бұрын
+Andreas Spiess Thankyou very much. It works
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
+Rahul Khurana Good!
@RahulKhurana85
@RahulKhurana85 8 жыл бұрын
+Rahul Khurana Actually I still have one problem. I want to use 4 to 5 MP6050, with UNO. Here we have example for 1 sensor (playground.arduino.cc/Main/MPU-6050). Is it possible? If yes then do you have any example of code , as I am beginner in coding. I tried alot googling it, but found no useful info.
@AndreasSpiess
@AndreasSpiess 8 жыл бұрын
+Rahul Khurana This is not easy, bcause the 6050 only can have 2 addresses. So you need a trick which is not easy for a beginner. I had another guy asking for something similar and maybe, I make once a video. But not in the near future. I cannot explain everything, but you basically connect eachaddress selection pin of the 6050s to a different data pin of the arduino. Before you connect, you have to set the right pin to select the 6050. With the 6050 there is another problem: You have to calibrate each sensor and store the calibration values. Otherwise, they are not exact. Al-in-all, this is not a project for a beginner (at least, that's what I think)
@nektarioskourakis8331
@nektarioskourakis8331 5 жыл бұрын
thanks for the tutorial from chania crete....
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
You are welcome!
@deshraj9633
@deshraj9633 6 жыл бұрын
awesome man
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
Thanks!
@deangreenhough3479
@deangreenhough3479 5 жыл бұрын
Back again
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
Hope it helped!
@reednoel9418
@reednoel9418 6 жыл бұрын
@andreas Spiess, Please show me, how many LCD i2c can connect with Arduino Mega2560. I want connect with 14 lcd I2C, how to promotion. Thanks
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
This is a big topic. You have to google. I2C has 126 addresses, but most devices only have 1, 2 or 4 selectable addresses. So you can only connect this number of devices to one I2C bus.
@MagivaIT
@MagivaIT 5 жыл бұрын
woah what happened, it sounded like the speed of your voice and excited had been slowed down, look forward to normality soon
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
This is one of my first videos ;-)
@ecemcl1497
@ecemcl1497 6 жыл бұрын
Hello! We are working on a project using two mpu6050, temperature sensor, and a pulse sensor. How to put these all together into one Arduino Nano? Please help us. Hoping for your answer. Can we talk thru e-mail? :)
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
You can connect many sensors to one I2C bus of the nano. Just make sure that the two MPU6050 have different addresses (ADO pin)
@PetrasL_1976
@PetrasL_1976 7 жыл бұрын
Hi, I saw you have built your own i2c sensor with 3 ultrasonic sensors. But you did some programming on atiny, soldering and so on. Just wondering, if there are already build "converters/adapters" or something like this for regular sensors like "Soil Humidity Sensor" (lets say this goo.gl/RS92Fx). Thanks!
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
What is your intended scenario? usually, these sensors are connected directly ot a analog or digital pin of a Arduino without ATTiny needed.
@PetrasL_1976
@PetrasL_1976 7 жыл бұрын
Yes its ok to connect them directly. Just thinking what if i need 10 of them? I do not have 10 analog on inputs on arduino mini. And scenario is apsolutely crasy: i have 10 flowerpots with plants and i want to keep different moisture for each of them. Watering will be automated also... :) Probably i need separate arduinos or esp for each of flowerpot, but then i need 10 water pumps too for watering...
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
There are many different solutions to that. But if you have 8 ADC pins on one Arduino mini and you pay 4$ for such a mini, each plant costs only 50c. Which sounds reasonable to me. One ESP8266 per plant and a connection via Wi-Fi sounds more expensive... But the pump/walve and wiring issues are probably the biggest ones.
@mohamedfezari4955
@mohamedfezari4955 6 жыл бұрын
Thanks for teh Video, I wouldlike to connect 3 3-D accelerometers MPU6050 to one arduin using I2C Bus how can I do it
@AndreasSpiess
@AndreasSpiess 6 жыл бұрын
MPU6050 only have 2 selectable addresses. So it is not easy to connect 3 to the same I2C bus
@thekaiser1492
@thekaiser1492 7 жыл бұрын
Maestro!!
@AndreasSpiess
@AndreasSpiess 7 жыл бұрын
:-)
@3dmixer552
@3dmixer552 5 жыл бұрын
can I use 2 INA219 on 1 I2C Bus using ESP32?
@AndreasSpiess
@AndreasSpiess 5 жыл бұрын
The INA219 offers 16 slave addresses. If you chose two different addresses it should be possible. Please read the data sheet
How I2C Communication Works and How To Use It with Arduino
9:57
How To Mechatronics
Рет қаралды 1,5 МЛН
Violet Beauregarde Doll🫐
00:58
PIRANKA
Рет қаралды 40 МЛН
managed to catch #tiktok
00:16
Анастасия Тарасова
Рет қаралды 48 МЛН
Glow Stick Secret Pt.4 😱 #shorts
00:35
Mr DegrEE
Рет қаралды 11 МЛН
WILL IT BURST?
00:31
Natan por Aí
Рет қаралды 30 МЛН
What is I2C, Basics for Beginners
18:30
nandland
Рет қаралды 164 М.
Solving I2C Address Conflicts - TCA9548A I2C Multiplexer
24:29
DroneBot Workshop
Рет қаралды 102 М.
Easy MQTT Server Setup
7:35
bitluni
Рет қаралды 208 М.
477 Use the very attractive new ATTINY chips for your projects
14:34
Andreas Spiess
Рет қаралды 205 М.
#21 Two Equal Displays on One Arduino I2C Bus (Tutorial)
4:33
Andreas Spiess
Рет қаралды 62 М.
Connecting Arduino with multiple I2C devices
6:22
BlueDot
Рет қаралды 191 М.
I2C introduction: The protocol
15:47
Texas Instruments
Рет қаралды 44 М.
How To Find Unknown I2C Addresses Several Ways
17:32
Gadget Reboot
Рет қаралды 19 М.
Basics of I2C communication | Hardware implementation of I2C bus
6:48
Foolish Engineer
Рет қаралды 78 М.
Violet Beauregarde Doll🫐
00:58
PIRANKA
Рет қаралды 40 МЛН