Datalogger: SHT11, DS1305, PIC16F887, MAX232

What is this page missing? The schematic, pictures, a movie?

sht11artsy

Version: 1.01 October 2009
Notes on version 1.00: The code is a complete mess! (no longer available)
Notes on version 1.01: Changed int16 variables to float variables for the SHT11. Code changed a little. Made a little easier to read, but is still elementary. In the future, this program may be updated to be more compact.

Desired Attributes:

  • Read current Temperature, Humidity, Time and Date
  • Calculate Dewpoint based on measurements (temp and humi)
  • When requested, record data to EEPROM at constant interval (1 – 120 minutes)
  • When desired, communicate through Serial connection with Linux based program to quickly: convert raw data into usable data and erase EEPROM

This project has taken on many aspects that I had not planned for in the beginning. (Temperature, Humidity, Dewpoint and Clock datalogger) I started the project, and somewhow it was erased from my computer. I had spent days writing code and was instantly frustrated by the erasure so I put the project down. I picked it back up in August after I found the parts in a box in the barn. I spent quite a bit of money on the parts so I figured I should try and do something with it.

In late August I published a working program that simply displayed the current SHT11 readings on a display using a PIC16F690 microcontroller. Although the program had flaws in it, I was very pleased with its performance. (The SHT11 Temperature Probe Lives!!!)

In October, I started my next post, but I never published it because I just kept taking readings and debugging the code I wrote for the PIC16F887. Errors were plenty, and I was still getting used to the LCD commands. (The Temp/Humidity/Dewpoint Datalogger: Final Product) Even though the title of the last blog post was “Final Product”, the development of this project was still underway.

The next portion of my project was stumbled upon by accident. While I was taking readings and recording them to EEPROM, I wanted to know what the EEPROM looked like so I read the EEPROM using MPLAB and the PICKIT 2. I discovered I could save the outcome as a text file, and this sparked my desire for more. Using MPLAB for taking reading is like going North first to go South, and a little bit inconvenient due to the many connections needed to do so. Also, reading the contents of the EEPROM using MPLAB also resets the microcontroller which made recording stop. To fix these problems I knew that I needed to use Serial communcations to get this info. Serial communication is 3 wires (ground, tx, and rx) and uses a program sequence to communicate data. This created a need to write a program to communicate via a Serial port.

I usually work in Windows so I searched for a way to communicate through the Serial port using C++. I didn’t have any luck getting things working so I checked it out for Linux. I Googled for info and the results were exactly what I wanted: A tutorial on Serial communications using C++. I began experiments in Serial communication using this tutorial.

Now I have version 1 where I want it. It does exectly what is described in the Desired Attributes section. I am going to slow down and do real-world analysis to be sure that it performs to my specifications. My specifications are simple. I need it to perform measurements without being affected by heat dissipation from internal parts, and I need it to do the same without glitches in the programming. Version 1.01 fixed the humidity glitches by making the variables floats instead of int16. I think it just fixed how the microcontroller handled the negatives and decimal points. 

Parts list:

  • PIC16F887 microcontroller
  • MAX232 RS232 driver
  • SHT11 Temperature/Humidity sensor
  • DS1305 Real Time Clock
  • 4×20 LCD display w/backlight
  • 10k pot and knob
  • 3 – SPST-NO buttons
  • 3 – .1uF tantalum caps (for MAX232)
  • 32.768kHz watch crystal
  • .1F supercap
  • 2 – 1.0uF  electrolytic caps
  • Multiple resistors (See Schematic)
  • 7805 regulator
  • Heatsink, screw, and compound
  • 9 volt wall wart (300mA or more)
  • male barrel DC jack
  • 2 - male DB9 connectors
  • 2 – female DB9 connectors
  • cat5 cable (makes some wiring easier and neater)
  • Project box
  • perfboard or PCB
  • datasheets, program files, compilers, programmers, misc tools, Linux computer w/ Serial port

Datalogger code and communication program code (dataloggerv1_01.zip)
Sensirion SHT11 page (datasheets)
MAX232 datasheet
PIC16F887 datasheet
MELABS LCD datasheets

dataloggerfrontdataloggertopClick each picture to see a larger view. I’ve annotated some things in yellow.

One thought on “Datalogger: SHT11, DS1305, PIC16F887, MAX232

  1. Pingback: Datalogger page is now published « Tech Tut

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>