LCD and piezo buzz interfierence

I have the arduino starter kit from arduino, and built project number 11 where it shows you how to control an LCD display(16 x 2). I wanted to add a piezo buzzer to make a simple tone before the LCD changes.

Whenever the display text end with “good” its starts to display weird symbols and the next time it writes the display seams to forget the first column. When it take out the piezo everything work how its supposed to. The breadboard is small yet the piezo doesn’t cover any of the wires controlling the LCD. I don’t understand why there is interference. If you have an idea i would be great full for a response.

here is the code controlling the buzzer and lcd:

reply = random(10);
lcd.print(“The ball says:”);

toneTime is set to 500
tonePin is PWM pin 9
the full code is in the atachment

sketch_lcdMagic_8.ino (1.48 KB)

I don't understand why there is interference.

Any oscillator will cause interference.

You need to decouple the supply to the LCD:- De-coupling

When it take out the piezo everything work how its supposed to.

When you say "take out", are you talking about electrically disconnecting the piezo or are you talking about software?

Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Is the piezo buzzer part of the kit?

Thanks.. Tom... :slight_smile: