16x2 LCD display problem

Hi,
I programmed my arduino to control lighting of a room and display in lcd some words. the operation is going very well, but it happens that during switching of the lights through a relay the display shows rubbish(I don't have a proper word to write) but they are kind of PI's. But when I press the reset button it displays the proper sentence. How can I solve that problem. Sorry for my English if is poor.

Sounds like a classic "EMC" problem. I suspect you are getting some voltage spikes coupling back to your Arduino+LCD circuit or the supply voltage to the Arduino is being affected by the relay coil load. There are two potential voltage spike sources, the relay inductive kick back and a voltage spike coupling somehow from the lighting circuit.

Does it happen when the light bulb is removed in the lighting circuit?

Does the glitch happen when the relay closes or when it opens or both?

Is the lighting circuit isolated from your Arduino power source?

Does you Arduino power source also power the relay, does it have sufficient current capability to power the relay properly?

Are you using a bare relay with DIY circuit or a relay shield?

Can you provide a schematic (wiring diagram)?

It does not happen when the light bulb is removed in the lighting circuit

It happen in both openning and closing of the relay

Arduino is drwing power from my pc. The 5v from arduino terminal is used to power the lcd, the relay is powered from a 12vdc rectified from the lighting circuit. The grd of the 12vdc is connected to the ground of arduino to avoid continuous kicking of a relay.

I am using a bare relay

How are you sinking current from the 12V coil?

OK, you may have an Earth loop where the circuit is Earthed via the PC and Earthed at the lighting circuit thus there is a path for voltage spikes from the lighting power circuit. Can you try powering the Arduino from an isolated source other than a PC, such as a battery pack or a laptop (that does not have a charger plugged in), just temporarily to test this theory?

I assume the lighting circuit is AC at 220V. In which case do you have a suitably rated supression capacitor across the relay switch contacts?

What sort of lighting bulbs are being switched, ie incandescent, low energy or LED?

On safety.... If the lighting is at 120/220 VAC I assume you are taking sensible precautions to prevent electrocution etc. The lighting circuit is appropriately fused I hope...