In General, the traffic light system only used certain amount of time to regulate vehicle traffic with the same time format for each intersection. The number of vehicles at each intersection is not always the same, there is a very crowded intersection and there is a lonely intersection of vehicles, but the timing of the traffic light remains the same at each intersection. So there is often a buildup of vehicles on one side of the road that culminates in congestion. This study focuses on the development of smart traffic light systems using Arduino Mega 2560 AT Mega 2560 microcontroller which will automatically work based on the number of vehicles and the sensor which used to count the number of vehicles that passing through each inersection is ultrasonic sensors. On the application, ultrasonic sensors will calculate the number of vehicles at the time the intersection enables the red lamp. The number of vehicles that detected by the sensors will be converted into long green lights, the more vehicles that detected by the sensors, it will be longer the time of turning on the green light, and vice versa. In this system the duration of the traffic light is not constant but follows the number of vehicles detected by the sensor. The method used to adjust this time length is a fuzzy logic algorithm with the Mamdani fuzzy reasoning using Matlab software. Test results based on the simulation of fuzzy logic in MatLab show that the fuzzy logic algorithm can be used to meet the goal of optimal traffic control, the duration of a given time based on number of vehicles. The higer numer of vehicle that are detected by sensor, the longer the duration of a given time, and the lower vehicle, the more briefly given time duration.