Temperature monitoring project

battman

1 W
Joined
Jan 13, 2010
Messages
57
Location
Tempe, Arizona, USA
Overview
This project provides reliable and scalable monitoring of temperatures through one or more digital sensors with results shown on a 4 digit LED display. The initial implementation has been used to monitor temperature at 12 points within an existing battery pack.

temperature_monitor_built.jpg

Usage
On power up, the sensors are initialized to 9 bit resolution (if not set to this already) and the number of attached sensors is read.
Switch SW1 is used to select between two display modes, default to mode B:
A. Read the temperature of all sensors and display the sequence number and temperature of the sensor with the highest temperature reading. The refresh rate for this value is 0.1 seconds * number of attached sensors.
B. Cycle over each sensor, read and display its temperature for 0.6 seconds.
The first two digits of the display show sensor number and the second two display temperature in degrees celcius with the display value clamped to 0 or 99 if the temperature exceeds those limits.

The sequence number of a sensor is determined by the unique 64-bit serial code stored in its ROM and is not configurable in this project implementation, although see the Enhancements section below for how the sequence could be made configurable.

Design Decisions
The digital temperature sensor DS18B20 was chosen for the following reasons:
  • Noise immunity (compared to analog line).
  • Only one data line is required regardless of the number of attached sensors. This reduces both the amount of wire required within a multi-sensor application and requires just one available input port in the connected microcontroller.
  • No temperature calibration required.
  • 'B' variant of the DS1820 chosen for 93.75ms 9-bit temperature conversion time. The 12-bit resolution of DS18(S)20 requires a conversion time of 750ms and was considered overkill.

Digital sensors certainly cost a lot more than analog sensors, but the benefits listed above were considered to far outweigh the extra cost. Shop around for the DS18B20 - its cost varies widely online. If 2oC accuracy is sufficient and it can be found at a good price, the DS1822+T&R should work as a drop-in alternative.

The combination of a low pin count microcontroller, the Microchip PIC16F15313, plus a display driver chip, the Maxim MAX6958, was chosen in preference to a single high pin count microcontroller performing both duties for the following reasons:
  • Reduced overall component count. Display driver eliminates need for additional transistors and resistors otherwise required to keep microcontroller power dissipation within limits.
  • Allows the microcontroller to operate single-threaded. Reduced software complexity and prevention of issues of display flicker during sensor reads.
There probably wouldn't be much difference in component cost between the display driver and large microcontroller approaches.

The value of 2.2K pullup resistor between the sensor DQ and V+ lines could possibly be increased. Initial testing was performed with a 4.7K resistor but instability was seen with more than 8 sensors at the higher resistance.

Schematic
temperature_monitor_schematic.png

The perfboard layout for the components is shown in this PDF:
View attachment temperature_monitor_perfboard.pdf

BOM
The BOM is just for the electronic components with a single BS18B20 sensor and does not include the perfboard, SPST momentary N.O. switch or connectors.

View attachment temperature_monitor_bom.csv

Source Code
https://github.com/barrongreig/TemperatureMonitor

Enhancements

A couple of useful enhancements to this project could be:
  • Use microcontroller pin RA1 for throttle pulldown, battery charger disconnect etc.
  • Use a slightly more expensive Pic with EEPROM, such as the PIC16F17114, along with software modification, and store a mapping between sensors and sequence numbers in the EEPROM.
 
First, thank you for posting this. I have been looking around for prebuilt systems that would do something like this and didn't find what I wanted; the closest things to it didn't exactly excite my pocketbook, and didn't have all of what I was after.

This one, even if it doesn't do it all yet, is expandable by dint of having the code available. :) (well, once I learn enough programming to be able to do that***)


A caution about the DS sensor is added below.

battman said:
The sequence number of a sensor is determined by the unique 64-bit serial code stored in its ROM and is not configurable in this project implementation, although see the Enhancements section below for how the sequence could be made configurable.

Design Decisions
The digital temperature sensor DS18B20 was chosen for the following reasons:
  • Noise immunity (compared to analog line).
  • Only one data line is required regardless of the number of attached sensors. This reduces both the amount of wire required within a multi-sensor application and requires just one available input port in the connected microcontroller.
  • No temperature calibration required.
  • 'B' variant of the DS1820 chosen for 93.75ms 9-bit temperature conversion time. The 12-bit resolution of DS18(S)20 requires a conversion time of 750ms and was considered overkill.

Digital sensors certainly cost a lot more than analog sensors, but the benefits listed above were considered to far outweigh the extra cost. Shop around for the DS18B20 - its cost varies widely online. If 2oC accuracy is sufficient and it can be found at a good price, the DS1822+T&R should work as a drop-in alternative.

I can't find the post(s) about it right now, but there have been projects with problems using these sensors due to counterfeits not having proper addressing (like entire batches having the *same* address number, making them impossible to use on the same 1-wire comm bus).

I poked around with a google search, and while I still didn't find the specific stuff I'd read before, I did find this useful site about DS18B20 sensors, and problems you may encounter if you don't get them from an "authorized" distributor or Maxim directly, and code to test functionality of whatever sensors you do get:
https://github.com/cpetrich/counterfeit_DS18B20
just in case anyone is building this project and finds their sensors don't work as they expect.
antoher page
https://www.tinytransistors.net/2021/01/16/real-vs-fake-ds18b20/


***what I want to end up with is a temperature *controller*, that works essentially like the Pymeter wall-outlet controller:
https://www.amazon.com/gp/product/B083Q7YRBM
but with at least three sensors per relay (configurable per relay), such that any of them reading out of user-set limits shuts the relay off (and any non-responsive sensor also shuts it off). And a configurable number of relays, to have one master unit control however many devices is required for a test setup.

I've hacked a Pymeter (which normally uses one sensor per outlet) by separating the relay output contacts such that one controls Line and the other Neutral, so two sensors control one outlet (same could be done by seriesing the relays to control just line), which allows monitoring two places inside the monitored device to cut power upon exceeding either of two temperature setpoints (and reapply power upon dropping below a second pair of setpoints). However, it uses analog sensors so it requires separate wire pairs for every sensor, wire length is limited (noise, etc), and can only control one device per pair of sensors for $30-ish each.

But something like your project would be much easier to build on.
 
Back
Top