In recent years, researchers have proposed smart traffic light control systems to improve traffic flow at intersections, but there is less focus on reducing vehicle and pedestrian delays simultaneously. This research proposes a cyber-physical system for smart traffic light control utilizing traffic detection cameras, machine learning algorithms, and a ladder logic program. The proposed method employs a dynamic traffic interval technique that categorizes traffic into low, medium, high, and very high volumes. It adjusts traffic light intervals based on real-time traffic data, including pedestrian and vehicle information. Machine learning algorithms, including convolutional neural network (CNN), artificial neural network (ANN), and support vector machine (SVM), are demonstrated to predict traffic conditions and traffic light timings. To validate the proposed method, the Simulation of Urban Mobility (SUMO) platform was used to simulate the real-world intersection working. The simulation result indicates the dynamic traffic interval technique is more efficient and showcases a 12% to 27% reduction in the waiting time of vehicles and a 9% to 23% reduction in the waiting time of pedestrians at an intersection when compared to the fixed time and semi-dynamic traffic light control methods.