Go Down

Topic: Is I2C the best way to mix different speeds and voltages ? (Read 667 times) previous topic - next topic

Krodal

My Arduino Mega 2560 with a few shields is getting to big.
I also want to connect other devices, like Arduino or ATmega or ATtiny boards.
Some of them are 5V, some are 3.3V.
Some use the internal clock, which could be anything between 1MHz and 16MHz.

I want to connect for example my Geiger counter to my Mega 2560.
And a 433MHz receiver is typical a (semi) standalone project.

Using serial communcation would require all serial ports, and a software protocol. Or using cascaded serial, which depends on the software in every slave board.
So perhaps setting the other devices as I2C slaves would be the best solution ?

If I use a level converter on my Mega 2560 board, I can connect all 5V and 3.3V I2C devices.

Is the I2C bus the least critial for small speed variations ?

CrossRoads

I2C works at 100KHz and 400 KHz.
Need software in every slave no matter what, got to be some brains there to recognize the address that master puts out and then respond with at least an ACK bit, and then receive data/commands from the master, or return data to the master.
If you had UART based serial, there is no clock line required, each device could have RS485 transceiver and be voltage indepedent also.

433 MHz receiver - is there a protocol there too? Like virtualwire between devices? Or do you have some unknown signal you want to pick up? Like a weather transmitter.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Krodal

The Arduino Wire library for slave mode is very easy.
I'm sure I can find a good library at http://www.avrfreaks.net for non-Arduino avr chips.

My question was: Is the I2C bus less critical for small timing differences ?
Since some use the internal clock which is not very accurate.
I could also use the UART at 1200 baud, that is slow enough to make it work on every device.

My 433 MHz receiver uses those very cheap receivers from Ebay.
I have a remote control that uses the rc-switch protocol: http://code.google.com/p/rc-switch
That code is even able to determine the pulse length and the codes for any of those.

retrolefty


The Arduino Wire library for slave mode is very easy.
I'm sure I can find a good library at http://www.avrfreaks.net for non-Arduino avr chips.

My question was: Is the I2C bus less critical for small timing differences ?
Since some use the internal clock which is not very accurate.
I could also use the UART at 1200 baud, that is slow enough to make it work on every device.

My 433 MHz receiver uses those very cheap receivers from Ebay.
I have a remote control that uses the rc-switch protocol: http://code.google.com/p/rc-switch
That code is even able to determine the pulse length and the codes for any of those.



As I2C uses a clock signal edge to signal that the data signal is valid, frequency accuracy is not an issue at all. It's said to be a synchronous communications link and as such does not require the sender and receiver to work at the same basic clock speed. The standard 100khz or 400khz are just 'standard' I2C bus speeds so that the manufactures of I2C ICs know how fast their logic has to be able to work at.

Lefty

Krodal

Thanks retrolefty.

What address range is available to use for my Arduino I2C-slaves ?
So I won't get into trouble if I add new I2C devices later on.

Headroom

If I remember correctly your can have 119 devices on the I2C bus. Some suggest its 128 but a good number of the addresses are reserved. Then of course not every I2C device allows to freely set its address. In case of address conflicts you may need to use a multiplexer.

Nick Gammons website is a very good resource for I2C " stuff" ( amongst many other things).

http://gammon.com.au/i2c
http://trippylighting.com

http://ledshield.wordpress.com/

Krodal

#6
Feb 02, 2013, 03:46 pm Last Edit: Feb 02, 2013, 03:47 pm by Krodal Reason: 1
This shows the reserved addresses : http://www.diolan.com/dln_doc/i2c-address.html
And at the bottom is a pdf file with a list.
And Adafruit has a list : http://www.ladyada.net/library/i2caddr.html

I think 0x30 ... 0x37 and 0x70 ...  0x75 are a ranges I could use.

Go Up