Tag Archives: node.js

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

I am trying to have a green thumb. Right now, it is more of a pale yellow with a hint of orange. One thing I thought about doing was a temperature logger for plants that I’m starting and will be transplanted outside in mid-April, after the frost season ends in this area.

I initially thought about using an Arduino, but connecting the Arduino to my network would have required me to buy an Ethernet shield or a Wifi shield, both of which are quite expensive.  I happen to have a USB wifi adapter hanging around and a Raspberry Pi that wasn’t being used.  Match made in heaven!

So the first thing I did was go search around on the Internet and found something from Adafruit that included source code and a hookup diagram for a DHT22 temperature and humidity sensor. Mine is an RHT03, which is similar.

2013-02-24 01.50.10

I did find that my RHT03 does not run with 3.3v, so I changed the power rail to 5V, and viola!

The next thing I looked at was the source code.  I made one minor change and recompiled – I edited everywhere where I saw temperature in Centigrade and changed it to Fahrenheit.

rpiTemp

So the next step was to make it easy to get to.  I don’t want to log in to my Raspberry Pi via SSH terminal just to check the temperature.  So I decided that it seems Node.JS is the way to go because I can very easily write a web server for it.

nodeTemp

Nice and simple.  And of course, the code:

Could not embed GitHub Gist 5024198: Not Found

-73-

UPDATE: I’ve had this running a few days, and realized that it seems Node.js does not like to update as fast as I would like.  In fact, it doesn’t update until I restart the server… not sure what to do about that, but it drastically limits the usefulness of that tool as a solution in this situation.


Category: Raspberry Pi

This is the new server