To get a PWM signal with 5khz frequency using Arduino Uno

To get three channels of PWM on an UNO you need to use two timers. Pick a PWM mode and calculate the value of TOP that will get you the 5kHz frequency.