04-10-2018 08:31 PM - edited 04-10-2018 08:41 PM
Hello everyone! I'm new using arduino and labview and I try to measure vibrations with the accelerometer MPU 6050 using arduino. I have seen a few of tutorials and read a little all about the topic.
My question is about the library Makerhub from Labview to the accelerometer MPU 6050. I do this program following a tutorial :1._ how you can see, the block of open have a branch whose name is "clock source" that is associated to the constant see it on the screen (Internal 8MHz Osc). This confuse me a little becouse it's seem like if the MPU 6050 is the one that generate the clock pulse. And for what I read about the I2C communications protocol the device that do this is the master, that in this case is the Arduino. And the other hand, it's possible choose other constant values like :
Someone can explain me what's mean every possible opción and why I should use the first that is "Internal 8MHz Osc" ?
2._ Why the thre blocks : Open, read and close are associated to one branch that is a constant 0, that define the I2C Channel? Why can be needed several Channels? . I mean, this confuse me a little becouse for what I read all the devices that are connected with a i2c bus, only need one channel, becouse all the devices are connected in series like this picture :
04-11-2018 12:57 AM - edited 04-11-2018 01:00 AM
Answering your question 2.:
Did you google for I2C? Wiki: https://en.wikipedia.org/wiki/I%C2%B2C
"Why can be needed several Channels? . I mean, this confuse me a little becouse for what I read all the devices that are connected with a i2c bus, only need one channel, becouse all the devices are connected in series like this picture"
No! Do not confuse and mix the data communication scheme with the physical layer! The physical layer consists of 2 wires (SDA, SCL). But the "communication layer" lets you communicate with several I2C devices from Arduino in an independent way!
If you have more than one I2C device, you need to communicate with them using different unique I2C addresses. Read the description of the protocol, you can address multiple slaves from your Arduino using the I2C "2-wire" (data and clock wires) bus.
More info here: http://www.learningaboutelectronics.com/Articles/Multiple-I2C-devices-to-an-arduino-microcontroller....
04-11-2018 05:23 AM
Thanks for the answer!! Sorry maybe I wrongly ask my question. I know that every device have a unique address. What I don't understand is that constant Channel that in this case is 0 . Why it's needed and why the three blocks of the MPU 6050 Open, read, and close need to be connect it to that constant? I think that knowing the addres of every device it's enough, but for what I see Is it needed set a I2C Channel too?
04-11-2018 05:40 AM - edited 04-11-2018 05:45 AM
@HereFrank wrote:
Thanks for the answer!! Sorry maybe I wrongly ask my question. I know that every device have a unique address. What I don't understand is that constant Channel that in this case is 0 . Why it's needed and why the three blocks of the MPU 6050 Open, read, and close need to be connect it to that constant? I think that knowing the addres of every device it's enough, but for what I see Is it needed set a I2C Channel too?
edit: i cleaned up the text a bit.
edit2: so in short: the I2C address is the address of the I2C units at the I2C protocol level. The I2C Channel address is the address of the I2C interface board/expansion in the Arduino/RPi device level...
04-13-2018 05:00 AM
When you say :
- . But imagine you have a Raspberry Pi, with multiple I2C boards (I2C masters) connected. Then you need to address which I2C board you want to use...
So, You're saying that if a have some several devices connected to a Raspberry PI and that devices can be masters, Do I must to set what device I want to use as master ?, and to establish that , I select the I2C Channel that I want.
So in the case that I have some system where are connected a Arduino, a Raspberry Pi and two sensors. In this case I must set what device must be the master, Maybe the constant 0 in this case mean that the Arduino will be the master, and the constant 1 that Raspberry Pi will be the master
Is something like that?
04-13-2018 07:20 AM - edited 04-13-2018 07:22 AM
@HereFrank wrote:
When you say :
- . But imagine you have a Raspberry Pi, with multiple I2C boards (I2C masters) connected. Then you need to address which I2C board you want to use...
So, You're saying that if a have some several devices connected to a Raspberry PI and that devices can be masters, Do I must to set what device I want to use as master ?, and to establish that , I select the I2C Channel that I want.
So in the case that I have some system where are connected a Arduino, a Raspberry Pi and two sensors. In this case I must set what device must be the master, Maybe the constant 0 in this case mean that the Arduino will be the master, and the constant 1 that Raspberry Pi will be the master
Is something like that?
No. I am a bit confused what you try to ask. How do you want to connect an Arduino and a Raspberry Pi, this is completely unrelated to the I2C module question...
Either you have an Arduino, OR you have a Raspberry PI, you can connect several I2C interfaces to it. If you have a single I2C interface, its I2C Channel address will be "0". If you have multiple I2C interfaces connected to the same controller (either RPi or Arduino, etc.), then you can distinguish between them using different I2C Channel addresses. But I never used such config, so I am not entirely sure. But this what makes sense to me, since the I2C addresses (not the "Channel" ones, but the ones at the I2C protocol level) belong to the I2C devices. Usually the Arduino (or RPi) acts as the I2C master, and you can connect several I2C slaves to the I2C interface!
So the Channel address identifies the I2C interface <-> controller connection, the I2C addresses identify the connections between the I2C master and I2C slave(s)...
EDIT:
"So in the case that I have some system where are connected a Arduino, a Raspberry Pi and two sensors."
Well, if you have a PC and you connect an Arduino, and a Raspberry Pi as well, you anyway need to use two different RS232 port connections! So you cannot mix I2C addresses between these two devices. Two totally different context levels...
04-13-2018 11:04 AM
Sorry for the mistake, but when you say
you can connect several I2C interfaces to it. If you have a single I2C interface, its I2C Channel address will be "0". If you have multiple I2C interfaces connected to the same controller (either RPi or Arduino, etc.), then you can distinguish between them using different I2C Channel addresses.
So the Channel address identifies the I2C interface <-> controller connection, the I2C addresses identify the connections between the I2C master and I2C slave(s)...
I don't understand so well why I will want that my Arduino, for example , have multiple I2C interfaces, what advatage give me that?
@BlokkSo the Channel address identifies the I2C interface <-> controller connection, the I2C addresses identify the connections between the I2C master and I2C slave(s)...
I know that the importance of the I2C addresses is that allows to the master know where is the slave. But what's the importance of the address that identifies the I2C interface ?
04-13-2018 11:27 AM - edited 04-13-2018 11:28 AM
@HereFrank wrote:
Sorry for the mistake, but when you say
you can connect several I2C interfaces to it. If you have a single I2C interface, its I2C Channel address will be "0". If you have multiple I2C interfaces connected to the same controller (either RPi or Arduino, etc.), then you can distinguish between them using different I2C Channel addresses.
So the Channel address identifies the I2C interface <-> controller connection, the I2C addresses identify the connections between the I2C master and I2C slave(s)...
I don't understand so well why I will want that my Arduino, for example , have multiple I2C interfaces, what advatage give me that?
@BlokkSo the Channel address identifies the I2C interface <-> controller connection, the I2C addresses identify the connections between the I2C master and I2C slave(s)...
I know that the importance of the I2C addresses is that allows to the master know where is the slave. But what's the importance of the address that identifies the I2C interface ?
I guess when they designed the communication API, they decided to use an address for the I2C in case if you want to use multiple I2C "ports" on your board (Arduino, RPi, etc.). But here I am only guessing, maybe someone with real knowledge will come and clarify.
And you ask what advantage it would bring to use multiple I2C interfaces? Imagine, you buy two I2C slave devices, but they come with fixed I2C slave addresses (and they are the same!), no way to change it. In such case, you could use 2 I2C buses on your RPi. Read a discussion here:
04-13-2018 11:58 AM - edited 04-13-2018 12:01 PM
Oh I see. Thanks!!! By chance, Do you know how many i2c channels an arduino can have?
04-13-2018 12:21 PM
@HereFrank wrote:
Oh I see. Thanks!!! By chance, Do you know how many i2c channels an arduino can have?
What do you mean? How many I2C slaves can be connected to a single I2C bus on Arduino, or whether the Arduino can have more than one I2C bus?