Phase transitions in equilibrium systems: microscopic models and mesoscopic free energies