  Electronic structures of the tetradymites, Bi$_2$Te$_3$, Bi$_2$Te$_2$Se and
Bi$_2$Se$_3$, containing various dopants and vacancies, are studied using the
first principles calculations methods. We focus on the possibility of formation
of the resonant levels (RL), confirming the formation of the RL by Sn in
Bi$_2$Te$_3$, and predicting similar behavior of Sn in Bi$_2$Te$_2$Se and
Bi$_2$Se$_3$. Vacancies, which are likely present on the chalcogen atoms in the
real samples of Bi$_2$Te$_2$Se and Bi$_2$Se$_3$, are also studied and their
charged donor and resonant behavior is discussed. Doping of the
vacancy-containing materials with regular acceptors, like Ca or Mg, is shown to
compensate the donor effect of vacancies, and $n-p$ crossover, while increasing
the dopant concentration, is observed. We verify, that RL on Sn is not
disturbed by the chalcogen vacancies in Bi$_2$Te$_2$Se and Bi$_2$Se$_3$, and
for the Sn-doped materials with Se or Te vacancies, double-doping, instead of
heavy doping with Sn, is suggested as an effective way of reaching the resonant
level. This should help to avoid the smearing of the RL, which was a possible
reason for an earlier unsuccessful experimental observation of the influence of
the RL on thermoelectric properties of Sn doped Bi$_2$Te$_2$Se. Finally we
show, that Al and Ga are possible new resonant impurities in the tetradymites,
hoping that it will stimulate further experimental studies.
