Using two IC2 devices at the same time, possible?

Hello folks,

I've just picked up one of the Adafruit FM Transmitters and got it hooked up to my Arduino UNO successfully,
The next thing on my list is to program a little automated wavelength search in order to find some unused airwaves.
In order to tie this little project all together I am going to have to somehow display the selected frequency and because I had one lying around, I decided to try using my Sainsmart 16X2 LCD display, also IC2.

I might be missing something dumb but I'm finding it tricky to work out both if and how I can have two IC2 devices plugged into my Arduino Uno, both the library's seem to use Analog 4 and 5 For SDA and SCL ... without any experience of writing library's I ventured into the code to see if I could track down some kind of define for those two pins, but couldn't.

Any idea how I might go about changing (if even possible) the pins on one of my IC2 components to say... 2 and 3?

Cheers

Hello Wires

I2C is designed so that multiple slave devices can be attached to the bus (SDA and SCL). Each device has a different address and the master sends the address of the device just before it reads from it or writes to it.

The device address is built in to the device. Can you post links to your two devices?

And here is a link to an I2C tutorial: Tutorial: Arduino and the I2C bus – Part One | tronixstuff.com

Regards

Ray

Ahh so I would simply have to wire them both into the A4 and A5 pins?

and

http://www.sainsmart.com/sainsmart-iic-i2c-twi-serial-2004-20x4-lcd-module-shield-for-arduino-uno-mega-r3.html

(but the 16x2 variant)

From a quick look at the info on those links, the default I2C address for the radio is 0x63 (63 hexadecimal), while the LCD address is said to be 0x3F. So no clash.

But to check things out, you can connect each of the devices to the Arduino in turn and run an I2C address checker program like this one:

http://forum.arduino.cc/index.php?topic=197360.0

That will confirm that your hardware connections are OK. Once you get positive result for each device individually, connect them both at the same time and you should see their two addresses reported by the checker.

I would simply have to wire them both into the A4 and A5 pins?

That's right. Both are 5V devices that will work directly with the Arduino. You need to check whether you need to add pullup resistors on SDA and SCL, or whether they are on one / both of the breakout boards.

You need to check whether you need to add pullup resistors on SDA and SCL, or whether they are on one / both of the breakout boards.

Whoops, I went ahead and plugged everything in and whipped up a bit of code to test them both running at the same time, it seems successful, is it possible I am doing damage/they might not work as intended?

No, you're OK :slight_smile:

Sounds like one or both breakouts has pullup resistors. If they were not present, you might have problems communicating with the devices.

Awesome,

Thanks so much for the tips!

Electronics certainly isn't my forte (neither is programming to be totally honest) but I'm having a tonne of fun putting together this in-car radio transmitter.

Next step is to write some nice code to scan the frequencies and I'll pretty much be set with the prototype :slight_smile:

Might be useful:

http://forum.arduino.cc/index.php?topic=261189.0