The easiest way to achieve this high frequency switching is to use a 555 timer integrated circuit (IC) - one of the commonest and most versatile ICs ever created. The circuit shown below (from the following article: Pulse Width Modulator with NE555 Timer Oscillator) is designed to be used as a dimmer for 12V DC light bulbs or a speed controller for a 12V DC motor.