LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using the accelerometer MPU 6050 with the library Makerhub and Arduino.What's the purpuse of clock source and the I2C channel?

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 :

hhh.png1._ 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 :

dsfgd.png

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 : 

bAILALO.png

0 Kudos
Message 1 of 12
(5,443 Views)

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

 

 

0 Kudos
Message 2 of 12
(5,418 Views)

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? 

0 Kudos
Message 3 of 12
(5,400 Views)

@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? 


  1. First of all, not every I2C slave has a unique address. Some I2C slave devices have a configurable address, like some ADC boards where you can set an address using some pins (so you can use several such boards on the same I2C line)
  2. You do not need to set a zero value for the I2C Channel input, since its default value is "0" (and the connector pane is set for "Recommended" not "required"). 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...

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

0 Kudos
Message 4 of 12
(5,395 Views)

When you say :

 

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

0 Kudos
Message 5 of 12
(5,354 Views)

@HereFrank wrote:

When you say :

 

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

0 Kudos
Message 6 of 12
(5,350 Views)

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? 

 


@Blokk

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

0 Kudos
Message 7 of 12
(5,345 Views)

@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? 

 


@Blokk

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

https://www.raspberrypi.org/forums/viewtopic.php?t=33092

Message 8 of 12
(5,342 Views)

Oh I see. Thanks!!! By chance, Do you know how many i2c channels an arduino can have?

0 Kudos
Message 9 of 12
(5,334 Views)

@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?

0 Kudos
Message 10 of 12
(5,327 Views)