BeagleBoard.org BBB Wireless BBBWL-SC-562 - Review

Table of contents

RoadTest: BeagleBoard.org BBB Wireless BBBWL-SC-562

Author: rcreighton

Creation date:

Evaluation Type: Evaluation Boards

Did you receive all parts the manufacturer stated would be included in the package?: True

What other parts do you consider comparable to this product?: null

What were the biggest problems encountered?: null

Detailed Review:

Introduction:

 

Single board computers, such as the BeagleBone Black are useful low-cost solutions to automation and testing. The BeagleBone Black Wireless adds wireless features to speed up development for many applications in engineering and science. The purpose of this RoadTest Review is to show how the BeagleBone Black Wireless can be used to monitor outdoor and indoor temperature and humidity to see if any correlations can be observed to quantitatively characterize rooms in a home that may have leaks or not be well insulated.

 

Studies comparing indoor and outdoor conditions such as this one, https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3791146/  compare indoor and outdoor temperatures to try to identify how they correlate. The BeagleBone Black Wireless, when paired with a DHT22 temperature/humidity module, has a several advantages to comparing outdoor and indoor temperatures when compared to methods done in the study:

  • Lower costs, including the DHT22 module
  • Allows for calculations such as absolute humidity to be processed in real time
  • Data can be saved locally and automatically back up data to a server
  • Wireless connectivity also allows it to acquire very local outdoor temperature by connecting to internet connected weather stations such as those using the Weather Underground. https://www.wunderground.com/

 

Methods:

 

In this project indoor temperature and relative humidity were measured using a DHT22 module. Outdoor temperature and humidity were recorded by using the Weather Underground API to acquire measurements from the nearest weather station. Absolute humidity for both indoor and outdoor temperatures were calculated by using the equation,

 

Absolute Humidity (grams/m3) = 6.112 x e^[(17.67 x T)/(T+243.5)] x rh x 18.02
                                                                            (273.15+T) x 100 x 0.08314

 

This equation came from this site  https://carnotcycle.wordpress.com/2012/08/04/how-to-convert-relative-humidity-to-absolute-humidity/

 

All measurements and calculations were taken every 5 min for 24 hours. The testing was done in my home office three times as a baseline, then three more times with the outside window cracked open to simulate a leaky or poorly insulated room. After collecting 24 hours of data, the csv file containing the data set was then uploaded to an Amazon EC2 instance to allow for remote access and provide a backup.

 

BeagleBone Black Wireless Hardware Setup:

 

The first thing I did to setup the BeagleBone Black wireless was to download a fresh image to an SD card. It can be inconvenient to download drivers or plug single board computers into a monitor to set up the wireless. The BeagleBone Black Wireless was very convenient for setting up this project as I was able to connect directly to the board wirelessly without any extra setup. As soon as the board was plugged in I saw the BeagleBone Black appear as a network that I could connect to. After connecting, I used Cygwin to ssh to the board, changed default passwords, and connected the BeagleBone Black Wireless to my home network. After that I was able to disconnect and load the Cloud9 sdk from port 3000 to begin programming.

 

After getting the BeagleBone Black wireless setup to start coding, I unplugged the board and I connected the hardware which included the DHT22 module, an LED, and a button.

 

Software:

 

The main script, Main.py, uses a module called temperature that I wrote to make it easy to get all measurements and calculations, save the data, and upload the data to the Amazon EC2 instance. Here is the temperature module. Note that personal account information for the Weather Underground and my Amazon EC2 instance have been changed for privacy.

 

temperature.py

import urllib2
import json
import Adafruit_DHT
import time
import csv
import os
import math


def getOutsideTempRH():
    f = urllib2.urlopen('http://api.wunderground.com/api/key/geolookup/conditions/q/pws:station.json')
    json_string = f.read()
    parsed_json = json.loads(json_string)
    temp_c = float(parsed_json['current_observation']['temp_c'])
    humidity = float(parsed_json['current_observation']['relative_humidity'][:-1])
    f.close()
    return temp_c, humidity
    
def getInsideTempRH():
    #reads temperature from DHT22
    humidity, temp = Adafruit_DHT.read_retry(22, 'P9_12' )
    return temp, humidity
    
def AbsHumidity(T, RH):
    return (6.112 * math.exp((17.67 * T) / (T + 243.5)) * RH * 2.1674) / (273.15 + T)
    
    
class TempData(object):
    
    def __init__(self):
        self.timeCreated = time.strftime("%d-%m-%y_%H:%M:%S")
        self.filepath = '/var/lib/cloud9/BBBW RoadTest/data_' + self.timeCreated + '.csv'
        
    def update(self):
        self.outsideTemp, self.outsideRH = getOutsideTempRH()
        self.outsideAH = AbsHumidity(self.outsideTemp, self.outsideRH)
        self.insideTemp, self.insideRH = getInsideTempRH()
        self.insideAH = AbsHumidity(self.insideTemp, self.insideRH)
        self.date = time.strftime("%d-%m-%y")
        self.time = time.strftime("%H:%M:%S")
        self.data = [self.date, self.time, str(round(self.insideTemp, 1)), str(self.outsideTemp), str(round(self.insideRH, 1)), str(self.outsideRH), str(round(self.insideAH, 1)), str(round(self.outsideAH, 1))]
    
    def save(self):
        f = open(self.filepath, 'a')
        writer = csv.writer(f)
        writer.writerow(self.data)
        f.close()
        
    def upload(self):
        s = 'scp -i "/var/lib/cloud9/BBBW RoadTest/secureKey.pem" "/var/lib/cloud9/BBBW RoadTest/data_' + self.timeCreated + '.csv" username@ec2server.com:/home/ubuntu/'
        os.system(s)

 

The main script then only has to wait for the button to be pushed to start the test. This made it easy to run multiple tests without logging into Cloud9 every time. The LED was programmed to blink on a separate thread while the test was running to give an indication that it was collecting data. After completing the test the LED was set to stay on to indicate it was ready to run another test.

 

Main.py

import temperature
import time
import Adafruit_BBIO.GPIO as GPIO
import threading
import subprocess


def blinkLED(e):
    while not e.isSet():
        GPIO.output("P8_13", GPIO.HIGH)
        time.sleep(0.5)
        GPIO.output("P8_13", GPIO.LOW)
        time.sleep(0.5)


def takeMeasurements():
    data = temperature.TempData()
    for i in range(288):
        data.update()
        data.save()
        time.sleep(60 * 5)
    data.upload()
    


GPIO.setup("P8_13", GPIO.OUT)
GPIO.setup("P9_15", GPIO.IN)


GPIO.output("P8_13", GPIO.HIGH)


state = 'idle'


while True:
    if state == 'idle':
        if GPIO.input("P9_15"):
            print 'measuring'
            GPIO.output("P8_13", GPIO.LOW)
            state = 'measuring'
        else:
            time.sleep(.1)
    else:
        e = threading.Event()
        blink = threading.Thread(name='non-block', target=blinkLED, args=(e,))
        blink.start()
        takeMeasurements()
        print 'measurement complete'
        e.set()
        time.sleep(1)
        GPIO.output("P8_13", GPIO.HIGH)
        state = 'idle'

 

After taking all necessary measurements, I was able to quickly download all the data from my Amazon EC2 instance for data analysis on my laptop.

 

Results:

 

Tests done with the window in the room closed were done at the same time as other tests done with the window closed in the order they appear. For example, the data in the first chart for temperature shown where the window was closed was collected at the same time as the data in the first chart for relative humidity that is shown for relative humidity with the window closed. The same applies for the data in the charts that was collected with the window open.

 

Temperature:

 

Three separate temperature tests done with the window in the room closed:

 

Three separate temperature tests done with the window in the room open:

 

Relative Humidity:

 

Three separate relative humidity tests done with the window in the room closed:

 

 

Three separate relative humidity tests done with the window in the room open:

 

 

Absolute Humidity:

 

Three separate absolute humidity tests done with the window in the room closed:

 

 

Three separate absolute humidity tests done with the window open:

 

 

Analysis:

 

I though it reasonable to assume that a large temperature difference between indoor and outdoor temperatures in a leaky room would cause the indoor temperature to decrease faster than a room that was well insulated. To check this out I took the temperature difference between the indoor temperature and the outdoor temperature at each point and treated it as a function of the slope of the indoor temperature. The following graph is an example of this with the window open:

 

 

Looking at the slope of a linear fit should be an indicator of how leaky the room is. Here are the results of that calculation:

 

 

Overall there was a pretty poor correlation and there was not a clear distinction between the window open and closed. This could be due to the house heater throwing off a significant portion of the data.

 

Looking at the absolute humidity it seemed that the results from the closed window show a generally greater absolute humidity than outside. To test this I first smoothed the data so that it would represent a more general trend rather than any specific fluctuation.

 

FFT Smooth Function

import numpy as np

def fftSmooth(data):
    a = np.fft.rfft(data)
    a[20:] = 0
    b = np.fft.irfft(a)
    return b

 

I then took the average difference:

 

 

While this method is a little simpler it once again isn't clear enough to differentiate between a leaky room and a well insulated room consistently. Longer sampling times and compensating for house heating may give a clearer signal that could be used to identify leaky rooms. Another problem that can be seen in the raw data is that the outdoor weather station seemed to throw incorrect values that appear as outliers in the data.

 

Conclusions:

 

Comparing outdoor and indoor temperatures and humidities as outlined in this article was insufficient to accurately identify leaky rooms in a 24 hour period alone. The BeagleBone Black Wireless, however; provided an excellent platform to automate testing of indoor and outdoor environmental conditions. Adding additional sensors to monitor when house heating is running, monitoring weather from a different weather station, or simply sampling data longer would all be simple to implement and could yield more meaningful results.

 

Other Notes:

 

Because this RoadTest Review was to test out the new BeagleBone Black Wireless I wanted to add a few bullet points about things I really liked about the BeagleBone Black Wireless with respect to this project and things I wish were a little different.

 

Things I really liked:

  • The wireless setup worked very reliably. I've used other single board computers where the wifi would drop or disconnect and require a reboot. The BeagleBone Black wireless was consistent and reliable for long term testing and would reconnect quickly if my router accidentally went down
  • Setting up the BeagleBone by connecting through its wifi direct made everything move so much faster than any single board computer I have used. I was ready to write code within minutes of unboxing. No extra cables, no drivers, just a give it power and away you go.
  • The adafruit library for the DHT22 module and GPIO worked right away. I really like it when things just seem to work without much tweaking or setup.
  • Cloud9 running on port 3000 out of the box is another one of those quick conveniences that speeds up development

 

Things I wish were a little different:

  • I tried using the bbio library and got segmentation faults. It wasn't a big deal to use the Adafruit libraries but as the bbio library was in some of the examples out of the box I thought I try them out with no luck.
  • Cost of this board seems high compared to some other single board computers. However, the extra features such as setup through wifi direct, preinstalled Cloud9 IDE, working comprehensive libraries, and community support will likely speed up development for most engineers and scientists. Those benefits may often outweigh the extra costs especially if development is in a time crunch.
Anonymous
  • Thank you, Richard.

       The information you have provided is very helpful. I have bookmarked for later reference. Thank you for an amazing review.

  • Thanks Trent,

     

    All temperature data was automatically saved to my Amazon EC2 instance as csv files. I used Cygwin to scp those files from the server to my desktop. From there I did all my data analysis in python using the Spyder IDE. The python module that I used for graphing is Matplotlib. https://matplotlib.org/    I like using it because it is easy to customize, simple to use, and produces publishable graphs. Here is a quick example:

     

    import matplotlib.pyplot as plt
    data = [2, 5, 3, 6, 4, 1]
    plt.plot(data)
    plt.show()

     

    I used the python csv module to get the data from the csv files to convert it all into lists. If you are interested you can follow the link below to see the script I used to play around with the data and generate the graphs.

     

    https://gist.github.com/rcreighton/4aad62c4c27b33ea51dd64041666dcc0

     

    Thanks for reading my Road Test Review!

  • Thank you, I'm not 100% sure what caused the spikes. It only happened on outdoor readings, so data that came from the weather underground requests. I've looked through the history on the weather underground database to see if I could see the same thing saved on their end and didn't see any spikes. Overall the data they save in history looks a little smoother than the data I acquired even though they save every 5 min just like I did. Hard to know if it is a problem with the Weather Underground API or the weather station itself. It's also possible that they sample more often and save an average of the readings over 5 min so any anomalous readings get averaged out.

  • Nice review. Good idea to incorporate the Weather Underground API. How did you get the temperature graphs?

  • Very nice road test report.

     

    Good detail, well run test and good data analysis.

     

    Question.  What caused the data spikes on several of the graphs?

     

    DAB