The awesome embedded adventures logo goes here!


Digital Thermometer using the MOD-1001, DSP-7S04, and Arduino
Connections to the Arduino board

In this example, breakaway male pin headers have been soldered to both the DSP-7S04, 
and the MOD-1001. Make the connections as follows:


SDA - Arduino Pin A4
SCL - Arduino Pin A5
VCC - Arduino 5V 
GND - Arduino GND
INT - Not Connected


VCC -Arduino 5V
LAT - Arduino Pin 12
BLK - Arduino Pin 6
SIN - Arduino Pin 11
CLK - Arduino Pin 10
GND - Arduino GND
On some Arduino boards, the I2C pins may be in different locations. Please refer to your board's documentation to make sure you use the correct ones. The display driving pins are somewhat flexible and can be changed to suit your project needs, as we're using a software ShiftOut function rather than the hardware SPI pins. The BLK connection on the display should only be connected to a PWM-capable pin as we're going to use it to control the display brightness in software, thereby reducing current consumption.

As we're going to make use of the Arduino IDE's serial monitor for this project, the USB connection will be used for both power and data transfer.

Driving the DSP-7S04

This display uses the exact same driver IC as the DSP-0401B, and can be controlled in the same manner. The only difference is the amount of data to send. Each digit is made up of a single byte rather than a 16-bit word, with each driver IC controlling two of the digits.

We'll be using the same method as in the DSP-0401B tutorial - a byte array - to provide a relationship between numbers generated by the program, and those shown on the display.

Here's how it looks for numbers 0-9:
const byte digitData[10] = {
  0x3F, 0x6, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x7, 0x7F, 0x6F};
Our program also requires some custom characters - a degrees symbol, negative sign, and 
the letters C and F.

Here's how to work out hex values to display custom characters, using the degrees symbol 
as an example:

DP G F E D C B A < -- Display Segments
0   1 1 0 0 0 1 1 < -- Bit values

HEX value = 0x63 (Much easier to type into our program!)

Communication with the MOD-1001 (TMP275 Sensor)

We'll need to include the Wire.h library in the program to use the Arduino's I2C capability. The Arduino should initialize the bus as a master, and the TMP275 is at address 0x48. Only a few register writes are necessary to set up the sensor. First, we write to it's pointer register to tell it which particular function we want to use, then the data byte for that function's register.

In this example, we will first set the sensor resolution to 12-bit, then select the temperature register (which remains selected to be read for the duration of the program). Refer to the example code to see in detail how this is accomplished, and check out the datasheet if you're interested in learning about the sensor's more advanced abilities. 

Using the example program

This program uses the serial monitor for control, and can be switched between Celsius and Farenheit modes by sending the characters C or F. As well as a readout of the temperature to one decimal place, the program also sends back the integer value to be written to the 7-segment display. During development I found this very useful for debugging, as for the display routine to work properly, this number must always be positive. Otherwise, you get garbage (or nothing) displayed for negative temperatures.

The float value for temperature is multiplied by 10 and copied to an int, to remove the decimal point without losing any digits, then if negative, the abs() function is used to remove the sign. We are left with a number which can now be easily split up into discrete digits for writing to the display, using division and modulo operations as described in the DSP-0401B tutorial.