Hi! I need to use a MPU6050 gyro and a Ultrasonic sensor for my project. My Arduino Uno did not come with separate SDA and SCL pins, so I have to use the A4 and A5 pins for that purpose, and I have connected the Ultrasonic sensor with them.
\With no SDA and SCL pins available, and A4 and A5 already occupied, is there any way to use other pins like A0 and A1 for SDA and SCL connections?
SDA and SCL pins are a duplication of A4 and A5, they are not separate pins.
Hardware I2C is on A4 and A5. Maybe you can use a software I2C library on other pins.
I believe that it's better to move Ultrasonic sensor to the other pins.
it's better to move Ultrasonic sensor to the other pins
Agreed.
Hi! My A4 and A5 pins are already hooked up to a LCD and I want to connect a MPU6050 as well. In a separate thread, someone told me to use SoftI2CMaster library to use other pins as SDA ans SCL. But I don't quite know how to do that. I want to use A2 and A3 for I2C, and a code snippet would be very helpful.
I2C is a bus, and is intended to be connected to several devices in parallel.
The devices must all have unique I2C addresses.
Please do not start a new thread for every variation of the same topic.
I'll just try doing that. Thanks for the snappy reply!
Does not seem to work.
And yeah, won't do that again.
SQLinjector:
Does not seem to work.
And yeah, won't do that again.
What does
SQLinjector:
Does not seem to work.
mean?
Have you used a I2C scanner to prove that the two devices have different I2C address?
I meant that it wasn't working when I connected them in parallel.
I think I figured out the problem: I'm not connecting the SDA and SCL pins to 5v via resistors, or atleast that's what I learnt from a Youtube video.
Is there no other way than using resistors, cause I don't happen to have any resistors right now
SQLinjector:
I meant that it wasn't working when I connected them in parallel.
I think I figured out the problem: I'm not connecting the SDA and SCL pins to 5v via resistors, or atleast that's what I learnt from a Youtube video.
Is there no other way than using resistors, cause I don't happen to have any resistors right now
It is most certainly possible to connect multiple I2C devices to A4/A5. The project I am wrapping up has four ADS1115 modules, three PCF8575 boards, and a PCF8574 LCD all on the same I2C bus. Works just fine.
Have you checked each module to make sure the resistors are not already included? Only one resistor is needed on each pin A4 and A5, not per module. One each is required, none on either won't work.
Do you have the display working by itself when connected to A4/A5?
Do you have the MPU6050 working by itself when connected to A4/A5?
adwsystems:
Have you checked each module to make sure the resistors are not already included? Only one resistor is needed on each pin A4 and A5, not per module. One each is required, none on either won't work.Do you have the display working by itself when connected to A4/A5?
Do you have the MPU6050 working by itself when connected to A4/A5?
How do I find out if they come with resistors?
And yeah, both of them work just fine.
SQLinjector:
How do I find out if they come with resistors?
RtM. Look at the electrical schematics for the modules you purchased.
Alternatively, change to the hd44780 library and use the hd44780_I2Cexp library diagnostic sketch I2CExpDiag which will tell you lots of information about the modules on your I2C bus. I suggest running it per module with only one module connected.
SQLinjector:
In a separate thread...
Speaking of separate threads, please do not cross-post. Threads merged.
SQLinjector:
How do I find out if they come with resistors?
And yeah, both of them work just fine.
What is the I2C address of each device?