Particle swarm optimization (PSO) has been widely used in optimization problems. If an identification problem can be transformed into an optimization problem, PSO can be used to identify the unknown parameters in the model. Currently, most PSO based identification or optimization appications can only be applied offline. The difficulties of online implementation mainly come from the unavoidable simulation time to evaluate a candidate solution. In this papaer, the techniques for faster than real time simulation are introduced and the hardware implementation details of PSO algorithm are presented. We demonstrate the performance of the described approach by applying it to parameter identification of permanent magnet synchronous motor. The method can be easily implemented using dSPACEreg controller and other hardware controllers. The techniques can be also be extended to other online identification and optimization problems.