Arduino Tutorial #10: Arduino To Arduino I2C

People Who Liked This Video Also Liked

Arduino Tutorial #10: Arduino to Arduino I2C
Arduino Tutorial #10: Arduino to Arduino I2C
Arduino Tutorial #9: Leonardo vs. Uno
Arduino Tutorial #9: Leonardo vs. Uno
Arduino Tutorial - 9. Der Servo (#9)
Arduino Tutorial - 9. Der Servo (#9)
Arduino Tutorial - 7. Die RGB LED - Teil I  (#7)
Arduino Tutorial - 7. Die RGB LED - Teil I (#7)
How To Control A Stepper Motor With An Arduino Uno
How To Control A Stepper Motor With An Arduino Uno
How To - Arduino Reflow Oven P1
How To - Arduino Reflow Oven P1
Arduino CNC Program
Arduino CNC Program
i2c communication between an Arduino Uno and an Arduino Mega 2560
i2c communication between an Arduino Uno and an Arduino Mega 2560
LCD Display YwRobot Arduino LCM1602 IIC V1
LCD Display YwRobot Arduino LCM1602 IIC V1
Use an Arduino to draw pictures on an oscilloscope using XY mode
Use an Arduino to draw pictures on an oscilloscope using XY mode
Arduino Tutorial - 8. Die RGB LED - Teil II (#8)
Arduino Tutorial - 8. Die RGB LED - Teil II (#8)
Arduino Tutorial - 6. While-Schleife (#6)
Arduino Tutorial - 6. While-Schleife (#6)

Did this video help you?

Eric Mooney: Great tutorial! Thanks. However, mine doesn't work per your video. I have a Yun as my master and a Mega as my slave. You have the while loop in the master setup method and not in the loop method. When I look at the slaveSender example, the while loop is in the loop() method. And I can get that to work. Could it be a timing issue that I'm experiencing? Like you said, I've tried putting delay's in the code but to no avail. Thanks again for the video!

Peej Jones: Fantastic tutorial - thank you very much - very understandable. If you wanted to add yet another arduino, am I right in thinking that you would wire an additional arduino to the master as you have done the leonardo and in the software just use another ID instead of 5? thanx

Roy Gevers: Thanks for this clear tutorial. You've really helped me a lot!

robin vermillion: it tried this with 2 nanos . i had pin13 blink on the master when it is not transmitting. the moment i send a H it quits blinking. it never gets out of the transmit section. of the code. the previous video it worked were i would send a variable from a pot to the nano (pwm_led). then send the data back to the uno(lcd.) And display the info. the communication worked on that on but the nano pwm_led didnt work. it must have something to do with the nano itself..

Basim Hafidh: It is very interesting video. I would appreciate if you can do video on I2C communication between Arduino (master) and Picaxe(slave). 

Henrik Wille: is it possible to communicate just by using the normal pins? example:connect arduino1 and 2 with a cable from "pin 4" on Arduino 1, to "pin 4" on Arduino 2? arduino 1, digitalWrites(pin4,HIGH), while arduino 2, digitalRead(pin 4)? and just checking if its high?

TheVirtualFlight: I love windows 7, 8 sucks...

TheVirtualFlight: Buffering!!!!

humanHardDrive: I'm also quite interested to hear more about you're experiment.

humanHardDrive: Did you include the wire library.

humanHardDrive: You should watch my video talking about the I2C EEPROM, the first of the two I2C videos. That covers asking the slave device for data, and waiting for all the data to be received. In this way, you don't need to specify how much data you want.

hgdingman: these tutorials are terrific! Is there any reason that you don't use the power bus rails (+/-) on the breadboard? Back in TTL days I always brought VCC and VSS to the rails, then it was handy for tying pullup resistors and bypass capacitors when needed, as well as extra-short jumpers to power devices on the breadboard

Brian Keyser: Thanks for this great video! How would you recommend connecting multiple Arduino's that each have their own power source? ie) wall warts If you tie the 5V lines like in the video, wouldn't this put all the voltage regulators of the Arduino's in parallel? -I've read that having regulators in parallel is not recommended because one of them will end up doing all the 'work' since they are never perfectly identical, but I've never tried it. Any suggestions?

humanHardDrive: Each Arduino would need it's own power supply, not power each subsequent Arduino off only one.I tie the power lines together to ensure the logic levels obey.

Binam Ghimire: they are connected to master arduino

iSolarSunrise: You just get that component datasheet, do what it tells you to do, and you can communicate it. If you read the datasheet but can't understand it, you can get some help on the net. Can you share the IMU sensor? I can also help you if you want.

qazwsx12: great tutorial.... it's pronounced "eye SQUARED see" though, NOT "eye 2 sea". this because it's the inter integrated circuit (iic or i2c) bus.

humanHardDrive: I can definitely do that.

Pulsed Neutrino: when it wakes I set it to do lots of stuff including serial print adc data and such so its clear when it does not wake. hmm i'm going to try to flash some different bootloaders on see if perhaps they work.

Austin Wilkins: Awesome tutorial man! Thanks! Could you also do one with communication over I2C with a sensor?

joblessalex: Please make a tutorial for the multiple click speeds

Tom Schneider: Hey cool vid! Here's a tip: I2C is spelled "I squared c" because it's normally written i²c

Binam Ghimire: sketch_mar10c:3: error: 'Wire' was not declared in this scope sketch_mar10c.cpp: In function 'void loop()': what kind of error is this?

pongAssist: Sorry, I'll clarify as soon as my code calls a wire.write function the entire system hangs. I even loose the debugging code in my serial window. However, no actual error is reported by arduino.

humanHardDrive: To my knowledge the only way to get that to work is using an Ethernet shield.

helpmode: If they are not on the i2c bus I would just send to bytes per sensor to the slave device. 10 bytes in total. The first byte indicates the sensor (number 1 - 5) fallowed by its value. This should work, or am I wrong?

humanHardDrive: Are the ping sensors on the I2C bus, or just connected to one of the Arduinos?

humanHardDrive: How do you mean? Ethernet communication is digital, not analog.

carbine000: Love the "low disk space" notification. Great video. Thank you!

Hisham Gadollo: Awesome tutorial Dude :) with a sexy voice, of course I don't know why are the number of viewers is still low, though this tutorial is awesome !!! But I hope you could post any tutorial about how to use Ethernet shield for reading analog signal for example

Binam Ghimire: thanks for the support but i pull it off. the error was quite weird though..i erased the whole thing and wrote it worked! Keep posting new videos !!.nice work!!!!

Martin Spurgin: The final build is to be mounted into a small box 5x5x5 cm for attachment to the stratospheric riser. So its looking like arduino nanos or another of the of the smaller ones may work nicely, minimal effort. The first prototype was with some ancient micro controller I found in a draw at the research institute. but I had to program those from the ground up with C++. The arduino system seems slightly more accessible.

Hisham Gadollo: I mean, reading the analog signal from LM35DZ for example by using the arduino And then printing its on a web page

Enrique Gómez: How many meters of wire can I put between the Arduinos.

humanHardDrive: I tie the two together so that a slight change in the voltage of one, will be balanced out by the other's remaining constant. Thus ensuring safe communication.

humanHardDrive: Any sensor you have in mind?

Buzz Werd: If the master is connected to the PC then you can use a Processing sketch and the Processing UDP library on the PC to be your Ethernet device that talks to your Arduino via Serial. No I haven't done this, just made sure it's there. The Processing IDE for your PC is free. Arduino is the Wiring side. They work as a pair by design. search processing -- web addresses not allowed on YT Smart thing to do is join the forums what you use. The Arduino forum is very friendly and usually helpful.

Buzz Werd: I will stick with XP. I can have 2+ IDE windows with monitors open, both Arduinos plugged in at the same time and download sketches to both at the same time, I've done it many times. Perhaps the secret is to set up each IDE window with a serial port and board type right from the start. But still I can't get SoftwareSerial on UNOs to reliably talk faster than 57600 baud. I2C might be faster for 2 wire and give me multi-device bus capability? So far for speed/device compatibility I've used SPI.

Pulsed Neutrino: do you perhaps know please why when I use 5v on my uno it allows wake from sleep using half supply voltage and above on pin 2 but when I run it off a 3.7v lion even full battery volts cannot wake it? kind thanks

pongAssist: Thanks very much for the tutorial. It helped me to configure an i2c system with one master and two slaves, but for reasons I don't understand, the system is freezing each time I attempt to run it. A description of my problem, a schematic, and my code can be found by searching "Arduino I²C freezes after startup" on Stack Overflow. I'm sorry, I'd give a direct link, but youtube won't allow me to. Do you have any idea what might be wrong with my i2c setup? --Thanks

Jake Hemmerle: Great video! Learned a ton:)

humanHardDrive: I'd need to see your code to see why you're getting that error.

humanHardDrive: It's easier for more to show the connections to the chips in relation to other components by direct jumping rather than using the buses.

Binam Ghimire: i am using two arduino UNO , one as a master and another as a slave. Here master is the writer and slave is the reader. I have to take readings from 5 ping sensors in master and transmit it to slave and process it. i was able to setup circuit, transmit from 1 ping sensor and send it to slave and store it for further processing. However,in the case when there are 5 sensors, and the data is constantly being transmitted, how do i knw the signal recieved is from which particular sensor?

01xflame: Hi, I was wondering if it is possible to use UDP to send a command string (i.e turn led on) to the master to control a slave (another arduino)? if so, i was wondering how you can dissect the UDP message so that the slave can understand it.

humanHardDrive: What do you mean by "freezes"? Does it give an error, or is it just not working?

Binam Ghimire: yes i did..

Martin Spurgin: I think the crux of the problem lies in the line Wire.requestFrom(5,1); in the master code, is there a way of doing this without defining the number of bytes and just allowing the slave to build a string or something to then be written back to the master? Also my sensor looses dynamic range from 2^10 (1024) bits down to 2^8 (256). Any help with any of this would be appreciated but all problems aside, would just like to say again, fantastic tutorial series.Top work!

Antti Vahtera: Thanks for the tutorial, I liked it. I have one (or two) questions if you will. I plan on doing a project that would require multiple (probably 5) remote sensors (prob. Nanos) to send data to a master Arduino when "thing A" happens. So is my only way to continually poll the slaves from the master, or can the slaves themselves initiate data transfer? Do I just connect all the arduinos in parallel to the same wires SCL to SCL to SCL, etc.?

Martin Spurgin: Thanks for the swift feedback. I'll have another crack at that today and see how I get on. The project is to profile ambient intensities of UVA-B-C and the V and B optical bands at increasing altitudes out to around 35 km. So the project consists of 5 photo diodes, a mini SD data logger, an RTC time stamping system and a tri-axial GPS unit. So I have all but the GPS working and tested on one arduino uno and am looking at I2C capability as the next phase is miniaturisation.
Arduino Tutorial #10: Arduino to Arduino I2C 4.9 out of 5

Featured Video

How to Insulate Walls

Arduino Tutorial #10: Arduino to Arduino I2C