Maker Pro
Maker Pro

air temp monitor with digital display???

hey guys
just wondering.....i know its probably not the point of this forum, but wondering if anyone can help me out with a schematic diagram and any programming details id need to make an air temp monitor, that could display on a small display screen. it is all to be housed in a control box that has 12v dc to keep a check on the internal temperatures.

any info you could give me would be appreciative.

cheers.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Interestingly enough, I just built something that would do just that using an arduino Pro Mini and a DS18B20, oh, and a 2 line x 16 character LCD display.

I actually built it as a test bed for the DS18B20 in preparation for another project.

However the source for the code (programmed onto the arduino) contains the wiring description, so if you're interested I could tart it up a bit and pass it along to you.

It measures with a resolution of about 0.01 degree C but noise means you'll only really get a usable resolution 0.1 degree C. (Actually, I think it's internal heating that gives me a rise of about 0.05 degC over a period of about 30 seconds until it stabilises)

I think the range of temperatures the sensor is rated for are something like -55C to 125C, but in any case they far exceed the range you need.

Mine is pretty cheap. I got some Arduino Pro Mini clones for under $3 each recently and this test was also a test of them -- they work! I can't remember what I paid for the display, and the sensor was about $5 (but I'm using a waterproof one on a 1m cable)

Do you have any experience with the Arduino environment?
 
0 arduino experience :(
sounds like what you have would be super suitable for me. an accuracy of 1C or so would be more than suitable, but im easy.
 
what parts exactly would i need?

you got a list of part#'s and stuff so i could add it all up, what do i need for the arduino side of things?
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
OK, the parts are approximately these:

An Arduino pro mini clone. Alternatively an Arduino nano clone would not require the programming interface.

A programming interface (for the mini -- the nano just needs a USB cable). Note that this programmer can also be used to flash new firmware to the nano. An alternative is one of these, and one of these.

A temperature probe. I use one of these, but one of these may be better for your application.

A 2 line x 16 character LCD display (you can easily choose a different size)

A 20k trimpot (to set the contrast)

The development environment.

You'll also need a couple of libraries off the net. I think my source code mentions them.

And you'll need something to build this on. For prototyping I used something like this. They are reuseable. They let you quickly make a circuit to try it out.

Some of the parts will need header pins soldered to them, so you'll need a soldering iron and some amount of skill to use it. You might want to buy some header strip for the LCD display. (you'll use less than 1/2 of one strip -- you need 14 pins I think.

On the breadboard, I use these wires. (and sure, you can make your own by tinning the end of hookup wire or using solid core wire).

I think that's about it. I'll post my code in another message in a minute or so...
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Here is my code

Code:
/*
  DS18B20 temperature sensor demo
  
- - - - - - - - - - - - - - - - - - 
  
  The LCD circuit:
  
 * LCD pin 1 (gnd) to gnd
 * LCD pin 2 (Vcc) to +5v 
 * LCD pin 3 (VO) to wiper of 20k pot between Vcc and gnd (contrast adj)
 * LCD pin 4 (RS) to digital pin 9
 * LCD pin 5 (R/W) to gnd
 * LCD pin 6 (clock/enable) to digital pin 8
 
 * LCD pin 7 (D0) UNUSED
 * LCD pin 8 (D1) UNUSED
 * LCD pin 9 (D2) UNUSED
 * LCD pin 10 (D3) UNUSED
 
 * LCD pin 11 (D4) to digital pin 7
 * LCD pin 12 (D5) to digital pin 6
 * LCD pin 13 (D6) to digital pin 5
 * LCD pin 14 (D7) to digital pin 4
 
 http://www.arduino.cc/en/Tutorial/LiquidCrystal
 
 - - - - - - - - - - - - - - - - - - 
 
   The DS18B20 circuit:
 
 * DS18B20 pin 1 to gnd (black)
 * DS18B20 pin 2 to digital pin 2 (yellow)
 * DS18B20 pin 3 to Vcc (red)
 
 http://www.hobbytronics.co.uk/ds18b20-arduino
 
 - - - - - - - - - - - - - - - - - - 
*/

// include the library code for LCD:
#include <LiquidCrystal.h>
#include <SPI.h>
#include "printf.h"

// include library code for DS18B20
#include <OneWire.h>
#include <DallasTemperature.h>
 
const 
  uint8_t num_rows = 2;
  uint8_t num_cols = 16;
  uint8_t scan_wide = (num_rows - 1) * num_cols;

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);

// Data wire is plugged into pin 2 on the Arduino
#define ONE_WIRE_BUS 2
 
// Setup a oneWire instance to communicate with any OneWire devices 
// (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
 
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
bool bLedOn = false;

// function to print a device address
void printAddress(DeviceAddress deviceAddress)
{
  for (uint8_t i = 0; i < 8; i++)
  {
    if (deviceAddress[i] < 16) lcd.print("0");
    lcd.print(deviceAddress[i], HEX);
  }
}

#define TEMPERATURE_PRECISION 11

DeviceAddress tempDeviceAddress; // We'll use this variable to store a found device address

void SetRes(int i)
{    
  if(sensors.getAddress(tempDeviceAddress, i))
  {
    int maxRes = sensors.getResolution(tempDeviceAddress);
    
    do
    {
      // try the next highest number of bits
      sensors.setResolution(tempDeviceAddress, maxRes+1);

      // if it doesn't get set correctly      
      if (sensors.getResolution(tempDeviceAddress) != maxRes+1) 
      {
        // must have gone too far
        break;
      }
      
      // That's OK, let's try for 1 more
      maxRes++;
    }
    while (1==1); // loop forever

    // set to the highest found
    sensors.setResolution(tempDeviceAddress, maxRes);
  }
}

float temp;

void setup()
{
  // set up the LCD's number of columns and rows: 
  lcd.begin(num_cols, num_rows);
  // Print a message to the LCD.
  lcd.print("DS18B20 Demo");

  // initialize the digital pin as an output.
  pinMode(led, OUTPUT); 

  // Start up the sensor library
  sensors.begin();  

  lcd.setCursor(0, 1);
  SetRes(0);
  
  sensors.requestTemperatures(); // Send the command to get temperatures
  temp = sensors.getTempCByIndex(0);
}

void loop()
{
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  
  sensors.requestTemperatures(); // Send the command to get temperatures
  temp = (temp*4 + sensors.getTempCByIndex(0))/5;
  lcd.print(temp); 

  lcd.print("/");
  lcd.print(sensors.getResolution(tempDeviceAddress), DEC); 

  digitalWrite(led, bLedOn);
  bLedOn = !bLedOn;
}

It's straight as I wrote it, I didn't bother to make it nice, so you may need some assistance.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
And here is a picture of it running. Yes, that's the temperature inside my house right now (29.11C and the /12 tells me I'm doing 12 bit temperature readings).

A close look at the code will reveal that I'm displaying a sort of moving average of the last readings, but one which is weighted toward the most recent reading.

attachment.php


Only just visible at the top left of the image is the programming adapter. WHat you can actually see is the 10 pin to6 in adapter with some grey heatshrink over it. I have just wired it up to the appropriate pins on the pro mini.

The programmer is providing power right now, you'd need to find an alternate source of power for actual use.

When the code refers to "pins" on the arduino, it is actually referring to the "digital pins", not the actual pin numbers. Normally I make that clear in the code, but not always.
 

Attachments

  • IMG_5639b (Small).JPG
    IMG_5639b (Small).JPG
    64.7 KB · Views: 149
29.11C! You are really on the summer side of the world then, Steve.

Not that the Winter is severe here in Scandinavia this year, but we have around 0C at the moment. Outside that is!
 
Top