It is important to study the micro sun sensors used in the micro-nano satellites whose load requirement is rigorous. In order to solve the integration compatibility problem of optical devices and processing circuits, a novel on-chip sun sensor based on standard CMOS process is proposed in this paper. The micro-wall structure is constructed by metal layers, and the PN junction is uniformly distributed on both sides as photoelectric diodes. The angle of incident light is calculated by detecting the ratio of photocurrents on both sides. The rationality and feasibility of the device are verified by the process realization, model establishment, numerical simulation and experimental testing in this paper. Finally, the on-chip solar sensor array chip is designed and fabricated whose mass and size are 1.5g and 304.2mm3 respectively. Then the detection accuracy is ±1.6° and the field of view range is 80°, which can meet the requirements of miniaturization.