Can i connect all of them to my arduino Uno R3 ?

invader7:
Hello , i want to start a new project and i will need:

1x LCD (16x2 - characters and numbers)
1x Keypad (1-9 only)
1X GSM Shield
2x Fan
1x temperature sensor
1x water sensor
1x co2 sensor
40x leds

Are there enough ports on arduino UNO R3 for my project ? Thanks...

The LCD needs 6 pins, but 5 of these can be shared with other devices. The keypad is probably a 3x3 matrix, so it will need at least 3 input pins, which can't be shared because you have no other push buttons or switches etc. The fans may need PWM output pins if you want to control their speeds. The temperature sensor, water sensor and CO2 sensor can probably be done with 1 input each.

For the 40 LEDs, it depends on how you need to control them. A 5x8 matrix is probably the way to go, if you are prepared to write the multiplexing software.

So we're left with:

1 LCD enable pin (even if you can share the other 5 LCD pins with the LEDs)
3 keypad input pins (the other 3 pins can be shared with either the 5 remaining LCD pins or the LED pins)
2 fan output pins
3 input pins (CO2 sensor, temperature, water)
13 LED control pins
? GSM shield pins

That comes to a minimum of 21 pins plus however many the GSM shield needs. This is more than a Uno has. It will be much simpler to use an Arduino Mega than expand the outputs of a Uno with shift registers or other devices.