Temperature Sensor 2 0

From RepRapWiki
Jump to: navigation, search

Contents

Temperature Sensor v2.0

Overview

<div class="thumb tright">
Cache-2803390260 2d40357b04.jpg
</div>

This board allows you to use a thermistor to measure the temperature of something. It is designed to be used to measure things in the range of 100C - 300C, but with the proper calibration and resistors, it can be adapted to any temperature range you need (under 300C). If you need something that can measure temperatures above 300C, you should look into the Thermocouple Sensor.

Get It!

Full Kit

Raw Components


Files

<div class="thumb tright">
Cache-2848762404 9bbddd790a.jpg
</div>

You can download the electronics files from Sourceforge.

This file contains the following:

  • GERBER files for getting it manufactured
  • PDF files of the schematic, copper layers, and silkscreen
  • Eagle source files for modification
  • 3D rendered image as well as POVRay scene file
  • exerciser code to test your board.


Schematic

Cache-2848762530 68617b1d24.jpg

Interface

Pin Function Cat5e / Cat6 Color
5V This is the pin to supply +5 volts on. Blue and Blue/White (both are connected)
SIG This is the signal pin. It will output a voltage between 0 and 5 volts that correlates with the temperature. Green
GND This is the ground pin. Brown / Brown/White (both are connected)

Signal Values

The thermistor circuit is a voltage divider that can be read with an ADC such as the one on an Arduino board. That value can then be run through a formula to get the temperature in degrees. This circuit has been documented in full detail in a blog entry by nophead.

Thermistor Values

You can use a variety of thermistors with your temperature sensor.

Read more on them here.


Build It

Board Bugs

  • No bugs yet, please report any you find to the forums.

Printed Circuit Board

<div class="thumb tright">
Cache-2802538969 0148fd582c.jpg
</div>

You can either buy this PCB from the RepRap Research Foundation, or you can make your own. The image above shows the professionally manufactured PCB ready for soldering. Its also really cheap since it is so small!


Components

<div class="thumb tright">
Cache-2802539973 420d5a69f9.jpg
</div>

<iframe src="http://parts.reprap.org/embed/module/Temperature+Sensor+v2.0" width="600" height="420" frameborder="0">Visit http://parts.reprap.org/embed/module/Temperature+Sensor+v2.0</iframe>

Soldering Instructions

<div class="thumb tright">
Cache-2802538969 0148fd582c.jpg
</div>

R1

R1 is an optional resistor for advanced applications that need the parallel resistor. For example if you wanted to use a 10K thermistor, etc. The vast majority of people will leave it empty.

<div class="thumb tright">
Cache-2802540687 2823e4f77e.jpg
</div>

R2

The value of R2 will depend on your thermistor. If you use the RRRF kit, it will be 4.7K ohms.

<div class="thumb tright">
Cache-2803387884 f6d2d21623.jpg
</div>

R3 - 1K ohm resistor

Insert the resistor in any orientation. This resistor is for the LED.

<div class="thumb tright">
Cache-2803388578 cbe9f7f2c8.jpg
</div>

LED

This is the power indicator LED.


<div class="thumb tright">
Cache-2802542725 a0e0e4f48a.jpg
</div>

C1

Electrolytic capacitors have a polarity. Make sure the stripe on yours matches the one in the picture.

<div class="thumb tright">
Cache-2802543291 abb0358f98.jpg
</div>

Screw Terminal

Make sure you insert the connector correctly: with the opening facing the outside of the board.

<div class="thumb tright">
Cache-2803390260 2d40357b04.jpg
</div>

RJ45 Jack

We use an Ethernet connector for connecting various sensors and other boards together. We are only using the physical jack and wires, it does not actually connect to the internet!

Alternative Connection

<div class="thumb tright">
Cache-2421251944 c6bd1f7f6a.jpg
</div>

Headers

If you feel like the RJ45 jack is too bulky and/or overkill, we have provided a standard .100" spaced header inside the jack footprint. Simply solder any type of .100" header in there. In this example, we've used right angle connectors to make it low profile.


Test It

Now that you have your temperature sensor tested, you'll want to test it.

Wire it up!

<div class="thumb tright">
Cache-2421252100 0661d6020c.jpg
</div>

The wiring is very simple:

  1. Wire 5 to +5v on the Arduino
  2. G to GND on the Arduino
  3. S to Analog 0 on the Arduino

you're done!

If you have an IDC connector laying around, its even easier! Just plug it into the connectors!


Upload firmware to Arduino

Create a new sketch and copy/paste the code below into it. Upload it to your Arduino.

The code below is for the standard EPCOS 100K thermistor that comes from Mouser. If you use a different thermistor, or are using different resistors in the board, we have a python script that you can run to generate new values in the lookup table, or you can grab a pre-calculated table from the thermistor page.

#define THERMISTOR_PIN 0

// Thermistor lookup table for RepRap Temperature Sensor Boards (http://make.rrrf.org/ts)
// Made with createTemperatureLookup.py (http://svn.reprap.org/trunk/reprap/firmware/Arduino/utilities/createTemperatureLookup.py)
// ./createTemperatureLookup.py --r0=100000 --t0=25 --r1=0 --r2=4700 --beta=4066 --max-adc=1023
// r0: 100000
// t0: 25
// r1: 0
// r2: 4700
// beta: 4066
// max adc: 1023
#define NUMTEMPS 20
short temptable[NUMTEMPS][2] = {
   {1, 841},
   {54, 255},
   {107, 209},
   {160, 184},
   {213, 166},
   {266, 153},
   {319, 142},
   {372, 132},
   {425, 124},
   {478, 116},
   {531, 108},
   {584, 101},
   {637, 93},
   {690, 86},
   {743, 78},
   {796, 70},
   {849, 61},
   {902, 50},
   {955, 34},
   {1008, 3}
};

void setup()
{
   Serial.begin(9600);
   Serial.println("Starting temperature exerciser.");
}

void loop()
{
   int rawvalue = analogRead(THERMISTOR_PIN);
   int celsius = read_temp();
   int fahrenheit = (((celsius * 9) / 5) + 32);

   Serial.print("Current temp: ");
   Serial.print(celsius);
   Serial.print("C / ");
   Serial.print(fahrenheit);
   Serial.println("F");
   
   Serial.print("Raw value: ");
   Serial.println(rawvalue);
   Serial.println(" ");

   delay(1000);
}

int read_temp()
{
   int rawtemp = analogRead(THERMISTOR_PIN);
   int current_celsius = 0;

   byte i;
   for (i=1; i<NUMTEMPS; i++)
   {
      if (temptable[i][0] > rawtemp)
      {
         int realtemp  = temptable[i-1][1] + (rawtemp - temptable[i-1][0]) * (temptable[i][1] - temptable[i-1][1]) / (temptable[i][0] - temptable[i-1][0]);

         if (realtemp > 255)
            realtemp = 255; 

         current_celsius = realtemp;

         break;
      }
   }

   // Overflow: We just clamp to 0 degrees celsius
   if (i == NUMTEMPS)
   current_celsius = 0;

   return current_celsius;
}

Try it out

<div class="thumb tright">
Cache-2421252288 1c498a6f50.jpg
</div>

Start up your Arduino, and open the serial monitor. The exerciser code reads the thermistor every 2 seconds and outputs the current value of the thermistor, as well as the estimated temp. The thermistor code is only accurate at higher temperatures, so get some sort of heat going. I recommend a heat gun, but a lighter will also work in a pinch. Heat it up, and watch the terminal. The most important thing to check is that it is actually changing with temperature and is relatively accurate.

If so, then you've successfully built your temperature sensor. Congratulations!


History

Previous Boards

Changelog

  • Added an RJ45 jack
  • Added a power LED