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
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 Video Tutorial 10: Twitter-controlled Mood Lamp   RS Components
Arduino Video Tutorial 10: Twitter-controlled Mood Lamp RS Components
5$ Arduino WiFi Module!? ESP8266 mini Tutorial/Review
5$ Arduino WiFi Module!? ESP8266 mini Tutorial/Review
1-Day Project: Arduino Uno and I2C OLED Display Challenge
1-Day Project: Arduino Uno and I2C OLED Display Challenge
Arduino Tutorial #4 - DC motors and servos
Arduino Tutorial #4 - DC motors and servos
Funduino Nano and Mega Review
Funduino Nano and Mega Review
Arduino Tutorial (Photocell)
Arduino Tutorial (Photocell)
Arduino Tutorial - 2. Erste Schritte (#2)
Arduino Tutorial - 2. Erste Schritte (#2)
Arduino Tutorial - 4. Variablen (#4)
Arduino Tutorial - 4. Variablen (#4)
Arduino Tutorial #9: Leonardo vs. Uno
Arduino Tutorial #9: Leonardo vs. Uno
Controlling Brushless Motors   Arduino Tutorial
Controlling Brushless Motors Arduino Tutorial
Burning Arduino (328/168) Bootloader with Arduino Mega (ATMega1280)!
Burning Arduino (328/168) Bootloader with Arduino Mega (ATMega1280)!
Arduino Tutorial - 9. Der Servo (#9)
Arduino Tutorial - 9. Der Servo (#9)
Arduino Controlled Stepper Motor
Arduino Controlled Stepper Motor
Arduino Tutorial #6 - HC-SR04 Ultrasonic sensor
Arduino Tutorial #6 - HC-SR04 Ultrasonic sensor
Tutorial 07 for Arduino: I2C Communication and Processing
Tutorial 07 for Arduino: I2C Communication and Processing
L298 Motor Control   Arduino Tutorial
L298 Motor Control Arduino Tutorial
Home made camera slider stepper motor - Arduino - Stepstick I2C LCD
Home made camera slider stepper motor - Arduino - Stepstick I2C LCD
Arduino Tutorial #7 - How to use the L293D Dual H-Bridge
Arduino Tutorial #7 - How to use the L293D Dual H-Bridge
Arduino DUE and Mega 2560 with CTE 3.2
Arduino DUE and Mega 2560 with CTE 3.2" TFT LCD Module with Font IC Demo

Did this video help you?

Thomy Schumaker: Hi, I'm hoping you might be able to help, here is my code for the slave in trying to receive data from the master, and below it is the error I'm getting with a <--- indicating where in the code its highlighting the error. Everything that I've looked up is showing I have all the code correct and I can't seem to find anyone with this same error with this variable, it's really got me stumped! // I2C Slave Code (Mini) #include void setup() { Wire.begin(5); Wire.onReceive(receiveEvent); //register event <------------ Serial.begin(9600); pinMode(2,OUTPUT); digitalWrite(2,LOW); } void loop() { } void receiveEvent(int howMany); { While(Wire.available()) { char c = Wire.read(); if(c == 'H') { digitalWrite(2,HIGH); } else if(c == 'L') { digitalWrite(2,LOW); } } } 'receiveEvent' was not declared in this scope Slave.ino: In function 'void setup()': Slave:8: error: 'receiveEvent' was not declared in this scope Slave.ino: At global scope: Slave:20: error: expected unqualified-id before '{' token

magnus östgren: Nice tutorial. But so mutch unneccesary code. Why make an IF statment when you could just do wire.write(c); inte the uno code

ZVG: Can you pls! do an example using i2c with three arduinos where one master polls two slave slaves who send a couple of floats back to the master.

Robelle Ann Lipura: is this working between two arduinos?

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. 

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

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

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

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!

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

Christo Pretorius: Thanks

Fabio Ruiz: very useful, thank you!

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)

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

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

YTPmaster: Im 17... 

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

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..

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: Buffering!!!!

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

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.
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