0
\$\begingroup\$

I have a TMP04 temperature sensor (3 pin package). It outputs a square wave at approximately 35Hz and the duty cycle can be converted into a temperature reading (see datasheet).

It has an operating voltage of 4.5V-7V and I have it hooked up to the 5V supply of an Arduino Uno. Using a multimeter between the power pins confirms that the voltage is ~4.96V, which should be suitable.

I was using the pulseIn() function to read the time the pin was high, but the function would fail and always time out.

To check the output from the sensor I connected it to the Arduinos analog (ADC) input and took readings from the pin every millisecond.

There was a clear HIGH/LOW pattern, BUT there was an issue. The LOW signal was reading approximately ~15 (fine), but the HIGH signal was reading ~145. This is a very low voltage, as the ADC produces a number between 0-1024.

Hence, a reading of ~145 corresponds to a HIGH voltage of ~0.7V, which is of course not expected and wrong. The datasheet suggests that the HIGH voltage should never fall below \$V_{DD}-0.4\$.

I thought that it may have been a dud sensor, but after trying another one I get the same results.

I'm just prototyping on a breadboard, and have no decoupling capacitors as I was just testing them out.

My circuit is literally:

  • Sensor V+ to Arduino 5V

  • Sensor ground the Arduino ground

  • Sensor output in to Arduino (tried pin 5 and A1)

I have no other resistors or components in my circuit. Am I doing anything wrong? Have I misunderstood how I am supposed to use the sensor?

Here is a sample output from the ADC, with one reading every millisecond:

145
149
14
12
13
12
15
13
16
18
14
18
18
18
20
14
150
146
149
148
149
149
146
148
14
18
17
18
14
21
14
15
18
14
17
17
19
19
150
149
\$\endgroup\$
5
  • \$\begingroup\$ Are you sure you have a TMP04 and not a TMP03? TMP03 is an open collector part, explaining the behavior you're seeing. \$\endgroup\$
    – Matt Young
    Commented Aug 13, 2015 at 13:58
  • \$\begingroup\$ @MattYoung I would be surprised as I opened it from a Static Shield Bag that clearly has "TMP04FT9Z" on it (as does the chip in tiny writing -.-). \$\endgroup\$
    – Rohan
    Commented Aug 13, 2015 at 15:00
  • \$\begingroup\$ Adding a 10k pullup is a very quick test that won't damage anything and will immediately tell you which part you have. \$\endgroup\$
    – Matt Young
    Commented Aug 13, 2015 at 15:04
  • \$\begingroup\$ @MattYoung Added a 10k pull-up. No change for both sensors. \$\endgroup\$
    – Rohan
    Commented Aug 13, 2015 at 15:40
  • \$\begingroup\$ Ok, then the next step is to follow stefandz suggestion, and put one on breadboard by itself, and look at the output on a scope. \$\endgroup\$
    – Matt Young
    Commented Aug 13, 2015 at 15:46

2 Answers 2

2
\$\begingroup\$

The problem was a dumb error on my part. The datasheet indicates the pinout as a "bottom view", while I was interpreting it as a "top view". Hence, my DATA and GROUND pins were swapped.

The almost correct data I was observing, was somewhat misleading to the actual problem.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Oh my god, I had the pins swapped for months too. Thanks for pointing this out mate! \$\endgroup\$
    – Siidheesh
    Commented Dec 29, 2015 at 18:35
1
\$\begingroup\$

The reason for this is that you probably have the TMP03 and not the TMP04. The TMP03 has an open collector output. This means that it can only sink current, not source it. If you place a 10k resistor between the Arduino input pin / TMP03 output pin junction and 5V, all should be resolved.

\$\endgroup\$
2
  • \$\begingroup\$ I would be surprised as I opened it from a Static Shield Bag that clearly has "TMP04FT9Z" on it (as does the chip in tiny writing -.-). By I can give it a shot. \$\endgroup\$
    – Rohan
    Commented Aug 13, 2015 at 14:11
  • 2
    \$\begingroup\$ Well if that really is a TMP04 that starts to make this interesting. If you have an Oscilloscope handy it would be good to wire the TMP0X up separately and take a look at the output waveform there. The TMP04 can only sink/source 10mA, which should be orders of magnitude less than the Arduino input draws, but using a scope will help you get some confidence in what is actually going on. \$\endgroup\$
    – stefandz
    Commented Aug 13, 2015 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.