Hello, finally I get arduino mini pro and accelerometer. Tried connect them together, but can't get communication working. I cannot use HW I2C (just because I use breadboard). So I wondered to use SoftI2CMaster library to emulate I2C by sw pins.
I don't know, If I'm configuring it right. So if anyone could check my code - configuration mainly of PINS and PORTS.
Connection should be fine.
Vcc -> 5V
SCL -> SCL
SDA -> SDA
GND -> GND
SCL on arduino mini pro is on pin marked as 6, SDA on pin marked as 7 - both should be on port D.
one small issue, I2C device addresses only go up to 127
so a loop to scan up to 255 is wrong , but at the same time it should give some output in the lower numbers...
no experience with softI2Cmaster. a quick scan on github. All functions seem to be written in assembler in the .h so no .cpp files used. (doesn't solve your problem, I know)
If this is right, last question could be about HW part of thing. Accelerometer is using 3.3V logic, so it's high is around 3.3V, what could be low for 5V logic ?
do you have pull up resistors?
for I2C you need typically 4K7 or with longer wires 2K2 (or lower) resistor between the SCL/DTA and +5V
Think that will also be true for softI2C
I cannot use HW I2C (just because I use breadboard).
No that doesn't follow at all.
If there is something stopping you using hardware I2C then the same thing also stops you using software I2C.
What is it about your bread board that makes you think you can't use the hardware pins?
robtillaart:
do you have pull up resistors?
for I2C you need typically 4K7 or with longer wires 2K2 (or lower) resistor between the SCL/DTA and +5V
Think that will also be true for softI2C
Yes, I have pull ups, but I used 10K, but also slow speed communication. I'll try test it with 4K7.
Northof49:
Is a breadboard and typical 6" long breadboard wires suitable for testing i2c devices?
Using of breadboard should be ok in my opinion. And wires I use as short as possible, not typical 6"
Grumpy_Mike:
I cannot use HW I2C (just because I use breadboard).
No that doesn't follow at all.
If there is something stopping you using hardware I2C then the same thing also stops you using software I2C.
What is it about your bread board that makes you think you can't use the hardware pins?
I cannot use HW I2C beacuse it is not possible to pin it into breadboard, because of arduino mini pro pins for I2C.
MateMatev:
I cannot use HW I2C beacuse it is not possible to pin it into breadboard, because of arduino mini pro pins for I2C.
There is a radical new concept in electronics it is called wires and soldering. You solder a wire to a pad and connect the other end of the wire to the bread board. Therefore allowing you to use the I2C hardware drivers.