Introduction: Using Analog Temperature Sensor From 37 Sensors Kit

So you went out and bought a kit of electrical sensors and modules for a good price called "37 Sensors" (like this one here or others on Amazon), but can't find information on the modules to be able to use them? This series of Instructables will help you out with all of the modules in the 37 Sensors Kit. There are other kits that sell a different number of modules than 37, such as a 20 module kit, and a 45 module kit. These sensors/modules are also available from some online stores individually.

These kits are excellent for STEM (Science, Technology, Engineering, and Mathematics) experimentation and education.

The module from the 37 Sensors Kit called "Analog Temperature Sensor" might be used in an embedded project to measure the temperature.

(Images and information used with permission from 37sensors.com)

Step 1: Analog Temperature Sensor Description

The Analog Temperature Sensor uses a two pin thermistor that outputs an analog signal based on the temperature. The thermistor is wired ad a voltage divider in series with a 10k resistor. The fixed resistor connects to +Voltage, the thermistor connects to ground.

The module needs a ground and power connection to whatever microcontroller you might be interfacing. Voltage can be 5V or 3.3V as with the typical microcontroller.

At room temperature, the thermistor's resistance is 10k ohms. The analog output of the module is half of the +Voltage. Since the thermistor has a negative temperature coefficient, as the temperature increases, the thermistor resistance decreases. The module output voltage (center of the resistor divider) goes down.

Step 2: Analog Temperature Sensor Specification

Voltage: 3.3V to 5.0V

LED: Power (some modules)

Size: 20mm X 15mm

Room Temperature resistance: 10kohm

Temperature range: -55°C – +125°C (+/- 0.5°C) -67°F – +257°F

There are a number of different sources for these modules. Not every module that looks similar to the ones here behaves exactly the same. Check the specific module that you have for differences in function, voltage levels, pinout, and inactive/active states. Some modules have been found to have incorrectly labeled pins and even poorly soldered components.

NTS temperature device. Connected in series with a 10kohm to use as a voltage divider circuit. This device is NOT linear. When the temperature increases, the resistance decreases.

Step 3: Analog Temperature Sensor Experiment Supplies

Just to see the basics of how this module works, this experiment shows how to interface it to a simple-to-understand microcontroller board. This microcontroller board is a $12.99 kit that can be assembled easily. There is no need for a complicated development system as the 32-bit micro that is part of this board has all of the smarts built in. The board shape even allows it to be used with Arduino Shields.

Code for other microcontroller platforms would likely be in a different language/syntax, but similar in form.

Here is the small list of components for this experiment:

Analog Temperature Sensor module from 37 Sensors Kit. (This experiment's source: CircuitGizmos) Kits also available at Amazon and online in many places.

Jumper Wires, female to female "DuPont" style. (This experiment's source: CircuitGizmos) Jumpers of this type are also available online.

Microcontroller Board. (This experiment's source: CircuitGizmos for the $12.99 kit. An assembled board of a more capable but similar device is also available.)

Power supply. The board accepts 7-10VDC through barrel jack or 5V/3.3V through the connector.

USB serial Interface. A USB connection to a PC and 3.3V level connection for ground, transmit, and receive for the board.

A PC with a serial terminal application is used to communicate with the board. One such free and useful program is Beagle Term.

With all of this, you can perform an experiment to test the Analog Temperature Sensor module.

Step 4: Analog Temperature Sensor Experiment Hookup

The assembled microcontroller board is attached to the Analog Temperature Sensor module as follows:

Ground connection on the module = ground on the microcontroller board

+Voltage connection on the module = 3.3V on the microcontroller board

Analog connection on the module = uM4 (microcontroller pin 4) on the microcontroller board

Connect the USB serial interface to the PC (USB end) and to the serial signal connection of the microcontroller board (near the green power LED). The ground connections between the serial interface and the board connect together, and the transmit signal of one goes to the receive signal of the other.

Power up the microcontroller board. I used a 12VDC supply that worked just fine.

Start Beagle Term on the PC and connect to the serial port number that is appropriate for the USB serial interface. Bitrate needs to be 38400, 8N1 with no flow control. Tap the enter key and you should get a ">" prompt.

Step 5: Analog Temperature Sensor Code

With the PC connected to a powered microcontroller board, Beagle Term is the window into what is happening on that board. You can enter program code, see the printed results of that code, and even interact by typing information into a running program.

Typing EDIT at the ">" prompt will connect you to the built-in editor. It is in this editor that you will enter the program code. You can save the code that you type in with a Control-Q keystroke. You can save and immediately run the code that is in the editor with Control-W.

Control keys for the program EDIT function. (Function keys don't work right in Beagle Term)

  • Control-U - Move to line home
  • Control-U Control-U - Move to start of the program
  • Control-K - Move to the line end
  • Control-K Control-K - Move to end of the program
  • Control-P - Page up
  • Control-L - Page down
  • Control-] - Delete
  • Control-N - Insert
  • Control-Q - Save the code
  • Control-W - Run the code
  • Control-R - Find
  • Control-G - Repeat find
  • Control-T - Mark text
  • Control-Y - Paste text
  • ESC - Exit from editor abandoning changes.

Enter this experiment's code in the editor:

SETPIN 4, AIN
DIM X as FLOAT
DIM R as FLOAT
DIM LOGR as FLOAT
DIM T AS FLOAT
DIM Tc AS FLOAT
DIM Tf AS FLOAT
DO
  PAUSE 200
  X = PIN(4)
  R = 10000.0 / ((3.3 / X) - 1)
  LOGR = log(R)
  T = 1.0 / (0.001129148 + (0.000234125 + (0.0000000876741 * LOGR * LOGR ))* LOGR )
  Tc = T - 273.15
  Tf = (Tc * 9.0)/ 5.0 + 32.0
  PRINT T, Tc, Tf
LOOP

This code sets the signal lines to an analog input for the temperature sensor output.

The loop code then reads the input and prints the analog output to the console every 1/5th of a second.

An equation called the Steinhart-Hart equation is used to convert the analog value (a representation of the thermistor's resistance) to degrees Kelvin. Additional equations then convert K to C and F.

If you run this code you will see the output sent to Beagle Term. Those outputs will change as the temperature changes.

Step 6: Analog Temperature Sensor Results

The output is updated with the temperature every 200ms.

Each output line had the temperature in Kelvin, then in Celcius, and finally in Fahrenheit.

Step 7: Analog Temperature Sensor Feedback

Most of the Analog Temperature Sensors found in 37 Sensors Kits are very similar to the one described here.

If you have any additional information on the specifications or behavior of this type of module, please comment here and I'll include the relevant information. If you know of a module that is similar, but perhaps available singly or in a different kit of modules, please mention that.

The comments area would also be a good place to include small sample code for other microcontroller platforms if you have experimented with this module.

Thanks for reading and contributing to this collection of 37 Sensor Instructables!

Analog Hall-Effect

Analog Joystick

Analog Temperature Sensor

Ball Switch

Bi-color LED

Button

Character LCD

Flame

Hall-effect Switch

Humidity and Temperature

IR Receiver

IR Transmitter

Keypad

LASER

Light Cup

Liquid

Mercury Switch

Microphone

Multicolor Flashing LED

Obstacle Avoidance

Photo Interrupter

Photoresistor

Piezo Driver or Annunciator

Pulse

Reed Switch

RGB LED

Rotary Encoder

Servo

Shock and Impulse

Single Relay

Speaker

Temperature 18B20

Temperature Threshold

Touch Sensor

Tracking

Ultrasonic Distance