When I move the pedal up and down, the amp makes loud popping/crackling noises. The noises happen when the pedal is both on or off. I bought the pedal online, and it was used. What could be the problem?

My guitar is a Fender Strat, and my amp is a 15W Peavey Vypyr.
If I had to guess the variable pot (potentiometer) that controls the 'wah' needs to be cleaned. Pretty easy process but you have to be able to get to it and spray some electronics contact cleaner (like deoxit) in there. Like oiling a rusty socket. After that, I inspect the input and output jacks to make sure their connections are good and a bit of contact cleaner on these parts can't hurt either.