Some improvements are needed in spraying with orchard sprayers. During the spraying process, it is also applied in the spaces between trees of cases where the tree spacing is high. For this reason, extra pesticides are consumed and harmful substances are added to the soil. Thus, the production costs increase and efficiency decreases, and also pesticide residues transferred from soil to crops cause health problems. In this study, ultrasonic sensors are placed on the right and left surfaces of the machine facing the tree. With the help of these sensors, the pesticides are sprayed as long as an object is detected within a certain distance. Spraying is stopped when the object is not detected, and this operation is carried out automatically. The developed system consists of an electronic control unit, solenoid valves, and ultrasonic sensors, controlled by a microcontroller. Thanks to this automatic control system, high rates of savings are achieved in pesticide consumption and the addition of harmful substances to the soil is prevented. In addition, thanks to the its compact structure, it can be easily mounted on existing sprayers that are controlled manually.