(dimensionally correct, since U is energy/unit mass)
We will choose our scale so that $\kappa $ is an integer: the "curvature" of universe
$\kappa $ = -1 means U > 0, open, negative curvature
$\kappa $ = 0 means U = 0, critical, zero curvature
$\kappa $ = 1 means U < 0, closed, positive curvature
Note some relations:
$$
\color{red}{
v\left( t \right) = \frac{{\partial d\left( t \right)}}{{\partial t}} = H\left( t \right)d\left( t \right) = r \frac{{\partial a\left( t \right)}}{{\partial t}} = r H\left( t \right)a\left( t \right)}
$$
(since r doesn't change with time)
so $$
\color{red}{
\frac{{\partial d\left( t \right)}}{{\partial t}} = H\left( t \right)d\left( t \right)}
$$ so the (almost) general Friedmann equation is
\color{red}{
H\left( t \right)^2 = \left( {\frac{{\dot a}}{a}} \right)^2 = \frac{{8\pi G}}{{3c^2 }}\varepsilon \left( t \right) - \frac{{\kappa c^2 }}{{\left( {R_0 a\left( t \right)} \right)^2 }}}
A better (more fundamental) derivation, due to Berry: metric is