In this paper, a dynamic obstacle avoidance strategy for mobile robots is proposed. The strategy consists of two key elements: an on-line reference generator and a control scheme to make the robot track the reference signals so as to reach a pre-specified goal point. To generate the online reference signals, a harmonic potential field for dynamic environments is exploited. The potential field is modified on-line, in order to make the robot avoid the collision with obstacles which move along non a-priori known trajectories with time-varying speed. The proposed multi-level sliding mode controller is capable of making the robot move tracking the prescribed reference signals determined by the trajectory generator. The simulation results confirm the good performances of this approach.