Temperature Interface

From BitWizard Wiki
(Redirected from I2c temp)
Jump to navigation Jump to search
Temperature Interface
Temperature Interface

This is the documentation page for the Temperature Interface. That you can buy in the BitWizard shop.

Overview

This board enables you to measure up to 4 analog signals, specifically configured for measuring temperature with an MCP9700 sensor (or LM35 if you only require above-freezing temperatures).

Assembly instructions

None: the board comes fully assembled. The orientation of your sensor is indicated on the board, if you use the recommended MCP9700. We suggest you first test with the MCP9700 directly inserted into the socket in the board, before you make an extension cord to put it where you want to measure the temperature.

Officially electronics should easily be able to handle temperatures of about 80 °C, so it should be possible to put the whole module where you want to measure. I'd try try to avoid that situation.

Possible Configurations

with MCP9700 or LM35. If you know of other sensors that provide a similar signal, let us know.

External resources

Datasheets

Additional software

Related projects

This is a simplified version of the "DIO", but with a more convenient pinout for its purpose. We've taken out the features that cannot be used anyway on this board, like stepper motor control.

Pinout

Each of the four temperature connectors has:

  • 1 VCC
  • 2 signal
  • 3 GND

See Analog inputs for the configuration of the ADC channel you need for each of the connectors.


LEDs

There is one power-led.

Jumper settings

There is one solder jumper that would allow you to configure the second SPI port as a programming connector for software development.

Protocol

For the intro to the SPI and I2C protocols read: SPI versus I2C protocols

The board specific protocol can be found here: DIO_protocol The STEPPER, BUTTONS and PWM functions are not implemented on "temp".

See Analog inputs for the configuration of the ADC channel you need for each of the connectors.

You should also read the General_SPI_protocol notes.
For arduino, a sample PDE is available, called ardemo_lcd.pde, also at the BitWizard software download directory .

This is a demo to send things using SPI to the lcd board. The SPI routines there are applicable for the DIO and TEMP boards as well.

Accuracy

The sensors claim a +/- 1 or +/- 2 degree accuracy. But the system adds a few more uncertainties. For example, the "internal 1.1V reference" is officially +/- 10%. In practise we've measured it way closer to 1.1 than the range would suggest, but it is a possible source of errors. Similarly, the analog amplifier has an offset voltage that contributes to the overall error.

In practise we often see an error on the order of 5 degrees C too high compared to the ideal temperature reading. We suggest you calibrate at least the offset by doing a reference measurement with a thermometer that you trust. Best would be to electrically insulate the sensor and put it in melting water (0C), and then in boiling water (100C). That way you can calibrate both the offset and gain.

Examples

The folowing script

#!/bin/sh
# Sample script to read and calculate a temperature. 
#
# for I2C:
TEMPBRD="bw_tool -I -D /dev/i2c-1 -a 8c"
# for SPI: 
#TEMPBRD="bw_tool -a 8c"
#
if [ x"$1" = x"--init" ] ; then 
  # First initialize the temperature sensor. 
  # Channel 0 is first sensor, ... channel 3 is last sensor, sample four channels, 
  # add 64 (0x40) samples, and then... don't shift
  $TEMPBRD -W 70:81:b 71:80:b 72:82:b 73:83:b 80:4:b 81:40:b 82:0:b
  # wait for the settings to apply and enough sampes to be taken. 
  sleep 1
fi
adcconversion=`$TEMPBRD -1 -R 68:s`

# This value is scaled to 65535 is 1.1V. 
# So: 
# (1)    voltage = adcconversion * 1.1 / 65535
# For the MCP9700 temperature sensor: 
# (2)    voltage = 0.5V + temp * 0.010V/C
# Some reworking results in: 
# (3)    temp = (voltage - 0.5)/0.01
# Now we can substitute the voltage from (1) and get: 
# (4)    temp = 100 * (adcconversion * 1.1 / 65535 - 0.5)
# and reworking this we get: 
# (5)    temp = .001678 * adcconversion - 50
temp=`echo $adcconversion \* .001678 - 50 | bc -l`

echo "temperature is: $temp"


will initialize all four channels if you pass it --init and then read out just the first. On the adcconversion= ... line you need to change to 69 for the second sensor, 6a for the third and 6b for the last.

Future software enhancements

Changelog

1.0

  • Initial public release