  A deformed Donaldson-Thomas (dDT) connection is a Hermitian connection of a
Hermitian line bundle over a $G_2$-manifold $X$ satisfying a certain nonlinear
PDE. This is considered to be the mirror of a (co)associative cycle in the
context of mirror symmetry. The dDT connection is an analogue of a deformed
Hermitian Yang-Mills (dHYM) connection which is extensively studied recently.
  In this paper, we study the moduli spaces of dDT and dHYM connections. In the
former half, we prove that the deformation of dDT connections is controlled by
a subcomplex of the canonical complex, an elliptic complex defined by Reyes
Carri\'on, by introducing a new coclosed $G_2$-structure. If the deformation is
unobstructed, we also show that the connected component is a
$b^{1}$-dimensional torus, where $b^{1}$ is the first Betti number of $X$. A
canonical orientation on the moduli space is also given. We also prove that the
obstruction of the deformation vanishes if we perturb the $G_2$-structure
generically under some mild assumptions.
  In the latter half, we prove that the moduli space of dHYM connections, if it
is nonempty, is a $b^{1}$-dimensional torus, especially, it is connected and
orientable. We also prove the existence of a family of moduli spaces along a
deformation of underlying structures if some necessary conditions are
satisfied.
