This circuit automatically turns a motor cycle's headlight on and off, independently of both the light and ignition switches, provided the battery is fully charged. The first stage uses the 22O resistor and ZD1 to hold transistor Q1 off while the motor is not running; it draws about 2mA. Once the battery voltage exceeds 7.0V during charging, Q1 begins to turn on.
The last stage uses the 22O resistor and ZD2 to turn on transistor Q2, which pulls the base of Q1 down, switching it hard on. In conjunction with the Vbe drop of Q2, ZD2 will turn off Q2 at a battery voltage of about 6.7V. In practice, this means that the headlight will be on most of the time while the motor is running and charging the battery. Heatsinks are required for both transistors. The circuit can be mounted adjacent to the battery with a single lead going to the headlight power feed.
circuit from http://www.extremecircuits.net/2010/01/motor-bike-headlight-controller-circuit.html