Tag Archives: weather

In Part 1 of this, I went over the setup of ThingSpeak and several associated and almost-associated packages.

This part will be more about the funner stuff.

Rain Gauge Reader

The first thing I had to do was build a rain gauge reader.  I ultimately started that before doing part one, but then moved on to a standalone node.js program that counted clicks from the rain gauge.

The rain gauge is a tipping-bucket rain gauge that tips when the rain gets to 0.2mm.  The guts are in the picture below.

Rain Gauge Innards

These are the guts of the rain gauge. You can see the tipping bucket (black) and the barrier terminal that connects to the switch. Yep, that’s all it is, a switch.

The rain gauge initially came with a little board that has a PIC and an EEPROM that stored clicks.  I didn’t care for that idea, since the ultimate plan is to see if we can put this on our building’s roof with a battery and a solar panel.

This is where the BBB comes in.  I connected the rain gauge to the BBB and started playing with node.js until I came up with the program in the gist below.

Rain gauge connected to Beaglebone Black computer.

Beaglebone Black connected to the rain gauge. I routed the wires through the drain of the rain gauge, which may change when I actually put this in use.


After setting it up, it was time to test.

Chart showing rain in inches

Wow, it rained for a half inch during a minute in my office!

The third part of this will be making this fault-tolerant: fixing the time issue (it doesn’t keep time), starting things during startup, and security.

-73-


Category: Beaglebone

Recently, a coworker brought a raingauge to me that was collecting dust somewhere in a storage room at the office.  After making it work, I thought that I could certainly rebuild it.  Better.  Faster.  With a much cooler interface.

I also thought that this might be a damn good opportunity for my BeagleBoard Black.

Setup

There are a few initial things that need to be done:
ntpdate time.nist.gov
opkg update
opkg upgrade

These commands set the date and time, update the available package listing, and upgrade all installed packages to the latest version.

The next thing I did was edit /lib/systemd/system/bonescript.socket and change the listening port to 8080.  This will break the connection between the board and the website (so you can’t click the buttons on some of the programming example pages and make the LEDs blink… which I admit is a pretty cool feature).  Cloud9 will still remain on port #3000.  More on that later.

Additionally, I changed /usr/lib/node_modules/bonescript/server.js to port 8080.  This was really to try and maintain the connection between the board hardware and the website.  It didn’t work, but I wanted things off of port 80 so port 80 could be used for a website.

After all this I rebooted the board.

When it came back up, I lost internet access to the board, so I edited /etc/resolv.conf to add the local DNS server in my office.

After that, I ran several installs:
opkg install mysql5
opkg install lighttpd
opkg install php php-cgi php-cli
opkg install lighttpd-module-fastcgi

Next, I edited the lighttpd config files per this blog post.  Once those were edited, I restarted lighttpd and brought up my version of index.php (which included the phpinfo() command to show me that PHP was working).

Ruby & ThingSpeak Installation

I installed Ruby and got the Thingspeak source from GitHub (I created some folders for this, I’m assuming if you’ve made it down here you can figure that part out):
opkg install ruby ruby-dev
git clone git@github.com:iobridge/thingspeak.git
gem install bundle

Then I went to the GitHub project page to follow the instructions to install ThingSpeak.  I ran into several problems.  One of them related to a file not being able to find assert.h.  I fixed this by setting the C_INCLUDE_PATH variable:

export C_INCLUDE_PATH=/usr/include

The next problem wasn’t so easy.  The linker was having a problem finding one the libgcc_s library.  I ultimately fixed this by linking /usr/lib/libgcc_s.so to /lib/libgcc_s.so.1:

ln -s /lib/libgcc_s.so.1 /usr/lib/libgcc_s.so

Then, I started getting “Command not found” for /usr/bin/mkdir.  That was sort of a “WTF?” moment, considering I created a folder for the ThingSpeak source earlier.  I figured it must be hard-coded to use /usr/bin and the mkdir command was in /bin.  More symbolic links:

ln -s /bin/mkdir /usr/bin/mkdir

Once these symbolic links were in place, I was able to get further in the “bundle install” process, only stopping thrice for the following missing items:

opkg install libmysqlclient-r-dev
opkg install libxml2-dev
opkg install libxslt-dev

After these three items are installed, I could bring up ThingSpeak by running:

rails server -d -p 3001

And bringing up http://localhost:3001

In the next post, I’m going to get into the rest of what I was doing.

-73-


Category: Beaglebone

I saw a commercial on the news recently that struck a cord.  It was for a phone app that “keeps your family safe in a storm”.  I then saw an ad for the same app on that local news station’s Web site.

I’m a trained weather spotter, a member of the local Weather Amateur Radio Network, and a member of the local ARES/RACES chapter.  I know NEVER to rely on a cell phone during a disaster.  We had earthquakes in Cincinnati that caused NO DAMAGE and the cell phone network got slammed (because of everyone tweeting/etc about the quake).  If that’s the case, what do you think the cell network would do in a tornado?  We saw it on March 2nd – it went down.

The only safe thing to do is to have a weather radio!

I have a Reecom radio I bought from Amazon.  It works well, and I was able to configure it to only do alerts for Clermont County (my county) and only for major warnings – it would blink (but not sound an audible alarm) for flood warnings (which do not affect my home) and severe storm warnings (important, yes, but I usually already know about those).

If you want to go one better…

If you want to go one better, you can get a scanner and listen in on the ham radio ops (we’re on 146.88 Mhz and 147.375 Mhz in Cincinnati during severe events).  Of course, you’re only getting part of the story because police use their own radios to report (you can get scanners for that, too), and weather spotters can also use their telephone to report weather events.

Should you not download the app?

I’m not saying not to download it or use it.  If you’re in the office or at home and your cell phone is using wi-fi (and you have power and Internet), you’re probably fine.  I’m saying that once those lights go out, you should already have a weather radio.  Don’t let one of these phone apps give you a false sense of security.

-73-


Category: General Stuff

This is the new server