August 30th, 2016

Raspberry Pi as a Temperature Logger

I had a recent need in my home to create a temperature log. I wanted to be able to create a nice little graph which could show correlation between outside temp and temperature inside a room over time. I have three Raspberry Pi’s, so I thought I could re-purpose two of them to track temperature in two different rooms simultaneously, as well as pulling in outside temp.

Although I consider myself fairly technically savvy, I am quite pragmatic in my home electronics, generally just building what I need and not nearly the tinkerer type. But after digging around on Amazon and seeing how limited the options were to creating the data I wanted, I felt like going the “hard road” by building what I needed.

The project ended up taking a bit more time than I expected, but as with so many things, was worth the extra effort and gained quite a bit more knowledge than I would have had otherwise, as well as a much more flexible/powerful tool in the future.

What you need:
– Working Raspberry Pi running a Linux distro (I used Raspbian)
– Temp Sensor: Bosch BMP180 ($10)
– Stuff to wire the two together:
> For me, this was a breadboard, jumper wires, Soldering iron & solder
– Optional: Excel for great graphs of the data (I will include a template spreadsheet for you below)

Step 1. Get the hardware wired up and talking to the Pi
I used this tutorial (it’s a guide for the “BMP085” which is just the older version of this new sensor).
Notes: I felt like the tutorial glossed over the wiring (page 3: “Hooking everything up.”) It assumes you have some basic circuit wiring experience, used a “Pi cobbler,” and familiar with the pins on the Raspberry Pi. I had none: never used a breadboard or jumper wires and only done basic soldering in the past (to make wires and such).

New to wiring circuits? Read on…
When you get the BMP180, it will look like this:
BMP180 breakout
I assume just to confuse you, you’ll notice that there are six metal pins and only five holes in the sensor. Pull one of those pins out from the left or right side, and you’ll be able to stick that little guy into the sensor – use the side with the shorter pins. This should have each pin just slightly sticking up from the sensor. From there, you will need to use your soldering iron to apply a little solder to each of the pins to lock them into place. You’ll notice from the “Hooking everything up” section in the tutorial linked above that you only need to wire four of the five pins (VIN, GND, SCL, and SDA). You’ll need to solder each of those pins into the chip. The end result will look something like this (I just removed the unneeded pin):

I expected this to be easier than it was. I purchased a this BP650NB battery-operated soldering iron as it looked awesome and was recommended by the guy at Radio Shack. Worthless. I wasted over an hour trying to get this thing to solder those tips. In the end, my old (wired) soldering iron I have had for over 20 years generated enough heat to get the job done. Waste of money, that BP650NB.

From here, you need to wire connections over to the right pins on the Raspberry Pi. For this, I used a breadboard. Had seen these before but did not follow how they worked. Simple thing really: Anything plugged into a hole on the board will be connected to anything else plugged into another hole that’s on the same “line.”

I used to connect between the Raspberry Pi and the breadboard. The final hookup looked like the following:


I wanted to do this the way all the other cool guys on the internet were doing it; however, you could just as well have simply attached the jumper directly to the wire from the chip that’s headed into the breadboard and cut out the breadboard altogether. Even though it doesn’t apply here, reading around it seems like the better habit to get into, as this lets you much more easily do stuff with other chips/sensors later on. It’s more important with some chips that depend on others to work in tandem to create the solution you need. Fortunately, this one is pretty simple and can be wired directly to the Pi.

Use that Hooking Everything Up page to see what pins on the Raspberry Pi should be hooked to the pins on the BMP180:
BMP180 – Pi
VIN – 3v3

Finally, head to the final step in the tutorial to pull down the python library and example code to communicate with the chip. Have to admit I was pretty excited when I ran the example code and got a response from the sensor.

sudo python

Step 2: Write a program to write a line with the data you need, delimited by commas
Using the example program as a base, I built a program to output a single CSV line with the following information:
location, current date/time, inside temperature, outside temperature (sourced from the NOAA), windspeed (also sourced from NOAA)

Location is a string tag which i used to know what room was collecting data (hardcoded at the top of the program). I used different hardcoded tags on each of the two Raspberry Pi’s that were running this program to identify which room the data came from.

Getting outside temp
While the code is fairly self-explanatory, there is one particular area that deserves attention, as you would want to modify this for your location.
To get the outside temp from NOAA, I found that I could use some functions in urllib2 to easily parse the XML from NOAA showing current conditions of the closest location (RDU airport, in my case.) Use this page to find the XML link for the location nearest you and update the code with that location for your use.

# get current temp from NOAA for RDU
url = ''
response = urllib2.urlopen(url)
xml =

wind_mph = ET.fromstring(xml).find('wind_mph')
temp_c = ET.fromstring(xml).find('temp_c')
outsidetemp = Decimal(temp_c.text) * 9 / 5 + 32

Here is the full program, which simply appends the output to the file templog.csv on each execution:

Place this in the same directory as the rest of the downloaded BMP085 libraries. This is likely:

To run it, you will need to run as the superuser:
sudo python /home/pi/Adafruit-Raspberry-Pi-Python-Code/Adafruit_BMP085/

Check to verify your output file:
tail ~/templog.csv

Run the program again and check your output file – it should now contain another line.

Step 3: Log the temperature data every five minutes
Now to make use of the lovely built-in scheduler for Unix called cron.
Pull up the cron job scheduler table by typing the following:
sudo crontab -e

Add the following line to the end of the file:
*/5 * * * * python /home/pi/Adafruit-Raspberry-Pi-Python-Code/Adafruit_BMP085/

1. Changing the 5 to any other number will change the delay to that many minutes. For example, use */15 at the beginning of the line to log at 15-minute intervals.
2. We do not need to use “sudo” when running the program as root actually initiates cron jobs.

That’s it! You should now be logging the temps to your CSV file every five minutes.

Step 4: Graphing your data
But your work is not really complete, now is it? You still need to pull this data and make cool graphs and such. I used WinSCP to pull the CSV file onto my Windows machine. I then used Excel to pull in the CSV data and graph it. I first combined the data from two different CSV files (I was measuring two locations with two Raspberry Pis) onto one spreadsheet. From there, I created a graph. It was a pain to figure out how to get a line graph to work correctly with dates, and especially the gridlines at the bottom to be at 3HR marks. Use this spreadsheet as a template and change the chart data as you need to. It should greatly speed up your effort.
TempLog Graph Template

Let me know in the comments if you were able to get this to work or if you have any questions!

Good luck.

→ 3 Comments  Tags: Uncategorized

PlanetKeene Desk Instructions

I am posting the following instructions to accompany a great video which was posted by PlanetKeene on YouTube. I followed these instructions myself to help build the desk. The source video is embedded below:

Tim (aka PlanetKeene) is sadly no longer with us. He died suddenly this past New Year’s eve. His wife and friends want to continue to send out the instructions for the desk. To assist in this effort, I have posted the full detailed instructions (which Tim emailed me) here on my blog for those who might want them.

The instructions, directly from the author of the video:
These instructions are rather specific, but that was because I wanted the hutch openings to hold rack-mounted units. You may not want to do this, so your measurements could vary as much as necessary. Below is the majority of the information for this desk. There are some time markers in parenthesis to see what that instruction relates to. You might want to print this email out, and use the measurements to draw up your own plan.

The desktop measures 70 1/4″ x 27″.

The top of the hutch measures 60 3/16″ x 12″. This allowed for the three openings to measure exactly 19 1/16″ to accommodate rack-mounted gear.

The hutch dividers measure 5 3/4″ x 12″. This allows for 3 rack-mounted units stacked in each opening.

The long 2″x6″ measures 68 3/4″. It should be held in 3/4″ from each end of the desktop, and it should be flush with the back of the desktop. This allows for the top of the cabinet to cover the 2″x6″ framework, as well as a lip edge on both ends that the desktop (See 1:50 to 2:00) will set upon.

The four 2″x6″ under the desktop measure 25 1/2″ to the long-point of a 45° cut.

Each cabinet side measures 30 1/4″ x 21 1/2″ (See 4:34 to 4:44). With the 3/4″ plywood on top, your desk will be 31″ tall. You can change the long measurement here if you want the desk taller or shorter than 31″.

For the framing at the bottom of each cabinet (See 10:32 to 10:49), I cut three pieces of pine 1×4. One piece 19 3/4″ and two pieces 12″. I suggest you use a piece of the plywood left over and cut a piece, with the grain, that is 3 1/2″ wide and19 3/4″ in length. You will locate this piece as a kick plate in the front of each cabinet. You can see where you need to locate this piece of plywood here (See 10:09 to 10:13). At the bottom of each cabinet, measure in 3/4″ from the back, and 1 1/2″ from the front. Put the long 1×4 on the marks, flush with the bottom of the cabinet, and attach using six #8 1 1/4″ wood screws (See 4:55 to 5:03).

Nail the 12″ pieces to the two 19 3/4″ pieces you just attached (See 5:08 to 5:20) using three #8 finish nails. You should drill pilot holes for these nails. I use finish nails here because using screws near the end of 1×4 material can cause it to split.

For the middle shelf, I cut two pieces of 1×2 measuring 21 1/2″. Attach one to each side, using three #8 1 1/4″ wood screws. You can place this shelf about midway, or at whatever height is best for you. You could probably leave one middle shelf out, but they do tend to stabilize the desk fairly well.

Cut two shelves measuring 12″ x 21 1/2″ from your remaining plywood. Drill pilot holes, countersink optional, and attach through the cabinet side to the shelf using three #8 1 1/4″ wood screws.

You will need to cut a 1 9/16″ x 5 9/16″ notch on the upper, back corner, on the inside of each cabinet (See 10:25 to 10:29). This is to allow the long 2×6 to be flush with the outside of each cabinet. You can also see this notch here (9:31) and here (See 10:01 to 10:07). After you align the cabinets, you can rest the desktop on this notch before you ease it down into place.

Secure the lower shelf using the instructions for securing the middle shelf above. You will do all of this twice, once for each cabinet.

You will need to cut a 1 9/16″ x 5 9/16″ notch on the upper corner, on the inside of each cabinet (See 10:25 to 10:29). This is to allow the long 2×6 to be flush with the outside of each cabinet. You can also see this notch here (9:31) and here (See 10:01 to 10:07). You can rest the top here before you flip it down.

You can see how I attached the hutch here (11:25 to 11:52). I only used two T-Plates, but you can use four if you like. Once you put your first rack-mounted unit in place, this will help in keeping the hutch just that much sturdier.

If you use a countersink bit, be careful not to drill too deep. You only need to break the surface of the plywood so that the screw head will be counter-sunk enough to allow a decent amount of wood putty.

You can put as many coats of polyurethane as you like. I only used two, but three might be just a bit better. Also I only put poly on the top, sides, and trim of the hutch, and the desk top itself, you might consider doing more… Cabinets and trim, keyboard shelf, etc…

[The instructions that follow are for the keyboard shelf that I installed using under-desk mounted gliders. I will very likely replace these with side-mounted glides on the sides of the cabinets. I might suggest that you use the runner/glides that attach to the sides of each cabinet for a bit more clearance if you want. I liked the looks of the under-desk brackets is why I used them, however, I think that the side-mounted type would be more practical. I think all of these desks, that I have links for below, have side-mounted keyboard shelf glides. If you haven’t purchased yours yet, you might want to consider these as a slightly better option than the under-desk mounted type I used in the video.]

I lowered the keyboard to accommodate my Oxygen49 MIDI controller. I did this by cutting eight blocks of wood from my remaining plywood. You can use any one-by material that is 3/4″ wide. The blocks measure 2″ x 5″.

For the keyboard shelf, determine the location of your glide brackets (See 12:37) under the desk. Attach four blocks under the desk, centered for the glide brackets to be attached to, using #8 1 1/4″ wood screws. Attach another block to the first blocks, using the same type wood screws (See 12:46) This will give you an additional 1 1/2″ of clearance.

Parts List:
Materials List for “How To Build A Home Recording Studio Workstation”

(2) 4’x8′ 3/4″ Oak Hardwood Plywood ~ $89.94
(1) 10′ 2″x6″ Pine ~ $6.23
(1) 8′ 2″x6″ Pine ~ $5.12
(2) 6′ 1″x4″ Pine ~ $7.42
(1) 8′ 1″x2″ Pine ~ $4.45
(1) 2’x4′ ¼” Luan Panel ~ $5.89 (cut to fit on back of side cabinets)
(8) 3″x1/2″ Carriage Bolts, Nuts, & Washers ~ $9.76
#8 1 1/4″ Wood Screws ~ $5.58 (1 Box of 100) Attach 1″x2″ and 1″x4″ material to cabinet sides, and sides to middle and bottom shelf.
#10 1 1/2″ Wood Screws ~ $3.88 (2 Boxes of 20 ea.) Attach top to 2″x6″, and hutch top to dividers.
3″ Coarse Drywall Screws ~ $0.00 (I had these on hand, and used them to attach the long 2″x6″ on the back to the four 2″x6″ underneath the desktop.)
Assorted Sandpaper Pack ~ $4.97
Minwax Cherry Stain ~ $7.56 (1 Quart)
Minwax Pre-Stain ~ $5.98 (1 Pint)
Elmer’s Wood Filler ~ $3.27 (Small 4 oz.)
Minwax Polyurethane Semi-Gloss ~ $10.46 (1 Qt.) You won’t need this much, but it lasts a long time and was a better buy than a small can.
(1) Set of 16″ Keyboard Glides ~ $6.40
(2) 3″x3″ T-Plates ~ $5.56 (This is two packs of two each. I installed two additional T-Plates, for a total of four, though it is not shown in the video.)
44′ Screen Mold ~ $16.31
(5) 3″ Foam Brushes ~ $4.35

TOTAL = $203.13

Countersink Bit ~ $8.27
Corner Bracket Levelers ~ $20.48 (2 Sets from local Woodcraft store)

→ 16 Comments  Tags: Music

Fixed! Laptop waking from sleep

I love my ThinkPad T420s (I love my MacBook Air as well, but that’s not important right now); however, the blasted thing kept coming out of sleep once I put it into my laptop bag. I find my laptop later just about to overheat, leaving me frustrated and wondering what unhealthy forces my battery or other computer bits have been subjected to while it was in there.

After looking in the Event Viewer, I was able to track down the wake event was the ethernet port (nice, unplugging the ethernet after putting it in standby woke it right back up – that’s smart). It finally hit me there should be some mechanism to find out what devices in Windows 7 have the ability to wake my computer, so I can go and kill these things before they disrupt my sleeping machine again.

And there is! Open a command-prompt and enter the following:
powercfg -devicequery wake_armed

Source: Powercfg Command-Line Options

I simply ran that command, then double-clicked on each device in Device Manager, and unchecked “Allow this device to wake the computer” on the Power Management tab. Re-ran the command just to verify nothing was present. (Turns out it was not just the LAN adapter, but the keyboard and mouse as well.)

A nice sigh of relief to not have to worry about that. In the meantime, my laptop is still a little hot to the touch, but getting cooler. 🙂

→ No Comments  Tags: Uncategorized

Configuration tips for the ubee DDW3611

If you upgraded to DOCSIS 3.0 through Time-Warner Cable, you may be interested in a few configuration settings that were required to get my modem/router to function as well as my previous setup (using a simple Linksys router).

Update: Please review the comments section – tons of people have contributed helpful tips which may help you out if my original post does not.

WPA2: Enable
As part of the default installation, the router only supports WEP 40-bit and 128-bit encryption – this can limit your connectivity options with other devices, is less secure, and more of a pain to deal with the hex keys required to keep for the password. However, through calling tech support they can update your router to support WPA or WPA2 encryption. For me, my previous router was using WPA2, so I requested to enable that.

IP Flood Protection: Off (helpful against DDoS attacks)
With this turned on (the default setting), each machine coming out of standby (phones and computers) had to wait roughly 3 minutes before being able to use the network. This was driving me crazy. All fixed with this turned off.

WAN blocking: Disable
Enable: UPNP
Bridge mode: Off

OK, for the three settings listed above, I can only tell you that this was the final configuration that worked to have my Apple Airport Express to consistently join my network and extend it. (I use this to give my XBOX 360 connectivity in another room as well as stream music to my stereo.) At one point we tried adding the Airport Express’s MAC address to the router and turned on bridge mode (off by default); however, this just prevented the airport express from ever staying connected or being assigned a valid IP. Frankly, I believe most of the trouble was caused by turning on bridge mode. We went around with a number of setting changes until bridge mode was finally turned off. Bottom line is that you may or may not need to make the setting changes above to get your own Airport Express to work.

If you have more to contribute on these settings, feel free to leave a comment below. But I felt I should at least share what worked for me – everything now works as it did previously (plus increased bandwidth of course), but only after about 2 hours on support. Speaking of support: Each of these configuration changes required the help of someone in the “Level 3 Support.” I spoke with Chris and Tim on two different days. Both were quite knowledgeable (and knew each other – it’s not a huge bunch). If I keep having experiences like this, it will become slightly more difficult to spread the hate toward TWC that I shared in my previous post.

→ 44 Comments  Tags: Uncategorized

Actual Cell Towers in Cary, NC (FCC has duplicates)

In the process of finding a new home in Cary, I found a number of spots where I have no cell coverage. To get an idea of the current state of coverage, I searched for and found a list of cell towers in Cary. The problem, however, is this list confuses and distorts the situation. I created a corrected list (and map) for you.

While I commend the FCC for putting together this list of 135 supposed cell towers listed in Cary, I felt like it was a little confusing to find multiple entries of the same geographic coordinate (duplicates) in the data. This is something I deal with at work, so I pulled out the latitude and longitude values and distilled it down to these 23 unique entries. The same page also mentions that the information here may not be complete, and that other towers may exist. I don’t know enough about radio waves and earth contours to know whether 23 is the right number, but I thought the list might be helpful to anyone wanting them. And I already figured it out for myself. But that’s not the point. The point is that I created a map with these plotted (they have one at the FCC link above, but you don’t have much room on the screen to work with it). I wanted a map I can use in full screen on most setups. So I created this:
Google Map: Cell Towers in Cary, NC

Once I put all these coordinates onto a map, it looks like there are only 16 “real” unique locations, as several of these are within only a few feet of each other. Maybe towers next to one another (perhaps serving different carriers?).

Here is the unique list:
Lat: 35.606389 Lon: -78.825833
Lat: 35.730694 Lon: -78.803333
Lat: 35.741667 Lon: -78.779444
Lat: 35.763611 Lon: -78.753611
Lat: 35.764611 Lon: -78.813806
Lat: 35.766111 Lon: -78.870833
Lat: 35.767778 Lon: -78.845278
Lat: 35.768028 Lon: -78.845361
Lat: 35.769167 Lon: -78.763889
Lat: 35.785917 Lon: -78.792389
Lat: 35.787139 Lon: -78.726917
Lat: 35.787222 Lon: -78.726667
Lat: 35.791639 Lon: -78.748028
Lat: 35.791917 Lon: -78.747972
Lat: 35.791944 Lon: -78.748056
Lat: 35.793889 Lon: -78.761389
Lat: 35.801111 Lon: -78.814167
Lat: 35.818056 Lon: -78.743889
Lat: 35.818083 Lon: -78.743833
Lat: 35.831611 Lon: -78.765917
Lat: 35.831667 Lon: -78.765833
Lat: 35.832444 Lon: -78.871750
Lat: 35.832500 Lon: -78.775278

→ No Comments  Tags: Uncategorized

Raleigh ISP options suck (but there’s a bigger problem)

Update (3/18/2011):
My area has recently been upgraded to now utilize TWC’s “wideband” or “extreme” or “DOCSIS 3.0” service, with promised speeds of 50MB down, and 5MB upstream speeds. My own speedtests have demonstrated at least 40MB down and 5MB upstream. My service changed from $50/mo. to $100/mo. While I am still frustrated with both TWC and many of the other issues described in my rant below, I must say that I have no reason to complain about the speed of my internet connection.

——- Original Post below ————-
One of the benefits of having a blog that no one reads (why would you? i never post to it.) is that you can just up and decide to make a complete rant about something you wouldn’t want to bother anyone with on Facebook or some other medium. But anyway, on to my point.

I recently moved out here to Raleigh from San Francisco. (I loved San Francisco, and I know I’ll miss it, but I was also ready for a change after 10 years.) So far, it has really been an easy transition with the exception of one thing: bandwidth, and more specifically, upload speed. In San Francisco, I received a 3MB upload data rate through Comcast. In a July report from the FCC, they defined “broadband” as having a minimum of 1MB upload. Here in Raleigh the best I can find is 0.5MB.

What is going on? This area is supposedly rich in technology, and home to Research Triangle Park, which is proclaims to be a “model for innovation.” I love thinking about all the possible innovation while I sit and wait for hours for files to transfer.

We have several options here in Raleigh, but they are all poor. I chose Time-Warner, but it really didn’t matter. I could have chosen any of three other vendors and I would have about the same download and upload speed as the other one, and pay about the same. Coincidence? I think not.

This also dovetails into a larger discussion of why America still lags so many other countries when it comes to available internet speeds. I also have tremendous faith in the free market. So something is clearly going wrong here. I think this story is a great example of just how wrong things are around here (and I mean the U.S., not just this area.) If that story doesn’t make you hate Time-Warner, then you didn’t read it. (I probably wouldn’t choose them had I read this article before I selected them.)

When you search around through forums, it’s easy to find people complaining about the speeds around here. Even moreso, there are people so very excited that Time-Warner has “plans” to roll-out DOCSIS 3.0 in this area by the end of the year, and even supported with a supposed email from someone internal at Time-Warner. If a better option existed, they would improve their speeds. And probably instantly. I can pay over $200/mo. for a “business plan” to get the speeds that I had in San Francisco and I don’t think I will be seeing a truck coming down the road laying new wires to my home. They are enjoying their position, and abuse their power to prevent others from competing with it… just like the Baby Bells did, and just like other bloated service providers will continue to do in the future.

Since no one is actually reading, I will continue my rant. The sad fact is that the supremely large corporate entities run this country, and the spineless elected leaders we have across both parties refuse to ensure the consumer wins. Ultimately, we all lose. It becomes a matter of power-to-the-government, or power-to-the-corporation, but never power-to-the-people, and that’s all a free market is anyway. Let real competition happen, let bloated companies fail, quit bailing people out, let people lose their jobs so they can join an efficient organization that is producing enough value for consumers to choose their services.

Our political system generates nothing but actors, and our selfish and mindless reality-tv focused heads just grab the prettiest thing at the moment, letting our short attention span move on to the next Facebook post. In return we have this government, this waste, this inefficiency, and a country that is dangerously weak relative to the rest of the world.

But I must be missing something, because I still choose to live here. But I feel like I’m on borrowed time.

→ 11 Comments  Tags: Rants · Tech

Rupert Howls at Siren

Rupert always howls when the fire truck goes by, frequently matching pitch. May be an instinctive response, but I still love it. And I really need to stop posting pet videos – I might be addicted.

→ No Comments  Tags: Pets

Early video of Rupert

After putting up a video of Jax, I couldn’t help myself and went and found a video of Rupert when he was a puppy. Sadly, the video is out of focus for some reason, but the content outweighs the problems in this case, so I’m uploading it anyway.

→ No Comments  Tags: My Life · Pets

Early videos of Jax

Rupert’s best friend is a dog named Jax. He’s a super great dog, and now almost three. But I took this video shortly after Travis brought him home, and just thought I would share… unless Travis tells me this is inappropriate young dog footage… or Aki doesn’t like Travis’s patronizing (but humorous) tone.

Oh, found another one. This one is even cuter, in my opinion:

→ No Comments  Tags: Pets

Cool iPhone Bike Mount

So maybe I am crazy taking my iPhone to mount on my bike at Burning Man (which, OK, I may not do), but I will say that in the process I found a great thing that’s practically free. My iPhone mount arrived today and fits solidly on my bike, and cost just $7 total (shipping included):

Yes, the English translation is weak, the guy is sending it from Hong Kong and hand writes the shipping label, and it takes like 12 days to get here. And truly, the mount can be used to hold any squarish and light device – not just the iPhone. The box reads “Bicycle Phone Holder.” But after mounting it on my bike, it feels quite solid, and I’m looking forward to a test ride. I’ll update this post with a track of my ride if it goes well. Which brings me to a related note.

If you’re ever wanting to track your rides around town using something like MotionX GPS, you’ve spent $3 on the app and $7 for a holder – pretty sweet bicycle GPS tracking tool for $10:

Anyway, good stuff.

Is this post really that exciting that it justifies a post after over a year of not writing anything at all on my blog? No, but at least I posted something. I plan to write more soon.

→ No Comments  Tags: Recommendations · Tech

Older Posts »

Imhotep theme designed by Chris Lin. Proudly powered by Wordpress.
XHTML | CSS | RSS | Comments RSS