How to turn a regular sensor to I2C compliant?

Hi, Let's say you have a sensor who outputs to digital or analog. How do you turn this to something you can plug into a I2C bus?

Off of my head I'd plug it into an arduino and make it a slave device. Is there a cheaper option?

Thanks.

Off of my head I'd plug it into an arduino and make it a slave device.

By "it", do you mean the Arduino or do you mean the sensor? There is more to communicating via I2C than just the sensor.

Why do you want to do this? Analog and digital sensors are meant to be read directly, without the need for an I2C bus.

PaulS: By "it", do you mean the Arduino or do you mean the sensor? There is more to communicating via I2C than just the sensor.

Why do you want to do this? Analog and digital sensors are meant to be read directly, without the need for an I2C bus.

Yes, by it I means the sensor. Plugging the sensor into an arduino and making the arduino a slave device to be connected to I2C.

There are limited numbers of pins on the master arduino so it's best in some circumstances to go the I2C route.

You can use I2C expansion ports like the PCA9671 or the MAX7300 or the MCP23S17 or the PCF8575. These all give you digital I/Os.

Getting analogue signals over is a bit more tricky, you will have to do with an external I2C analogue to digital converter like the ADS7828 12 bit one, there are lots of others as well with various resolutions and prices.

thanks!

Looks like you can use the ATtiny85 to do this as well.

http://www.forkrobotics.com/2012/05/relay-control-over-i2c/