ENERGY SAVING lights

I still don't like the transistor Q3 and diode D11.
The transistor has a voltage drop of about 0.6V over base-emitter. The diode has the same voltage drop. Therefor that part of the circuit is not okay.
You can keep diode D11 (or use a resistor of 10 ohm), and measure the voltage over D11 (or resistor) with an analog input. You can protect the analog input with a resistor of 1k to 10k.
You can select the internal reference, that changes the analog input range from 0-5 to 0-1.1 Volt.