Digital Thermometer


Sometimes you come across modules which communicate with other devices in a perfect manner. One of those is the Temperature-Time-Module (Conrad, part number 109426 respectively 195588. Meanwhile, they replaced it by this one: TMB-880EXF, part number 108555, which looks much the same but unfortunately lost that functionality *  ).

Targets

Nothing special: the readings of the module are to be read with minumum hardware and software.

How it was done

Until now, you still get a copy of the manual. Here is what you need to know:

VDD
VSS
  D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13   Pin 9 (Data)
VDD
VSS
    Pin 10 (Clock)

time to transfer all these pulses: 18 ms.

 
        
Pin 9
D1 digit-1 when
set to Fahrenheit,
sign when set to
Celsius
(Minus = high,
Plus = low)
D2 D3 D4 D5
8 4 2 1
digit-2
D6 D7 D8 D9
8 4 2 1
digit-3
fixed decimal point, no data sent
D10 D11 D12 D13
8 4 2 1
digit-4

The manual also includes a circiut of an interface consisting of two transistors and two resistors to connect the module with the legendary C-64 home computer. Also you find a machine language program for it.

Details of the implementation

To minimize the hardware we drop the interface. The module runs with only 1.5 volts, and so the signals you find on pin-9 and pin-10 are too low to be detected by Arduino's digital inputs. So you just have to feed this signals to the analog inputs and decide what is the limit for LOW and HIGH.

As the conversion time for the two analog signals is quite large there is no time for printing debug texts to the serial terminal.

The complete program:

/*
Conrad-Temperature-Time-Module 195588 connected to an Arduino
Hardware: 
in order to get power the supply from Arduino
you need a red LED and a 10 kOhm resistor
Modul                                 Arduino
 1 = Gnd <------------------------------> Gnd
                LED-cathode ------------> Gnd
                LED-anode --------------> N.C. (unusedPin)
16 = +1,5 Volt <---+--------------------> N.C.
                   +---10 kOhm ---------> +5Vcc
 9 = data <-----------------------------> A0
10 = clock <----------------------------> A1
*/

const byte data = A0;
const byte clock = A1;

void setup() {
  Serial.begin(9600);
  // don't start in the middle of the data, just wait for a gap
  boolean pause = true;
  while (!pause) {
    for (long i = 0; i < 100000; i++) {
      if (analogRead(clock)) pause = false; 
    }
  }
  Serial.println("found a gap");
}

void loop() {
  int sign = 1 - 2 * readBit();
  Serial.println(sign * (10.0 * digit() + digit() + digit()*0.1),1);  
}

byte digit() {
  byte x = 0;
  for (int i = 1; i <= 4; i++) x = x * 2 + readBit();
  return x;
}

boolean readBit() {
  while (!analogRead(clock));       // wait for a positive edge
  boolean b = analogRead(data) > 0; // now read the analog data
  while (analogRead(clock));        // wait for a negative edge
  return b;
}




For the oldies the C-64 program:

                  * = 033C
033C   78         SEI
033D   A0 01      LDY #$01
033F   A9 00      LDA #$00
0341   8D B2 03   STA $03B2
0344   AD 01 DD   LDA $DD01
0347   49 FF      EOR #$FF
0349   F0 05      BEQ $0350
034B   A9 FF      LDA #$FF
034D   8D B2 03   STA $03B2
0350   C8         INY
0351   D0 F1      BNE $0344
0353   AD B2 03   LDA $03B2
0356   D0 E5      BNE $033D
0358   A2 00      LDX #$00
035A   20 70 03   JSR $0370
035D   AD 01 DD   LDA $DD01
0360   49 FF      EOR #$FF
0362   29 01      AND #$01
0364   9D B3 03   STA $03B3,X
0367   E8         INX
0368   E0 0D      CPX #$0D
036A   D0 EE      BNE $035A
036C   58         CLI
036D   4C 83 03   JMP $0383
0370   AD 01 DD   LDA $DD01
0373   49 FF      EOR #$FF
0375   29 02      AND #$02
0377   F0 F7      BEQ $0370
0379   AD 01 DD   LDA $DD01
037C   49 FF      EOR #$FF
037E   29 02      AND #$02
0380   D0 F7      BNE $0379
0382   60         RTS
0383   AD B3 03   LDA $03B3
0386   F0 05      BEQ $038D
0388   A9 2D      LDA #$2D
038A   4C 8F 03   JMP $038F
038D   A9 2B      LDA #$2B
038F   8D B3 03   STA $03B3
0392   A2 00      LDX #$00
0394   A0 00      LDY #$00
0396   BD B4 03   LDA $03B4,X
0399   0A         ASL A
039A   7D B5 03   ADC $03B5,X
039D   0A         ASL A
039E   7D B6 03   ADC $03B6,X
03A1   0A         ASL A
03A2   7D B7 03   ADC $03B7,X
03A5   99 B4 03   STA $03B4,Y
03A8   8A         TXA
03A9   69 04      ADC #$04
03AB   AA         TAX
03AC   C8         INY
03AD   C0 03      CPY #$03
03AF   D0 E5      BNE $0396
03B1   60         RTS
03B2              .END




*) When you check the technical data of module TMB-880EXF you will find Pin-12: Frequency output: Output for monitoring frequency of measuring interval. They also offer a user interface, part number 191027, and the related manual says. 12. Frequenzausgang:
Liefert ein zur Temperatur proportionales Rechtecksignal
(zur externen Weiterverarbeitung, z. B. in einem angeschlossenen
Rechner).
(sorry, no English version available for this item)
So, the sad news is: there is no square wave signal at pin-12, and if you havn't got one of the old ones there is no way ☹.



contact: nji(at)gmx.de