SDA and SCL conflict between DS3231 and I2C Serial Module!

Hi,

I would like to use the clock module DS3231 in conjugation with the serial interface I2C to work with the 16x2 LCD display.

The problem is that Arduino can only handle one SDA/SCL connection each time so you are forced to connect the LCD display in the old fashion, directly to the arduino.

So, how to connect two modules at the same time that use the same serial connection SDA and SCL?

Thanks, Rui

Just make sure the two modules have different addresses.

SCL and SDA are used for the I2C bus. DS3231 and the serial I2C LCDs are both I2C devices. Luckily, you can have multiple devices connected to the same I2C bus - each device has an address which the master uses to tell that device that it's the one it's talking to.

The i2c address for your DS3231 is 0x68. The display will be either 0x27 or 0x3F. Make sure that when you initialize the devices that you specify the right address. I2c can handle a lot of devices on the same bus. I have had 4 I think. Worked like a charm.

ChrisTenone: The display will be either 0x27 or 0x3F.

Assuming the address jumpers are unsoldered (default).

ruiseixas: The problem is that Arduino can only handle one SDA/SCL connection each time so you are forced to connect the LCD display in the old fashion, directly to the Arduino.

No. Wrong.

Just connect them both.

Where did you get that silly idea?

aarg: Assuming the address jumpers are unsoldered (default).

This is true, but the question the OP asked suggests they haven't modified the i2c address on their hardware.

As a helpful 'hint from heilman' when I change the address from default, I write it in white pen, right on the biggest IC on the device. The white ink can be read for a very long time.

Paul__B: No. Wrong.

Just connect them both.

Where did you get that silly idea?

Hi,

Because when I connect both I get gibberish on the LCD due to clock signals! However this only happen when I upload a program for the LCD, when I upload a program for the clock nothing is displayed...

Thanks, I will research more about the addresses thing.

Note that I2C and the serial port are two compleatly different things. If you get gibberish when uploading then you are not using the I2C you are using the serial port.

Grumpy_Mike: Note that I2C and the serial port are two compleatly different things. If you get gibberish when uploading then you are not using the I2C you are using the serial port.

Hi,

For me the I2C is the module while the serial is the connection... So I use both, the serial connection and the I2C module that connects to the LCD trough the 16 pins!

For me the I2C is the module while the serial is the connection.

Well it might be for you but the rest of the world does not make that distinction. You would do better to use the words the rest of the world does. I2C is an interface protocol, your module just uses that protocol.

So I use both, the serial connection and the I2C module that connects to the LCD trough the 16 pins!

So I have no idea what you mean by this. A schematic would be great as suggested Here

Grumpy_Mike: Well it might be for you but the rest of the world does not make that distinction. You would do better to use the words the rest of the world does. I2C is an interface protocol, your module just uses that protocol. So I have no idea what you mean by this. A schematic would be great as suggested Here

Hi,

Well the problem is that the module that connects to the LCD has no other name that I2C, and I thought that I2C was the reference of the module and not the communication protocol. Nevertheless I didn't got if I2C is the same as Serial or if I2C is the serial protocol or something like that.

The connections are quite simple, it uses the 4 connections in parallel between the Arduino Uno, the Clock module DS3231 and the I2C LCD INTERFACE, those connections as you may know are:

  • GND;
  • VCC;
  • SDA (A4);
  • SCL (A5).

Anyway, I will see more about the Serial protocols.

Thanks.

If you search for serial protocol you will get nothing to do with your system because your system is not called anything to do with serial, it is called I2C.

Each module that uses such a protocol has an address. You use that address to talk to just that one piece of hardware and no others connected to the same wires.

If you are saying that uploading code gives you a screwed up display then there is something drastically wrong with your setup. The only way for us to see what is if you post a schematic of your setup.

What are the programming changes, we need to do, if we connect multiple devices in i2c instead of i2c directly?Like I want to connect NFC Module V3, Real time clock DS3231 and LCD display..all to i2c..Also can i use the libraries of these boards??

shagun_8: What are the programming changes, we need to do, if we connect multiple devices in i2c instead of i2c directly?

There's no change to the code at all.

Yo- Rui,

The two I2C lines are called SDA and SCL. Connect all of your devices' SDA and SCL pins to the SDA and SCL pins on your Arduino (these are A4 and A5.) When you send data through the I2C using Wire (or some other library) commands, it will go to the correct device as long as you have setup the address of the devices. Usually this is through a begin() function, such as Wire.begin().

You don't really need to do anything with the data, the library code does all that. it's like serial in that respect, but it's a completely different communication protocol, software, hardware, intent, etc.

I'm sure I've got some I2C modules hooked up somewhere. Do you want a picture?

So how will arduino know...about address to communicate with?? I've seen some codes in which functions like wire.beginTransmission are used....which take in the value of device address.

Yes all code specifies the address you are talking to on the bus. You just use the address of the device you want to talk to. This is no different if you have one device or a hundred on the bus.

Well...how to use the address..? And also please can u suggest me the value of pull up resistor?

shagun_8: Well...how to use the address..? And also please can u suggest me the value of pull up resistor?

Pullup resistors in range 4.7-10K is usually recommended. Using 10K hasn't failed me yet.

Check Learning/Reference, select Libraries from line near top, then Wire. It contains an example that should be relatively easy to follow.

https://www.arduino.cc/en/Tutorial/DigitalPotentiometer

Wire.beginTransmission(0x??); // address of device
...

Of course, what you send and what responses you expect, depends on your hardware.