How do the streetlights turn on automatically at night?
On the Flintstones, a small bird sits inside the light and turns it on every night before he goes to bed. In a modern streetlight, a small circuit replaces the bird and turns the light on when the amount of light falls below a certain threshold. A common light-sensing component is the cadmium sulfide photo-resistor, also known as a CdS cell. A photo-resistor changes its resistance based on the amount of light that hits it. When a lot of light hits it, it has almost zero resistance — it conducts electricity very well. When no light hits it, it has high resistance — it conducts electricity poorly. In an extremely simple circuit, you would wire a CdS cell directly to a relay (see How Relays Work), so that a lot of light would energize the electromagnet and a small amount of light would not. Usually, however, a CdS cell cannot draw enough current to activate the relay when light hits it. Therefore you need to add a transistor to amplify the current that flows through the CdS cell.