static electricity setting off my arduino project

I am building a Vending Machine that plays a tune when you put a quarter in the machine. i just used a photointerrupter to signal to my arduino when a quarter passes through it. then the arduino speaks to the adafruit sound fx board to play my tune. The problem is that static electricity is making the machine play the song on its own. if i ground myself and touch the metal frame of the machine, everything is fine and it needs a quarter to work. when i walk away, and rub my hands on the carpet and come back to touch the machine, i get a little tiny shock and it sets off the music. Ive also done it with a screw driver with a rubber handle ( i hold the rubber handle, rub it all over the carpet, come back and touch the metal part of the machine, and it goes off). I tried grounding the machine. i attached a ground wire to the frame and plugged it in. still not working properly. Please help!!

Schematic is need - how you connect photointerrupter ? picture ?

it’s a bit messy but i’ve blurred out the other stuff that doesnt have to do with the photo interrupter. i tried to label most of it. the three wires circled in blue are to the Photo Interrupter itself. Two 100 ohm resistors are used and one 4.7K ohm resistor. the purple line shows a C1815 transistor. And the white wire that I circled in grey goes to the arduino. I also drew out a schematic that is more clear. Ill attach both images.

So you connect the white board with one wire to arduino and one wire from arduino to adafruit sound fx board ?

photo interrupter does not need extra transistor it is make circuit to much sensitive include static electricity discharges.

Can be connected directly to arduino digital pin such as pin #2

google - photo interrupter arduino

okay ill try this and see what happens. thank you so much!

0.1uF capacitor from digital pin to the ground may help

which digital pin? the one that i'm using already? I dont want you to spend tons of time but if it wouldnt be too much would you help me on how to physically do that? thanks. I have capacitors.

this may be useful information. I bypassed the arduino and just put the white wire that normally goes to the arduino and put it in the pin for the sound board directly and i dont have an issue with the static setting off the sound. the problem is that i need the arduino to sustain the signal because the quarter passes through the photo interrupter too quickly for the sound board to pick it up. all i have the arduino doing is making that signal last longer so that the sound board knows to go off. thanks

I am not expert in programming, but post the code which you are using. Delay function can make a very long pulse.