All organisms require energy, which primarily comes from sunlight through photosynthesis. During photosynthesis, producers like plants use sunlight to convert carbon dioxide and water into oxygen and energy-rich sugars. Producers and consumers then undergo cellular respiration, using the sugars and oxygen to produce energy, carbon dioxide, and water. This cycle of photosynthesis and cellular respiration allows energy from the sun to flow through ecosystems and be used by all organisms.