We implement an experimental system based on optical levitation of a silicone oil droplet to demonstrate a damped driven harmonic oscillator. The apparatus allows us to control all the parameters present in the differential equation that theoretically describes such motion. The damping coefficient and driving force can be manipulated in situ by changing the pressure in the apparatus and by applying a variable electric field. We present two different experimental procedures. First, a transition from the overdamped to underdamped regimes is demonstrated by gradually lowering the air pressure. The characteristic resonance associated with an underdamped driven harmonic oscillator is observed by studying how the amplitude of the oscillation varies as a function of the driving force. Second, in order to observe qualitative differences between the overdamped and underdamped regimes of a harmonic oscillator, three driving functions (sine, square, and sharp delta pulses) were separately applied, both at atmospheric pressure and under vacuum conditions. Our overall aim is to design a hands-on apparatus that is easy to use and that allows undergraduate and graduate students to observe and manipulate the basic physical processes associated with a damped driven harmonic oscillator.