Sunday, May 10, 2015

Raspberry PI as a remote 3G connected temperature monitor

This is the first post in a series about building a temperature monitor for reporting air and water temperature far out in the archipelago, to windows azure.

I have decided to go with the Raspberry Pi, Dallas 1-wire sensors and a USB 3G modem. This configuration has a couple of advantages, price, building speed and flexibility. The biggest drawback is Power consumption.

I would like to have the monitor solar powered, but that is not my first priority, it´s possible to get mains power at one of the possible locations.

I have split up this post in five parts:

  1. Setting up the Pi and core software.
  2. Connecting to 3G
  3. Reading a 1-wire sensor and reporting to azure
  4. Configuring automatic reporting and multiple sensors
  5. Mounting everything in the box
  6. Publish the results on a website 

Setting up the Pi

Installing Raspbian

I started off with Raspbian, it is a free operating system based on Debian optimized for the Raspberry Pi hardware. You could as well start with "Noobs", but for this project I used a Raspbian image. The selected image must be downloaded and put on an empty SD-card. For this to work I used Win32DiskImager as instructed here

When the image is written to the SD-card, take it out of your computer and put it in the Pi and connect power.

I connected the Pi tom my network via an ethernet cable, checked the DHCP-server for which IP-address it had been assigned and connected via SSH with Putty.

Login is "pi" with the password "raspberry".

Change password

First thing after logging in should be changing the default password to something different. Just type "passwd" at the prompt, hit enter and follow the instructions

Changing hostname
If you have more than one Pi on your network I recommend that you change the default hostname

from "raspberrypi" to something more appropriate.

 pi@raspberrypi ~ $ sudo hostname jens-pi 

where "jens-pi" is the new hostname.

Broadcast your hostname

For me, being a windows guy since windows 2.0, netbios name resolution is a must. I want to connect to my computers via name resolution with minimal effort, so i will install samba for this sole purpose.

pi@jens-pi ~ $ sudo apt-get install samba         

after a reboot you should be able to connect with Putty by specifying your new hostname instead of the IP.

Next

In the next part i will setup the 3G connection and configure reading of the 1-wire sensors.