Unsupervised data clustering is an important analysis in data mining. Many clustering algorithms have been proposed, yet most of them require predefined number of clusters. Unfortunately, unavailable information regarding number of clusters is commonly happened in real-world problems. Thus, this paper intends to overcome this problem by proposing an algorithm for automatic clustering. The proposed algorithm is developed based on a population-based heuristic method named particle swarm optimization (PSO). It overcomes two main issues in automatic clustering, namely determining number of clusters and cluster centroid. In the automatic clustering using PSO (ACPSO), the exploration is conducted by particles comprising of two sections. Herein, time-varying tuning parameter is applied. Furthermore, sigmoid function is employed to handle infeasible solution. In addition, K-means is applied to adjust the cluster centroids. Method validation using four benchmark datasets reveals that TPSO outperforms other two previous methods namely DCPSO, DCPG, and DCGA. Overall, ACPSO has better accuracy and consistency.