In order to overcome the monotone and rigidity in machine embroidery products due to machine limitations, a machine embroidery technique, which can express freehand brushwork effect, was developed, and inspired by random needle embroidery and the dot color painting principle. Through the design of base unit needle, this paper explores the synergistic effect of the size and number of base unit needle and stitch spacing on pattern shaping. Layered combination through layering color separation, gray-scale processing, stitch arrangement, combination and superposition, and color yarn embroidery was carried out to facilitate products with the freehand effect of random needlework styles. It was found that the 2∶1 ratio of base unit needle side length to stitch spacing leads to the optical results, and that a lower ratio is associated to a clearer the pattern outline, whereas a higher ratio relates to virtual transition between different contours. High density of base unit needle stitches per unit area leads to low lightness of the pattern, and when the base unit needle size and quantity are fixed, the stitch spacing from small to large controls the natural gradual change of pattern from deep to shallow. 60 groups of sample stitch gray values preliminarily established the freehand machine embroidery needle method parameter library, which was shown to be sufficient to demonstrate the effective correspondence between the gray level of each layer and the parameters of base needle, creating a layered combination design that gives the pattern a sense of hierarchy and three-dimensional effect.