In this talk I will review the operation of the power grid from the point of view of complex systems science, and discuss how smart devices that dynamically control their demand can be used to stabilize the load and reduce the frequency fluctuations.