I am so sorry, I am new to this forum. I autoformated code now and I am trying to make a schematics but i have some problems because i don't know how to "draw" uln 2003 and relay. So i reconected relay to external 5v and GND, i connected external GND to arduino, I chececked all connections and they look good. After an hour and a half of operation, the arduino started to reset every time the relay was turned on or off. And that. A few days ago I tried to disconnect the 230 V (light bulb and dimmer power supply) from the mains. The Arduino didn't reset then (at least not while I was around checking it.)