-3

On a small project, I have a DS3231 RTC module and a LCD I2C module that I'm trying to connect on a Arduino Pro Mini board. However, both the RTC and LCD require connecting the SDA and SCL to the pins A4 and A5 respectively.

The libraries do not seem to allow changing the connected pins. Why is that? I have other pins available, like A6 and A7, can those be used?

4
  • Wow! First question and already downvotes without comments or answer. This is a real nice community! I feel welcome! Jul 6 at 2:48
  • 3
    I guess, the downvotes are, because you didn't research your problem. you would find that I2C is a bus
    – Juraj
    Jul 6 at 5:01
  • 3
    SDA and SCL are the lines of the I2C bus. It being a bus means that you can connect multiple devices to it. Each device on an I2C bus has an address. You cann connect both devices on these pins and talk to each device one after another
    – chrisl
    Jul 6 at 5:51
  • @Juraj well, I'm asking because I'm researching. Seriously. It's like an employer asking for 5 years experience; someone has to give a guy a chance. Jul 7 at 16:59

1 Answer 1

0

Welcome, I understand where you are coming from, without a background you do not know what to ask. Were were all where you are at one time. I hope this helps. You need to do some studying on the I2C bus, online tutorials will make it easy. You you will find you can connect over 100 devices to it at one time The SCL and SDA lines go from module to module. Note each module has its own address, sometimes they are selectable. Some modules have pull up resistors, others do not. To keep it interesting the pull up resistors are mostly 10K but that is not a constant.

There are loading rules etc to be careful of if you have long wires or maybe more than three units. You need to add pull ups to each of the two lines (example: 4.7K from SCL to +5) or use something in the 3K range for a 3V3 system. The reason is because the bus has both dominant and recessive states where the recessive is high which the resistor provides. The SCL and SDA output/input on the parts have open collector/open drain outputs so they cannot source anything.

Once you have it hooked up you need to run a program called I2C scan or something like that. If you have wired it correctly it will give you the address of the module, you will probably get two or three as there is the RTC, Memory device and possible a temperature sensor.

The #1 rule is the Arduino A Power Supply it is NOT! A small module or two connected to the 5V out is fine but never connect a motor directly to any arduino you will probably fry the Arduino.

I use Vin and supply it with about 8 volts by using either a Buck or Sepic converter from a 12V 2A or larger supply. I do it this way because I get a more stable voltage on the Arduino because of the extra filtering etc built into the analog regulator section. Real nice when using the A/D, keeps things stable. Were here to help, ask questions any time and do not worry is some over eager person decides to vote you down. Read the guidelines etc and you will do great.

You can search online for "Arduino RTC" and find a lot of programs with software.

2
  • Thank you for this very helpful explanation! I had noticed a drop-down in voltage when connecting a 4 channel multi-function relay module, I already figured to connect it's power source directly to the power source, and NOT on the Arduino! I was not aware of the I2C protocol. I find a lot of the tutorial confusing since there are so many different modules and boards! It'll get clearer with time. Thanks! Jul 7 at 17:05
  • Just for fun answer your question in two weeks, you will be surprised at how much you learned. Have fun!
    – Gil
    Jul 8 at 0:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.