Sending 16 bit and 32 bit numbers with Arduino I2C

I’ve been using I2C a lot lately and something that keeps popping up is the need to send large numbers.  I2C normally only sends a single byte at a time so you are limited to 255 as the largest number.  This post will show you how I break large numbers apart to send them over I2C and reassemble them on the other side.

Continue reading “Sending 16 bit and 32 bit numbers with Arduino I2C”

Advertisement

Arduino i2c problem sending multiple bytes

I ran into a bit of a weird problem a little while back when using I2C on Arduinos.  I friend also had the problem recently so I figured maybe it was common enough that this post could help other people.  The problem occurs when you have the master request a certain number of bytes from the slave.  Except when the slave sends the bytes back, they all show up as -1 except for the last one.  Here is some example code and a workaround solution.

Continue reading “Arduino i2c problem sending multiple bytes”

ATtiny i2c Slave

I’m working on a project where I need several sensors that communicate back to a central processor.  Since I’ll have several of these sensors I need them to be cheap and the ATtiny85 jumped to mind.  The only problem is that I’ve never used i2c with the ATtiny series before.  I read dozens of “tutorials” about it from around the web and couldn’t find a nice simple example.  This is my solution.

Continue reading “ATtiny i2c Slave”