  In the future, sensor nodes or Internet of Things (IoTs) will be tasked with
sampling the environment. These nodes/devices are likely to be powered by a
Hybrid Access Point (HAP) wirelessly, and may be programmed by the HAP with a
{\em sampling time} to collect sensory data, carry out computation, and
transmit sensed data to the HAP. A key challenge, however, is random channel
gains, which cause sensor nodes to receive varying amounts of Radio Frequency
(RF) energy. To this end, we formulate a stochastic program to determine the
charging time of the HAP and sampling time of sensor nodes. Our objective is to
minimize the {\em expected} penalty incurred when sensor nodes experience an
energy shortfall. We consider two cases: {\em single} and {\em multi} time
slots. In the former, we determine a suitable HAP charging time and nodes
sampling time on a slot-by-slot basis whilst the latter considers the best
charging and sampling time for use in the next $T$ slots. We conduct
experiments over channel gains drawn from the Gaussian, Rayleigh or Rician
distribution. Numerical results confirm our stochastic program can be used to
compute good charging and sampling times that incur the minimum penalty over
the said distributions.
