Sun

Sun is the resource players need to build their plants, which makes it essential to create defenses against zombies. You need sun or you will be brainless in no time.

How to Use It
Each plant costs a certain amount of sun to plant, limiting the number of plants you can place on the lawn at a time. Your planting is also limited by the recharge or the "cooldown" rate of the seed packets. Also, upgrade plants cannot be planted unless the plant of which they are an upgrade of have already been planted, even if you have enough sun for them. The only plants that do not cost sun to plant are the Puff-shroom, its aquatic cousin the Sea-shroom, and Imitater versions of them.

How to Obtain It
Sun is obtained from Sun-producing plants, such as the Sunflower, Twin Sunflower and Sun-shroom, in addition to the player starting every ordinary level with 50 Sun. That's important, as that's the sun cost of the primary sun-producing plant, the Sunflower. Sun also falls from the sky in the daytime areas Day, Pool, and Roof. During the Night and Fog levels, Sun-producers are the only way to obtain Sun, so some of these plants must be planted to obtain more than the starting 50 sun. Sunflowers produce 25 Sun, Twin Sunflowers produce two 25-value sun which is 50 sun together, and Sun-shrooms produce 15 sun until they grow, after which they produce 25 sun. Sun can also be obtained when it is daytime. Sun falls every 10 seconds.

Conveyor-belt Levels
The player cannot obtain any sun in these levels. Instead, they are supplied with plants that come up from a conveyor belt.

Sun cost
In Survival: Endless, the Sun cost of each Upgrade Plant (Gatling Pea, Twin Sunflower, Gloom-shroom, Cattail, Winter Melon, Gold Magnet, Spikerock and Cob Cannon) will increase by 50 for every one of those planted. For example, your first Cattail will cost 225 Sun, but your second Cattail will cost 275 Sun.

Trivia

 * The maximum amount of sun you can get in Plants vs. Zombies is 9990, or if you have Cheat engine or PvsZ trainers, they appear 99999 sun. Any sun collected after this figure is achieved will not be added; however, new plants consume sun and decrease the available amount below 9990 (after which more sun can be gained again until the limit is eventually reached once more, etc).
 * This, along with the 15 sun increments from small Sun-shroom (or later on at Survival: Endless), is the only way to get sun that is not in multiples of 25 unless it is a full-sized Sun-shroom.
 * There is an Achievement called Sunny Days unlocked by getting 8000 sun. This can be easily acheived in the Survival: Endless or Survival: Roof.
 * Since level 1-1 does not send zombies until you plant your second Peashooter, it is also a good candidate for Sunny Days, though it will take a rather long time.
 * Survival: Endless is the only level where the cost of plants rises (the cost of Upgrade Plants rising for every one of each type currently planted on the lawn).
 * Also later on, you only get 15 sun units in Survival: Endless, no matter if it is sun coming from an sun-producing plant, or sun falling from the sky.
 * In Versus Mode, the zombie's currency is brains, it works the same as sun.
 * But in I, Zombie, you can collect Sun by eating Sunflowers. That's peculiar since zombies need brains, not Sun like plants. Maybe it has to do that if only one currency is used it will be Sun.
 * The Almanac says that Sunflower bounces (or sways) to a beat that only it can feel. But if you have multiple Sunflowers they will be un-synced. This is probably because only a certain Sunflower feels a certain beat, so each Sunflower feels another beat and they become un-synced.
 * If you dig up a plant, you don't get back the sun you used to plant it.
 * That's why you have to be careful in Last Stand, due to how you only have limited sun and cannot gain more.
 * Sun won't fall from the sky during the Night or Fog levels. That is why it is practically suicide (except on 2-1) to not use Sunflowers or Sun-shrooms.
 * There are Big Sun, which produce 50 Sun, this kind of sun will only appear falling from the sky only on Sunny Day Cancelled Mini-game.

More

 * Sunflower
 * Sun-shroom
 * Twin Sunflower
 * Sunny Days
 * Sunny Day