With the help of doping.
Pure Silicon or Germanium are rarely used as semiconductors. Practically usable semiconductors must have controlled quantity of impurities added to them. Addition of impurity will change the conductor ability and it acts as a semiconductor. The process of adding an impurity to an intrinsic or pure material is called doping and the impurity is called a dopant. After doping, an intrinsic material becomes an extrinsic material. Practically only after doping these materials become usable.
Purity for an electronic grade semiconductor must be greater than 99.999 percent. Controlling the amount and type of impurity, however, can fine-tune the properties of the semiconductor. For example, adding a phosphorus impurity (with five valence electrons) to silicon (with four valence electrons) effectively adds one extra electron for each phosphorus atom added to the crystal. Thus the phosphorus is a donor to silicon. The dopant phosphorus atoms will displace silicon atoms in the crystal, but the overall crystal structure does not change, nor does the band structure. The extra electron must go into the conduction band, however, since the valence band was already full. This yields an n -type semiconductor. Conversely, doping silicon with aluminum provides one too few electrons, leaving one hole in the valence band for each aluminum atom added. Thus aluminum is an acceptor from silicon. Having lost electrons, the holes bear a positive charge, forming a p -type semiconductor. Because the gap in energy between the donor levels and the conduction band (En) or between the acceptor levels and the valence band (Ep) is very small, these doped semi-conductors will exhibit a greater conductivity and much less temperature dependence than is observed for an intrinsic semiconductor.