Based on the Cambridge IGCSE physics and mathematics, the method of optical refraction is explored to identify the sweetness of sugar water. Which include application of engineering design, system simulation, data acquisition and image processing. Although the background mathematics of digital image processing may beyond the high school level, fortunately, the Python narrative programming language is easy to understand and apply, and the maximum difference between the experimental and simulation results is 6% or less. The circular mask used for the first time needs further research.