Go Down

Topic: Can we extend Arduino I2C pins? More SDA and SLC Pins? (Read 3388 times) previous topic - next topic


Mar 28, 2011, 07:18 pm Last Edit: Mar 28, 2011, 07:54 pm by LucidGold Reason: 1
I have a topic discussing my issue with getting an Optical mouse Sensor and Compass to work on a single Arduino here: http://arduino.cc/forum/index.php/topic,55891.0.html

The topic above is under "Sensors". I am not trying to double post, but I believe I need project guidance. My expensive way to "extend" arduino I2C is to just using another arduino unfortunately, which is making my project too big. Here is my current solution to communicate with two I2C devices:

Any guidance or help is much appreciated.


Real I2C devices have addresses and can share the I2C bus.  Your problem is that one of your devices is "I2C-like" but is not I2C.  Replace the ADNS-2620 with a real I2C device or, as I recommended, the ADNS-3000 which uses SPI.

Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp


So using two arduinos is the only way to resolve this ASAP. It will take time to understand how ADNS-3000 would work, then I need to buy parts to have the complete mouse using ADNS-3000. Sparkfun has the breakout for ADNS2620, which is what I am using.

this sucks.


I2c uses addresses, in fact 7 bits of them so you can have up to 127 devices in a single i2c bus, you can also use bit banged i2c to talk to your mouse and use the real i2c to talk to the green board.


Mar 28, 2011, 08:32 pm Last Edit: Mar 28, 2011, 08:35 pm by LucidGold Reason: 1


Could you direct me to the right bit-bang method?

I tried to implement Software I2C for Hmc6352 Compass http://www.arduino.cc/playground/Learning/Hmc6352.

I have looked at:
.CPP: http://blinkm-projects.googlecode.com/svn/trunk/blinkm_examples/arduino/BlinkMSoftI2CDemo/SoftI2CMaster.cpp
.H:  http://blinkm-projects.googlecode.com/svn/trunk/blinkm_examples/arduino/BlinkMSoftI2CDemo/SoftI2CMaster.h

I did not use this because there is no Software RECIEVE method.
.CPP: http://code.google.com/p/fivevolt/source/browse/Quadcopter/Arduino/Telemetry/SoftTWI.cpp
.H: http://code.google.com/p/fivevolt/source/browse/Quadcopter/Arduino/Telemetry/SoftTWI.h

Code compiles but I always get 0.00 degrees. I used A5 and A4 because using Wire.H through the same code (replace every "compass." with "Wire."), I am able to get compass data. However, when I switch to SoftTWI I get 0.00.

Code: [Select]

#include "SoftTWI.h"

SoftTWI compass;

void setup()
 Serial.begin(9600); // Initiate Serial
 compass.attach(A5, A4);

void loop(){
 compass.send(65);     // Send "Get Data" command, info from Datasheet
 delay(100);         // interface command delay, info from Datasheet
 compass.requestFrom(0x21, 2); //get the two data bytes, MSB and LSB
 byte MSB = compass.receive(); // Result will be in tenths of degrees (0 to 3599)
 byte LSB = compass.receive(); // Provided in binary format over two bytes."
 // Compute result from the two bytes results
 float myres = ((MSB << 8) + LSB) / 10;
 // Display result
 Serial.println(" degrees");

Any thoughts?

Go Up