Tag Archives: Behavioral

Sleep Better with a Raspberry Pi

Sleep is an integral part of our lives, and lack of quality sleep quickly leads to a whole host of issues related to physical, emotional, behavioral, etc. Quality sleep is linked to a good environment that includes proper bedding, clothing, temperature, humidity, and lighting among other things. Although electronics may not be able to help much with the proper choice of bedding and clothing, a cheap but versatile single board computer such as the RBPi or Raspberry Pi is a good contender for controlling temperature, humidity and lighting during sleep hours.

When using the RBPi for controlling the environment of the bedroom, it is necessary to build an RBPi-based temperature-monitoring network in the house. This helps to get some hard data on the existing temperature trends at different places, so it will be easy to know whether the solutions tried did actually work. Since temperature is to be monitored at different places at the same time, it is necessary to use remote sensors.

You can use temperature sensors such as the single-wire DS18B20 thermometers for inexpensive and accurate temperature measurement. This model has two types of sensors – transistor-sized and waterproof, and you can use either for the purpose. However, people have found the waterproof sensors were easier to position and calibrate, and they were slightly more accurate as well.

Testing the sensors on the RBPi is simple as this SBC supports the DS18B20 sensors by the built-in w1-gpio library. The RBPi allows easy readouts of the 1-Wire devices. You can wire up a few DS18B20s to multiple RBPI, Model A+ and position them at all main parts of the house. It also helps to integrate data from your Nest Thermostat API, if you are using this and collect the local outdoor temperature data as well – use the Weather Underground, for instance. Monitor the temperatures from the different sensors on a rolling 24-hour graph, and you can make out if there is a trend.

It is possible to even out temperature variations in the house by sealing vents and leakages in areas where the temperature dips. However, this may not be enough to raise the temperature to comfortable levels at locations distant from central heating ducts. Moreover, not all walls of the house may receive equal amounts of sunlight, and this may be another reason for the temperature dropping in certain rooms after sunset.

You can use unobtrusive wall-mounted space heaters to boost the temperature up in these areas. Usually, these are slabs of stone with heating wires running through them. Stone has high thermal capacity, meaning it retains and radiates heat for a long time. This arrangement is also safe for use in children’s bedrooms. When used on a thermostat-triggered outlet, the heater only turns on at a select temperature that you choose. You can fine-tune the settings after monitoring the temperature data for a couple of nights.

This project is useful if you are planning to have an extended network, with remote-controlled HVAC using branch air ducts. Individual controls on the branch ducts can control the airflow, so the system efficiency goes up, such as by turning down the airflow to sections of the house where there is no one present.