0

hello guys i want to ask about 2 things first one is i'm connecting and arduino uno attached to a usb host sheild and transferring data of a mouse coordinates to 10 arduino leonardo i'm using the standard speed 100 normal mode my wires is all about 10 cm long

  1. i need to speed up the comm to fast mode how to make this ? and the line of code where to put it in the code and in the master or slave ?

  2. what about the pull-up resistors ? does arduino uno includes built in pull-up resistors ? does it needs to disable it and put my own pull up resistors ? i’m using wire library

3

i need to speed up the comm to fast mode how to make this

Wire.setClock(400000);

and the line of code where to put it in the code

Just after Wire.begin() in setup(). Wire.begin() sets the speed to 100,000 and you need to then override that afterwards to set it to 400,000 (or whatever speed you want to run at).

and in the master or slave ?

In the master, since it's the master that generates the clock.

what about the pull-up resistors ? does arduino uno includes built in pull-up resistors ?

Yes, but they're too high for reliable I2C operation. You should add your own resistors in the region of 1kΩ.

does it needs to disable it and put my own pull up resistors ?

No, yours will just be in parallel with them, with the net result of a small reduction of overall resistance.

| improve this answer | |
  • so i need a total of 2.2k ohm ? is it good enough ? so i will check in the data sheet the internal one and calculate to be in the total 2.2 ? – mohamed shalaby Jun 30 at 13:52
  • 1
    Each of SCL and SDA need a pullup in the region of 1kΩ to 4.7kΩ. I use 1kΩ. That's 1kΩ each, not two 1kΩ resistors in series. The internal pullups are so big you can ignore them. – Majenko Jun 30 at 13:55
  • even if i’m having 10 slaves arduino leonardo i will put a1kohm on each scl and sda ? – mohamed shalaby Jun 30 at 14:43
  • There is only 1 scl and 1 sda. – Majenko Jun 30 at 14:47
  • yes i know that , i mean the external resistor is depending on the number of devices of slaves and the distance between them and the seed of clock so if there’s 10 slaves of leonardo of 50k ohm each internal resistor sobthe number is huge – mohamed shalaby Jun 30 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.