Arduino Tutorial #10: Arduino To Arduino I2C




People Who Liked This Video Also Liked

Tutorial 10 for Arduino: Interrupts and Hardware Debouncing
Tutorial 10 for Arduino: Interrupts and Hardware Debouncing
Arduino Tutorial - 10. Der Schrittmotor (mit Adafruit Shield) (#10)
Arduino Tutorial - 10. Der Schrittmotor (mit Adafruit Shield) (#10)
Curso de Arduino 10: Ping
Curso de Arduino 10: Ping
Arduino Tutorial #10: Arduino to Arduino I2C
Arduino Tutorial #10: Arduino to Arduino I2C
Arduino Tutorial #2 - Sketch structure. variables and procedures
Arduino Tutorial #2 - Sketch structure. variables and procedures
Arduino Tutorial #1 - Getting Started and Connected!
Arduino Tutorial #1 - Getting Started and Connected!
Arduino Tutorial #3 - Shift Registers (74HC595)
Arduino Tutorial #3 - Shift Registers (74HC595)
Arduino Tutorial #4 - LCD displays. Libraries and Troubleshooting
Arduino Tutorial #4 - LCD displays. Libraries and Troubleshooting
Arduino Tutorial #9: Leonardo vs. Uno
Arduino Tutorial #9: Leonardo vs. Uno
Controlling Brushless Motors   Arduino Tutorial
Controlling Brushless Motors Arduino Tutorial
Arduino Tutorial #5 - Digital Voltmeter. Arduino Analog to Digital Converter
Arduino Tutorial #5 - Digital Voltmeter. Arduino Analog to Digital Converter
L298 Motor Control   Arduino Tutorial
L298 Motor Control Arduino Tutorial
Arduino Tutorial (Photocell)
Arduino Tutorial (Photocell)
Arduino Tutorial #7 - How to use the L293D Dual H-Bridge
Arduino Tutorial #7 - How to use the L293D Dual H-Bridge
Arduino Tutorial - 9. Der Servo (#9)
Arduino Tutorial - 9. Der Servo (#9)
Arduino Tutorial #3 - Functions. return values and variables
Arduino Tutorial #3 - Functions. return values and variables
Arduino.Tutorial 06. Display LCD 16x2
Arduino.Tutorial 06. Display LCD 16x2
Tutorial 07 for Arduino: I2C Communication and Processing
Tutorial 07 for Arduino: I2C Communication and Processing
Arduino Tut. #8 - Wireless RF Links Tutorial & Noise Reduction
Arduino Tut. #8 - Wireless RF Links Tutorial & Noise Reduction
Arduino Stepper Tutorial - Using Sparkfun Big Easy Driver to create a single axis CNC
Arduino Stepper Tutorial - Using Sparkfun Big Easy Driver to create a single axis CNC
Arduino Nokia 5110 LCD Tutorial #2 - Getting Text on the Display
Arduino Nokia 5110 LCD Tutorial #2 - Getting Text on the Display
Arduino Tutorial #4 - DC motors and servos
Arduino Tutorial #4 - DC motors and servos

Did this video help you?

Hans de Bruin: It didn't work on my setup. The reason was that for some reason nothing prints to serial when I put it in void setup. When I move the Write.requestFrom to void loop it works fine. I haven't figured out yet why this is...

Vajira Lasantha: Thank you for the video. I'm gonna work on a project where an Attiny85 should send data to an Atmega328 via serial connection. Is it possible to use I2C for this? Thanks again. 

float: legend! Thanks for the clear and concise tutorials... 

PJ Jones: Hi Again, Can you do a tutorial the same as this one but using a raspberry pi as master instead of the arduino. Can you use python please. Or is this too much to ask of you. I only ask as there is no one else that has done this. Thanks ever so much - pj

bas k: I did exactly the same with my mega and uno, it does not work. The led is not turning on ( i tested it, it is not the led)

Christo Pretorius: Thanks

PJ 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

Daniel Wekesa: This stuff doesn't work....

John Spuzzum: This is a great tutorial.. I just wish I knew coding a bit better. I'm currently trying to add a 2nd Atmega328 to the DIY Arduino Uno that I made to run high powered LEDs, but my script fades up and down like sunrise & sunset, with each string's on/off times 15 minutes less than each other, all configured by the user seting the main on/off times through the controller, with all datas stored in the EEPROM. Problem is.. the 328 only has 6 pwm pins, and I kinda need more. That's where the $4 Atmega328 chip as a slave sounds better than a $60 Arduino Mega. I understand the coding enough to where I can just put the same LED commands from the master to the slave.. but it's the determining the LightsOn/LightsOff times from the master to the slave I'm confused about. I can set an "if" staement that can start LightsOn time, but it can't perform it's fade to sunset countdown if it doesn't know when sunset is.. which is held in the master's EEPROM. And I don't want to limit the device to a certain daylength.. otherwise it's just as easy as to do the math in the slave's script. Is there a way where the master can talk with the slave's EEPROM? It would be nice if they could be combined as one. :P

Fabio Ruiz: very useful, thank 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 Wire.read() 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!

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

YTPmaster: Im 17... 

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?

snaprollinpitts: cool, I didn't know you could do that

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

YTPmaster: 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 again..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
Rating:
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