An orchard sprayer prototype running a variable-rate algorithm to adapt the spray volume to the canopy characteristics (dimensions, shape and leaf density) in real-time was designed and implemented. The developed machine was able to modify the application rate by using an algorithm based on the tree row volume, in combination with a newly coefficient defined as Density Factor (Df). Variations in the canopy characteristics along the row crop were electronically measured using six ultrasonic sensors (three per sprayer side). These differences in foliage structure were used to adjust the flow rate of the nozzles by merging the ultrasonic sensors data and the forward speed information received from the on-board GNSS. A set of motor-valves was used to regulate the final amount of sprayed liquid. Laboratory and field tests using artificial canopy were arranged to calibrate and select the optimal ultrasonic sensor configuration (width beam and signal pre-processing method) that best described the physical canopy properties. Results indicated that the sensor setup with a medium beam width offered the most appropriate characterization of trees in terms of width and Df. The experimental sprayer was also able to calculate the application rate automatically depending on changes on target trees. In general, the motor valves demonstrated adequate capability to supply and control the required liquid pressure at all times, mainly when spraying in a range between 4.0 and 14.0 MPa. Further work is required on the equipment, such as designing field efficiency tests for the sprayer or refining the accuracy of Df.