  We consider the problem of optimizing the freshness of status updates that
are sent from a large number of low-power sources to a common access point. The
source nodes utilize carrier sensing to reduce collisions and adopt an
asynchronized sleep-wake scheduling strategy to achieve a target network
lifetime (e.g., 10 years). We use age of information (AoI) to measure the
freshness of status updates, and design sleep-wake parameters for minimizing
the weighted-sum peak AoI of the sources, subject to per-source battery
lifetime constraints. When the sensing time (i.e., the time duration of carrier
sensing) is zero, this sleep-wake design problem can be solved by resorting to
a two-layer nested convex optimization procedure; however, for positive sensing
times, the problem is non-convex. We devise a low-complexity solution to solve
this problem and prove that, for practical sensing times that are short, the
solution is within a small gap from the optimum AoI performance. When the mean
transmission time of status-update packets is unknown, we devise a
reinforcement learning algorithm that adaptively performs the following two
tasks in an ``efficient way'': a) it learns the unknown parameter, b) it also
generates efficient controls that make channel access decisions. We analyze its
performance by quantifying its ``regret'', i.e., the sub-optimality gap between
its average performance and the average performance of a controller that knows
the mean transmission time. Our numerical and NS-3 simulation results show that
our solution can indeed elongate the batteries lifetime of information sources,
while providing a competitive AoI performance.
