The main source of energy in ecosystems is the sun. Plants capture solar energy through photosynthesis and convert it into chemical energy, producing organic matter. Animals and other heterotrophs obtain organic matter and energy by eating plants or other animals. Decomposers break down dead organic matter into mineral form in a recycling of matter and energy.