My Pi Description

My Experiences With the Raspberry Pi -- Tracking My Learning -- My Pi Projects

Saturday, June 8, 2013

A Raspberry Pi Thermometer - The Hardware

This is my first post in quite a while. I have, however, been busy with my Pi - just havn't been writing about it. There will be upcoming posts about my Gertboard and my camera remote control/motion detector project. The project uses the ATmega microcontroller on the Gertboard, so I got to use the Arduino IDE (Integrated Development Environment) and program in C rather than Python. I'll have a lot to say about the Gertboard, and not all I'll say is flattering. This post, however, is about a project that does not use the Gertboard, just the Pi and the breadboard that you see in the header of this blog, with the addition of temperature sensors.
I purchased two temperature sensors from Adafruit, both are DS18B20 1 wire devices. The only difference between them is one looks like a TO-92 package transistor and the other is packaged into metal, waterproof, cylindrical case (6 mm diameter, 30 mm long) with a 36" integrated, shielded, cable. Adafruit also sells a higher temperature version. Actually, what makes it a higher temperature device is that it has a PTFC cable that allows it to to be used up to the 125°C rating of the sensor. The sensor is the same. The less expensive version, I purchased, has a PVC cable. Adafruit suggests not to expose the PVC cable to over 100°C.
Both versions (we'll consider the two waterproof versions as the same), are the same electronically, and will measure between -55°C to 125°C (-67°F to +257°F). They measure with 9 to 12 bit resolution. The more bits, the longer it takes between measurements. The default is 12 bit resolution and it can take a measurement about every 750ms. The remarkable thing is they only have three leads (the waterproof model has the cable shield brought out along with the three leads). One lead is ground, another is power which can be from 3.0Vdc to 5.5Vdc. The third pin is for data, used to write to and read from the device. The data line is "open collector" (when not driven to a logic low, acts like it is not connected to the circuit), therefore it is necessary to include a "pull-up" resistor between the data pin and the source of power that the device connects to (in the case of RaspberryPi, 3.3V). The open collector configuration allows you to connect the data pin of more than one device to the same Pi GPIO pin (of course, only one device can talk to the Pi at any one time). Adafruit, ships the devices with a 4.7K resistor. In fact, it is possible to ignore the power pin and power the device from the data pin (via the pull-up resistor. This mode complicates the timing and thus the programming, so I don't think I will try that feature.
My project is installed on my breadboard that has a 16 character by two line LCD display and a push button switch installed. Please see my previous blogs where I use these devices. My projects with the temperature sensors, detailed in subsequent blogs include:
1.    Making a temperature reading every two seconds and reporting the readings, along with the date and time, to the terminal
2.    Doing the same thing but also displaying temperature, date, and time to the LCD display
3.    Doing all the same but making a reading every minute
4.    Doing all the same but logging the results to a file.

No comments:

Post a Comment