Introduction: Data Logging Temperature Probe (-200 °C to +1300 °C)
I needed to take temperature vs. time measurements for a piece of research equipment in order to determine how much time in advance someone should start prepping before they actually intend to use the equipment. In this case, prepping involves cooling down a metal thermal mass using liquid nitrogen in order to trap moisture in the surrounding air space via condensation.
I could have gone out and bought a more expensive temperature sensing product that may have done what I needed. However, given the simplicity of a thermocouple, combined with the specific list of requirements I had for my particular case, the more cost effective (and more fun) option was to build one myself that would meet my needs. For example, here are some of the requirements that made an inexpensive store-bought thermocouple unsuitable, and also further drove up the price of the more expensive special use options. The space I was measuring in was compact (about the size of a fist) and sealed by a gate valve during cooling, so we couldn't just probe it while holding a read-out display. Therefore a second requirement was that the system had to be self contained by recording its measurement history so that it could be retrieved later. And third, liquid nitrogen temperatures (boiling point = -196C) are far beyond the range of cheap TMP sensors found in many temperature sensing electronics, so they could not be used.
The main benefits of the Data Logging Temperature Probe:
- Temperature measurements from -200C to +1300C with the same device (Note: The probe can get this hot, the electronics cannot)
- Incorporates NIST coefficients and calculations to compensate for non linear voltage response at extreme temperatures (near the measurement limits)
- Compact footprint, measuring under 2" square and about 3/4" thick, not including the probe and battery
- Measurement recording interval as fine as 1 second ( < 1 second for advanced users who wish to tweak the code)
- Capable of displaying measurements on a computer in realtime while recording them to the SD card simultaneously
- For a given data collection period, the total duration of data collection and the total number of data points scale with battery and SD card size.
Step 1: Gather Materials
A) Essential Materials I (you will probably need to buy):
B) Essential Materials II (you will need, but may already own):
- 18-22 Gauge Hookup Wire, Several Colors - Solid core wire recommended, but stranded wire like I used will do the job
- Soldering Iron - This one even comes with some useful tools like a de-soldering pump and some solder to get you started
- Prototyping Printed Circuit Board aka Perfboard
C) Useful Materials (though not necessary to make this Instructable)
Step 2: Lay Out Your Board
The layout configuration you choose is up to you, and may depend on the geometry of the location where you plan to gather your data. I chose to lay the boards out in a close packed arrangement, approximately forming a square.
Turning the perfboard over, you can see that my configuration takes up 15 x 15 pins.
In the schematic view shown from the same orientation, I've labeled the pins and the boards they belong to. 2 labels you won't see written on your board are MISO and MOSI. These stand for Master In Slave Out and Master Out Slave In, respectively. These are each 1-directional communication lines used for SPI, or Serial Peripheral Interface, communication protocol. We will be using this protocol to talk back and forth from the Metro Mini (the master) to the thermocouple and the SD card (the slaves). MISO and MOSI pins on the Metro Mini are hardware configured as pins 12 and 11, respectively. The clock pin, CLK, is also hardware configured as pin 13, and all of these configurations match the Arduino Uno, a more common micro controller prototyping board you may be more familiar with.
Using SPI, many devices can share a single MISO line (commonly marked as DO on the slaves), MOSI line (commonly marked as DI on the slaves), and CLK line. The only unique connection a slave needs is the chip select or CS line. In this case I have the SD card CS going to pin 10, and the thermocouple CS going to pin 9 on the Metro Mini. We will talk to one device at a time by using the code to set its CS pin state to LOW (the active state in this case), with all other devices' CS to HIGH (the inactive state). I've shown all of these pin connection numbers in () in the schematic.
NOTE: One thing that may be confusing is the pin on the thermocouple called Vin. This is NOT connected with the Vin pin on the Metro Mini. The Metro Mini calls for 6-16V input, the thermocouple calls for 5V input, so we will be connecting the Metro Mini's 5V pin to the thermocouple's Vin pin. This is shown clearly in the next step, where we start to wire our devices.
Step 3: Solder Wires in Place
A schematic wiring diagram for the device is shown. In the next image, I've taken the perfboard schematic, this time viewed from the top (the side without solder pads) and drawn what will be the physical wire connections as thick colored lines. The short thin lines will be solder bridge connections for a later step.
Take your perfboard and wires and replicate the schematic. Cut each wire to slightly oversize, then strip the ends so that the insulated part of the wire reaches from hole to hole as needed. Feed the bare ends of the wire through the perfboard, and then bend over the ends on the backside so the wires stay in place, as shown. The battery clip leads are not shown in these images, however the same thing can be done with those wires at this time as well.
Once your wires are in place, you may want to test fit your electronics to make sure they fit snugly against the perfboard and do not pinch any wires. Remove your electronics once again and it is time to solder to wires in place.
Looking at the underside of the perfboard with the wire leads exposed, unbend a single wire. To solder it, hold your soldering iron against the wire itself and the solder pad. Touch your solder to either the wire or the pad, and surface tension should pull the solder into the gaps and form a strong, clean bond. Note that you never actually need to touch the solder directly to the iron. Doing so will usually cause solder to go to undesired places.
Do this to each wire lead, then trim off extra wire with a pair of snipping pliers.
Step 4: Solder Electronic in Place
If you have not yes soldered your battery leads in place, do so before proceeding.
Once again, replace all the electronics onto the top of the perfboard, pushing the header pins through the perfboard holes so the the boards fit snugly.
Turn the board over and solder the pins in place. Since you just soldered all the wires in the last step, soldering the header pins should be straightforward.
Step 5: Bridge Appropriate Solder Connections
The top view wiring schematic is shown again for this step. The short thin lines between perfboard holes indicate solder bridges, which will be made on the underside of the perfboard.
Bridging solder connections cleanly and without causing undesired shorts can take some practice. Hold your iron so it touches both leads that will be connected. Once you see the existing solder on the board start to melt, apply your solder to one side of the connection. As the solder you are adding begins to melt, move your solder wire from one side of the connection to the other, and you should form a bridge. For three pin bridges, break it into two steps. For example, first bridge the left->middle pin, then bridge the middle->right pin.
If you add too much solder, or it goes where you didn't want it, you can try to reheat it by dragging your soldering iron across the excess solder to move it to where you want it. Often, surface tension will take care of the issue and cause the solder to move into place. If this still does not work, de-soldering wick may come in handy to remove excess solder.
Either as you go, or once you are done, you may want to use a voltmeter with continuity testing capability to ensure there are no unintended shorts between adjacent bridges. If there is a short but you can not visually see where it is coming from, scraping a toothpick or a knife in between the bridges is usually enough to remove any residual conductive material.
If you wish, you may remove any extra perfboard at this time. This is done by either scoring several times across a row of holes with an X-acto knife, then bending until it breaks, or with a rotary cutting tool such as a Dremel. Either way, use caution.
Step 6: Load and Test the Code
Before proceeding, it would be wise insert your SD card into your computer (either directly or with an appropriate adapter) and format it using the official SD Card Formatter from the SD Association.
If you are new to using Arduino based microcontrollers, visit the Arduino website and download the Arduino IDE (Interactive Development Environment).
Next, go to this GitHub page and download the library for the MAX31855 breakout board. Save the library files in your Arduino documents folder. For me this is located in Documents/Arduino/libraries, but this will vary depending on how you set up your computer's file system. Make sure the name of the MAX31855 library folder is Adafruit_MAX31855. This will contain several files, you may need to change the name of the files with the .cpp and .h extension. If they are not called Adafruit_MAX31855.cpp and Adafruit_MAX31855.h, then change the names so they are. For a more thorough tutorial on installing and using libraries, visit this page from Adafruit.
Do not connect the battery yet. Insert the SD card into your thermocouple data logger, and attach the thermocouple leads to the screw terminals (red lead to - and yellow lead to +). Using a USB cable, connect the Metro Mini to your computer's USB port.
Once connected, and with the Arduino IDE open, go to the menu bar and select Tools->Board and select Arduino Uno if it is not already. Then go to Tools->Port and select the USB port you are plugged into (this will vary by computer, operating system, and which USB port you are physically using).
Open the file Thermocouple_Logger.ino in the Arduino IDE. After the program header information, you will see the following lines:
const int TOTAL_TIME = 1; //measurement time in minutes const int MEASUREMENT_INTERVAL = 5; //sampling interval time in seconds const bool SERIAL_MONITOR_ON = true; //make false for data logging w/o a comp, turn true //for serial monitor on computer, useful for debugging
These are what you will change to fit your desired measurement conditions. To test that everything is working, hit the 'Upload' button. Once complete, open the Serial Monitor to monitor system status. If you touch the end of the thermocouple you should see the temperature readings rise. Once complete, insert the SD card into your computer and check that the csv file is present and populated with data.
If you have known reference temperatures that span your expected measurement range, such as boiling water (~100 °C), or in my case ice water (~0 °C) and boiling liquid nitrogen (~ -196 °C) you can apply a linear fit correction to the measurements to get even more accurate results, since typical thermocouples are only accurate to within a couple degrees.
If everything works as expected, adjust the measurement time (in minutes) and the measurement frequency (in seconds) to fit your needs. Change SERIAL_MONITOR_ON from true to false. Hit upload once again. When that is complete, unplug the Metro Mini from your computer.
You are now ready to begin recording temperature data to SD storage in the field! Data collection begins as soon as you plug the 9V battery into its clip. Data will be stored on the SD card as TEMP.csv. Recorded values include the internal (reference) temperature, the standard (linear) temperature calculation, and two versions of NIST temperature calculations, found here. I will be using the heypete NIST version, since that includes calculations for when the reference temperature is < 0 °C, which I expect in my case. You have just built a data logging thermocouple capable of measuring temperatures from -200 °C to +1300°C and storing them to an SD card in a csv file!
Happy Data Logging!