We present the theory and experimental demonstration of electrically tunable mid-infrared metamaterials based on depletion-type semiconductor devices. Planar metamaterials consisting of interconnected gold split-ring resonator arrays are fabricated on top of highly doped III-V semiconductors. These arrays work both as an optical metamaterial layer and electrical metal gate simultaneously. The depletion width in the n-doped semiconductor epilayer changes with the electric gate bias, inducing a change of the permittivity of the substrate and leading to frequency tuning of the metamaterial resonance. We first present our device structure and measurement data. Then we provide a detailed theoretical analysis of electrical tuning and we study how semiconductor materials and metamaterial designs affect electrical tunability. We also discuss possible ways to improve tunability even further. This active tuning is generally applicable to a variety of infrared metamaterials and plasmonic structures, which can lead to novel applications in chip-scale infrared optoelectronic devices