Go Down

Topic: Question | I2C protocol - sensors (Read 752 times) previous topic - next topic

WisterDesigns

Hello everybody,
I heard that you can't connect IR recievers/senders, Leds, relays etc. to the I2C protocol. What is the reason? Can someone please explain why this things can't be used in I2C protocol and maybe give some more examples of things that can't be used in this protocol as well?
Thanks!

PaulS

Quote
What is the reason?
I've got a piece of hardware (a LED for instance). I want to connect it to a concept (that's what a protocol is - a definition for how to exchange data). How do I connect them?

Can you see that the question doesn't even make sense?

The art of getting good answers lies in asking good questions.

WisterDesigns

People told me that in order to control the IR Sender/Reciever I have to connect in to a normal digital pin (I/O pin) because the I2C isn't able to control the IR Sender/Reciver and my question is why it doesn't able to control the IR with a I2C protocol?

PaulS

Quote
my question is why it doesn't able to control the IR with a I2C protocol?
Does your IR transmitter understand that it is an I2C device (that is that it is to be connected to the I2C pins, have an I2C address, and understand the I2C protocol)? I seriously doubt it.

I have never seen an I2C LED, either.

Do you even know that I2C means, or what it it used for?
The art of getting good answers lies in asking good questions.

WisterDesigns

That's the point, I don't really understand what the I2C does and why I can't connect even simple parts like Relays and leds to the I2C protocol. Can you please explain me a bit? I read but didn't understand it!

PaulS

Quote
Can you please explain me a bit?
Lets start with what I2C means. It's actually IIC - Inter-integrated circuit. It's a means for allowing two integrated circuits to communicate with each other.

Typically, these are ICs that are on the same board, and that need to share some data.

An LED is not an integrated circuit, and has not idea what to do with data. The same applies to a relay.

An IR receiver may be part of an integrated circuit. An IR transmitter might also be part of an integrated circuit.

Such circuits might be connected to the I2C bus, and might be able to exchange data using the I2C protocol.

But, such circuits would be unusual. Typically an IR transmitter is driven by a library that modulates the carrier frequency based on the data to send. Typically, an IR receiver sets a pin HIGH or LOW based on the modulated frequency variations. The times between the HIGH/LOW and LOW/HIGH transmissions have meaning, based on other protocols.

If something is not an integrated circuit that knows how to send/receive data using the I2C protocol, it does not make sense to ask why you can't send it data using the I2C protocol, or receive data that follows the I2C protocol.

It's like asking why elephants can't make ice cream.
The art of getting good answers lies in asking good questions.

WisterDesigns

It's not recommended to connect IR transmitter/reciver to I2C protocol? Better to use a normal I/O pin?
And as I understand the only things that has what to do with the data are used in I2C protocol yes?

PaulS

Quote
It's not recommended to connect IR transmitter/reciver to I2C protocol?
If they are not I2C devices, no. Doing so doesn't make sense.
The art of getting good answers lies in asking good questions.

WisterDesigns

#8
Nov 09, 2016, 04:38 pm Last Edit: Nov 09, 2016, 05:53 pm by WisterDesigns
If they are not I2C devices, no. Doing so doesn't make sense.
Are there any difference in terms of efficiency and speed between the I2C and the I/O pins?
And what about the SPI protocol?

gpsmikey

Take a look at what I2C is (Google is your friend - look at some of the tutorials out there).  Then look at the data sheet for your sensors (IR etc. you are talking about).  Do they have anything in common in the way you can get data from them and I2C?  I2C (and SPI etc.) are a type of serial protocol for transferring data - if your sensor does not understand that, you are trying to explain quantum mechanics to your cat ... it isn't going to work.  You need to spend some time and do a bit of reading on just what I2C is.
mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3

Go Up