how to control 30 relays with arduino uno having only few output pins available

I am using arduino uno board for home automation i need 30 appliances to be controlled...so how can i control 30 relays with few output pins available on the board.
and i have one more doubt .....that how to use an external power supply for powerin up the relays...,because i cannot put this much load on the UNO board....for one or two relays it was okay...,but for 10 to 20 relays..i have to go for another powersupply...but how to connect...plz help me out

You could use an I2C port expander like MCP27017 which give you 16 input/ouptut.
Then all you need in code is to set the outputs you want refering to that chip address.
With just 2 chips you can have up to 32 outputs.Imagination is your limit.
You can have up to 127 chips like this in the I2C bus in a short distance (few centimeters)
You will need a high Current source to support all those ralays when they are all on!
Also notice you canot directly connect the ralays on the MCP27017 pins, you must use some kind of power stage or a opt-copler(recommended)
Take that in mind
Happy programming

(deleted)

sir,
thankyou for the reply
i m a beginner in arduino uno,i wanted to know the actual connection between the mcp27017 and uno. if u have any link then plz let me know.

mithun_shetty:
I am using Arduino UNO board for home automation i need 30 appliances to be controlled...so how can i control 30 relays with few output pins available on the board.

Well, this would be one way to do it (you would need two).

mithun_shetty:
how to use an external power supply for powering up the relays because i cannot put this much load on the UNO board. For one or two relays it was okay.

You really should not be driving any relays using power from the Arduino board. The above shield uses a separate power feed.