A car battery is not what you want. What you want is a deep cycle marine battery. They are better suited to the UPS application. To make an inverter you need a transformer. On the primary side is your battery, a switch and an oscillator. Pick a frequency, start switching, and out the secondary comes AC. It might not be a sinewave, but hey it's your first one.
Do you want to build everything from scratch or put it together from modules.
Buy a battery charger, a small inverter (50W or 100W will do) and a SPDT relay with a mains powered coil. Connect the battery to the charger and the inverter input to the battery. The relay coil goes straight across the mains, the load is connected to the pole, one way is connected to the output of the inverter and the other is connected straight to the mains. When the mains fails the relay will switch the load from the mains to the inverter, there will be a short delay but it shouldn't matter.
Do you plan to connect anything else up to the inverter?
The inverter isn't critical, providing the output voltage and frequency are correct for your energy saving lamp.
Also a car battery isn't realy suitable for an inverter, you need a sealed lead acid battery designed for cyclic charging and discharging. A car battery is only designed to give short bursts of energy and is not meant to be discharged much, you need a battery designed specifically for this purpose.
it'l be great if i can light up a 24W lamp with it for like 2 Hours.
and isnt Car battery much cheaper and easily availb rather then using sealed lead battery.
secondly lead battery wont last that long or will it.
A properly sized lead acid battery will last a darn site longer than a car battery!
Assuming you need 24W and the inverter is 80% efficient you can calculate the size of the battery as follows:
[latex]P_{IN}= \frac{24}{0.8} = 30W[/latex]
[latex]I_{IN}= \frac{30}{12} = 2.5A[/latex]
[latex]Ah = 2 \times 2.5 = 5Ah[/latex]
Luckily you'll be alright with a cary battery in this case as most car batteries are over 50Ah and you only want 5Ah.
The battery needs to be >5Ah so a car battery would do.
The inverter needs to be rated for >24W.
30W is the calculated input power for the inverter with a 24W load assuming it's an efficiency of 80%.
Battery capacity is measure in amps per hour.
A 1Ah battery can supply 1 amp for one hour or 2 amps for half and our or half an amp for two hours.
A 2Ah battery can supply 2 amps for one hour or 1 amp for two hours.
If the inverter is drawing 30W then the current will be 2.5A, you want your battery to last for two hours, a 2.5Ah battery would only last for one hour, a 5Ah battery will last for two hours and a 7.5Ah battery would last for three hours so as long as it's >5Ah it doesn't matter.
I suppose that you will have to discover the hard way why an automobile battery is unsuitable for your application. How many people have to tell you this before it sinks in?
I disagree, although car battery is not suitable for most cyclic applications though in this case it'll be fine. I would agree if he wanted to power a 100W load for four hours but a 30W load for two hours won't be a problem, especially if it's going to get fully recharged immediately afterwards.