Irigation system - Uni project

Hi everyone,

I am studying CS, and one course is about Arduino. Now, I am completely new to Arduino, but with a bit of help from good ol YT, I was able to understand how all the components work, and basically i've finished wiring everything when I discovered I have quite a big issue that I am not sure how to solve.

The project - Components:

  1. Arduino (I have an ELEGOO kit with everything below included)
  2. Led RGB for humidity state (blue - wet, green - dry)
  3. Two LEDs (green - system started, red - system offline)
  4. Humidity sensor (I have a DHT11 - i know it's not a good sensor, but doesn't matter)
  5. LCD screen
  6. Pushbutton
  7. RTC module
  8. Keypad.

The issue I am having is that the 2 pins that I was planning to use for the RTC (SCL and SDA) are somehow connected to A4 and A5. However, due to the complexity of the project, I need 22 pins - 20 are the normal ones (0-13 digital A1-A5 analog), and the 2 extra (SCL and SDA) for the RTC, and if I try to put an LED for example on the A4/A5, when I use the RTC, it will also light the LED.

Can you please advise? I am not really sure how to proceed. Thanks a lot!

LCDs come in an I2C version too.

Avoid using D1 and D0.

An Arduino Mega has lots of pins.

I know about the D0 and D1, but I already have bought a kit, I wouldn't want to buy another thing.

Show us a good schematic of your proposed circuit.

Show us a good image of your ‘actual’ wiring.

Unfortunately I don't have a schematic - I haven't found an app to do it, but these are the pictures of my wiring

Take a look at the Nano, it has two additional A/D inputs. The rest of it is just about the same, including the processor.

So to "translate" a bit the pictures:
Pins 0-7 -> Keypad
Pins 8-13 -> LCD
Pins A0-A5 -> LED's and DHT11
Pins SCL and SDA -> RTC (at least that's what I would like to do).

D0 and D1 are RX/TX

A4 and A5 are the SCA and SCL pins.

You need a higher pin count Arduino

Yes, I know about D0 and D1. I just don't put anything in those pins for the moment.
About A4 and A5 I know those are usually SDA and SCL, but on my board, i have 2 extra pins called SDA and SCL next to AREF. I was thinking maybe I could use those 2, and block A4 and A5 somehow (use them just as digitalWrite).

The SDA/SCL signals are shared on those pins for your connivence.

So basically the only thing i can do is to buy a Mega...
Got it, thanks!

A4 is directly wired to SDA, A5 is directly wired to SCL, there is no way to separate them, because the A4 & A5 pins from the atmega328 are the I2C pins. The extra SDA and SCL labeled pins are mostly for compatibility, because some processors use different pins for SDA / SCL, and having those dedicated pins allow a shield built for an UNO to work on another board. As an example, on a Mega SDA is pin 20, and SCL is pin 21, and are also connected to the SDA / SCL pins.

The LCD display and RTC can share the I2C bus if you get an I2C backplane for the LCD.

Thanks a lot David. I will buy a Mega in this case.

Pencil and paper works extremely well. The photos are useless.

Have you considered whether an ADC expander module, such as the ADS1015 or ADS1115 would work?

OP is using the analog pins for digital I/O, and does not appear to be using the internal A/D at all.

Sorry, but I have no idea what are you talking about. However, in my kit there's a 74HC595. Seems to do what I need - maybe it will be enough.

You can use that to drive the LCD. That will save 3 pins. You will have to find a library which supports an LCD1602 display driven by a 595 type shift register.
Better, as has already been said is an I2C backpack for the LCD. You can share the I2C bus (A4/A5) with the Real Time Clock (RTC).
Example: I2C LCD Backpack-DFRobot

Probably a good idea - I2C devices will help in the short term, but projects like this have a tendency to balloon and you may well find yourself scrabbling for pins again.