Periodic orbits near equilibria via averaging theory of second order