EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Reading temperature with external thermistor

Started by jaypal01 April 7, 2013
you need to be VERY careful about the way you describe or name things,
the Timer is designated as TA0, it has channels designated as TAo.0 and
TA0.1. Each of those channels can handle a timing signal. Without
looking at the specs for the DTH11, which I'm not familiar with, that
measn that if they use a single pin timer interface you could do 2
devices. The micro has options for different pins for the timer channels
OR one pin may be used as an input and the other as an output, so, again
be careful. Look at the paragraph on Timer A2 in the tech data sheet and
you will see that TA0.0 can be an input or an output on P1.1, but only
an output on P1.5, TA0.1 can be either on P1.2 but only output on P1.6
or P2.6.

regarding I2C. provided that your I2C is fast enough, and that each
device can be given a unique address you can normally string several
sensors on an I2C bus. The 2231 only has a USI not a USCI, but this will
still simplify implementation of the I2C bus. A TMP102 has 4 possible
addresses.

If you used the USI, rather than bit banging you would use P1.6 as SCL
and P1.7 as SDA. The 2553 has a full USCI meaning that it has two
hardware comm intertfaces, USCIA0 and USCIB0, A0 can be configured as
UART (data download) or SPI NOT I2C, as I wrongly stated before. To use
it in multiple roles is not really a good thing if you are not 100%
comfortable with what you are doing. The B0 part can be configured as an
SPI or I2C, so if you used the 2553, which comes on later Launchpads (at
least mine recent ones all have a 2553) I would use the A0 part for data
download and the B0 part for the I2C interface to your temperature
sensors. I can't say about the DHT11, since it isn't listed on Mouser,
Element14 or Digikey (my quick reference sources). OK google to the
rescue. Not a part I'd use, although I haven't checked the price. the
temperature range is simply too low, and not accurate enough, but I
would say adequate for your stated use. So yes you can interface to 2
DHT11's with a 2231, and up to 6 with the 2553 (buy a 2553 launchpad for
$4.50!!)

Also, I know a lot of people use the FTDI parts for USB interface, and
they are great parts, but I like the CP2102, and have never had a
problem, it works really solidly and reliably, even when running the
UART at 460800baud from the internal 16MHz DCO calibrated value aided
with a little FLL.

Mouser have the EVK at $40, which is well worth while, since it would
allow you to download your logged data to the PC very easily.

Again for logging, so that you can analyse the data I would go for the
2553, it has 16K of code space. I don't know if you plan to write in C
or aSM, or Pilot /Prolog for that matter!!! but you could get your
entire code to read up to 4 TMP102's and up to 4 DHT11's plus store it
in local flash memory, and download to PC in around 1K of code space. Be
extravagant and add CSV formatting in ASCII and that would maybe push to
2K or 3K depending on how you handled the conversion, leaving up to 14K
for data storage. 14K is a lot of storgae space for temp logging.

Typically temperature is logged slowly in most cases, however for
dynamic profiling you might want to log it faster than normal, but even
1 sample a second for 4 temperature sensor, at best resolution, gets you
well over 20 minutes log time, for temperature with say another 2K
memory reserved for humidity data. If you can figure out how to be
sneaky enough you can get almost double that storage if you need to.

Final bit of info for you. In the data sheet of the 2553, on page 3,
which shows the pin assignments for the 20 pin version that comes with
the launchpad you will see that pin 3 is UCA0RXD for your UART. pin 4 is
UCA)TXD, for your UART. Pin 14 is UCB0SCL for your I2C, and pin 15 is
UCB0SDA for the I2C. You then have loads of choices for your timer pins
and the DHT11.

Hope that all helps.

Al

Beginning Microcontrollers with the MSP430

Thanks Al!!
As I was in half reading this, I went off to TI and ordered another
Launchpad, as you recommended!
Thank you for the explanation, and yes, I have some difficulty naming
things... But now I think I've understood it for now!
I also ordered one TMP102 sample. I'll buy the others I'll need later.
I'm thinking on C, which I'm more comfortable to code in.
I think I won't need to sample every second, perhaps some 5 to 10 seconds
is plenty enough and it will have enough room in the 2553 to the data.
Now, I'll just have to wait for the parts to arrive.
Mean while, I'll be studying the data sheets and code samples.

Once again, very thank you for your patience and for sharing your knowledge
and experience!

My best regards,
Rui,

For sure starting with an external digital device is the way to go. But as
you are going to have a Launch Pad, if you have time to spare learning, you
can go back to thermistor. Look for slope ADC with comparator. It is a
pretty nice way to measure a thermistor comparing it to an precision
resistor. I got a product that I sell that needed a thermal coupling on a
different surface and using an IC was very hard to do that. Using an
external wired thermistor was the best way to go... We do not perform the
calculation of the temperature inside our device, just the resistance and
than our software at the computer do the hard job. But is not that hard to
make inside of the MSP430.

Regards,
Hi Luis!

Well, time is something that I have in spare since I have no deadline to
this personal project.
By the way, is your product something alike the one I need? Or your needed
to measure temperature in the product you were selling?
Since I wanted to learn in the mean while of my project, I'd love to
develop this and suit it for my specific needs, but sometimes it's cheaper
to buy something that does exactly the same than reinventing the wheel!
Even so, I'll search the Slope ADC with comparator and in the end I'll
consider the most practical solution.
After seeing the TMP102 package dimensions, and since I'll have an heat
sink, I've thought in putting the chip somehow between two thins without
touching them. It's precisely the air temperature (with and without flow)
that I want to measure, considering various thermodynamic properties of
heat (some how, in the middle of the experiment I'd trap the hot air in
some small enclosure for a short period so I'd have some data on one
extreme without airflow).
With the thermistor package it is quite easy to put it anywhere, but the
digital one is quite tempting!
Even so, I have to consider every possible way to make this.

Just one probably stupid question... doesn't the msp430 have already an ADC
for this?
Something like this (
http://www.circuitvalley.com/2012/02/msp430g2231-volt-meter-adc.html),
perhaps?

Once again, thank you all!
Hello Rui,

No for sure it is not something like you need. To measure temperature is
not its mais objective.

Anyway, there are a few advantages and disadvantages on using slope ADC
with comparators compared to low resolution SAR ADC. Starting with the
disadvantage... it is slow. You are not going to be able to read you NTC
value at ksps. The second disadvantage is that is requires more pins (3 in
total) and the third is that it requires a timer.

On the other hand it is less sensible to voltage variation and noise. At
the standard ADC with voltage divider your error sources are the NTC
itself, the other resistor you are using, the ADC converter, the internal
reference and your voltage rail. With slope ADC your only error sources are
the NTC and the resistor you are using as a reference. As in the end you
are going to divide one value with the other, the absulute value of your
voltage and internal reference are irrelevant. Also as your real
measurement happens when you are discharging the capacitor, so you
probably will have much less noise in your measurement.

Best regards,

The 2024 Embedded Online Conference