Cadmium (Cd) pollution in soil is a serious threat to food security and human health, while, currently, the most widely used detection methods cannot accurately reflect the content of heavy metals in soil. Soil heavy metal detection combined with microelectronic sensors has become an important means of environmental heavy metal pollution prevention and control. X-ray Fluorescence spectrometry (XRF) can capture the excitation spectrum of metal elements, which is often used to detect Cd (II). However, due to the lack of high-performance optoelectronic devices, the analysis accuracy of the system cannot meet the requirements. Therefore, this study proposes a high-detection-efficiency photodiode (HDEPD) which can effectively improve the detection accuracy of the analyzer. The HDEPD is manufactured based on a 0.18 μm standard complementary metal-oxide-semiconductor (CMOS) process. The volt-ampere curve, spectral response and noise characteristics of the device are obtained by constructing a test circuit combined with a spectral detection system. The test results show that the threshold voltage of HDEPD is 12.15 V. When the excess bias voltage increases from 1 V to 3 V, the spectral response peak of the device appears at 500 nm, and the photon detection probability (PDP) increases from 41.7% to 52.8%. The dark count rate (DCR) is 31.9 Hz/μm2 at a 3 V excess bias voltage. Since the excitation spectrum peak of Cd (II) is between 500 nm and 600 nm, the wavelength response range of HDEPD fully meets the detection requirements of Cd (II).