Arduino as a Generic I2C Device SimulatorLast Updated on Tuesday, 13 September 2011 10:17 Arduinos can act as either I2C master or slave devices and because of that, can be very handy to use as simulators. I2C bus devices are common and writing Linux drivers in userspace or as kernel modules usually pretty simple. With datasheet downloads immediate and lots of boilerplate code in hand, I'm usually ready to test something long before the hardware shows up. That's where I find Arduinos acting as device simulators useful. I don't usually get carried away trying to implement all the device features. It's normally just simple reads, writes, writes before reads, double checking the endianess, etc..., basic communication stuff. You could get as elaborate as you wanted though. Some I2C devices are expensive and I might have to return them when finished. Taking a little time to verify the Arduino sketch is really a decent simulator helps when doing follow up work, particularly when the I2C device is just a small part of a larger project.
Here is a trivial example for an mt9p031 image sensor. (https://gist.github.com/866228)
With a little cut-n-paste, it's easy to simulate other devices. And you can hang a bunch of Arduinos off the bus at the same time all pretending to be different devices.
To connect the Overo to an Arduino you need a level converter for the 1.8v to 5.0v. You don't need pull-up resistors since both boards already have them.
Using a Sparkfun part (sku: BOB-08745), you can connect the two boards like this:
|
||||||||||||||||||||