Reply by Luis Filipe Rossi April 13, 20132013-04-13
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,

Beginning Microcontrollers with the MSP430

Reply by Rui Maldonado April 11, 20132013-04-11
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!
Reply by Luis Filipe Rossi April 11, 20132013-04-11
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,
Reply by Rui Maldonado April 9, 20132013-04-09
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,
Reply by Onestone April 9, 20132013-04-09
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
Reply by Rui Maldonado April 9, 20132013-04-09
Hi everybody!!!
I have been looking to the data sheets of DHT11 and msp430.
I've found this: https://github.com/bafeigum/DHT11-Library-for-MSP430
He says it is compatible with any G2xxx series micro-controller as long as
it has TA0.
If I'm not mistaken, the msp430g2231 (which was bundled with my Launchpad)
has TA0 in P1.1 and P1.2 - this would allow to capture two DHT11, right?
But the same P1.2 is in P1.6 - this is just to be flexible, I wouldn't be
able to connect a third sensor here, right?
Also saw that the DHT11 would only go from 0C to 50C (which is fine to
measure the air temperature and humidity at the end of the fan) but i think
I'd need the TMP102 in the heatsink, since I count to make the heat piece
reach 100C max, do you agree?
For the TMP102 I'd use P1.7 in I2C mode, and if I'm not mistaken, i could
simply connect more than on in series, right? Both MSP430G2231 and
MSP430G2553 only have one SDA, as far as I can see.
I found an excellent example in
http://e2e.ti.com/support/microcontrollers/msp430/f/166/t/167713.aspx but
they only mention one sensor. (At least, P1.1 and P1.2 are free!)
My best regards,
Reply by Rui Maldonado April 8, 20132013-04-08
Dan, Al, thank you!!!
I'll start digging on what you taught me right away!
The project will some how, be permanent. I'll post the code and the
schematics while doing it (although it will take some time).
I already have an MSP Launchpad but I'll have to get at least one
MSP430G255.
But first I'll dig the data cheats of MSP430G255, TMP102, DHT11 and I'll
let the CP2102 for later.
The idea is exactly to study the system dynamics and specially if it is
worth or of any use.
Dan, I've been reading the site and the source files you've sent, but I
think I'll need start forwith the data sheets and trying to figure out the
samples. :-)
Once again, thank you both for your great help and pointing me in the
correct way!
I'll keep in touch for the next questions that will definitely come up!

Com os melhores cumprimentos,
*
Rui Maldonado
Reply by Dan Bloomquist April 8, 20132013-04-08
Rui Maldonado wrote:
> I guess I'm complicating this too much.
> Let's divide the "project" for now and simplify:
> I need to measure and log temperature inside a tank of water, in front of a
> fan (I thought about humidity too using an DHT11 sensor?) and temperature
> in the heat-sink (3 measurements).
> - Is the MSP430 the right microcontroller for this?
> - Is the thermistor the right way to have this values?
> - How would you log the values?

This is a one time project? Absolutely, your time will be of most value,
cheeping out on parts is not worth it unless you are really looking for
the challenge. In that case, Al's first suggestion, I2C would be the way
to go. It is practically plug and play. Humidity? Quick look, I could
not find an I2C as cheap as the DHT11. Is it worth the ten bucks of
savings to write code for it if you are just building one of these?

Here is a simple I2C master I use:


Best, Dan.
Reply by Onestone April 8, 20132013-04-08
This is a comparatively simple task. No need to overcomplicate it at
all. I would NOT use a thermistor for a start, I would find an analog
or digital sensor, depending on which you are most familiar with, and
work with that. Whichever you choose there is plenty of sample code
available from Ti. If you need low power then the MSP430 is the right
microcontroller. Most small microcontrollers would do the task easily.

If you only need to log the values then you need to determine the log
interval and log period to determine the best way to store your logged
data. If you only need to turn a fan on or off, or some other function
then you don't need to be concerned with storage. If you want to gather
data in a log to determine the dynamics of the system before developing
your control algorithm for the fan/heater etc then you could probably
get enough data stored in the spare flash in the micro. If you do need
to log data then you alos need to figure oput how you're going to
extract that data, in what form, and how you're going to visualise or
analyse it.

Two very simple temperature sensors are the TMP102 from Ti and the
TMP05/06, also from Ti. there are literally hundreds of others. these
are digital sensors, meaning that you don't need an A/D to read them.
the TMP102 uses an I2C interface, and there is an app note from Ti for
the TMP100, which is almost identical. Sorry no app note number but it's
easy to find. The TMP05 is a little odd in that it uses a duty cycle
type scheme to measure temperature. If you understand how to use the
timer capture function on the MSP430 then this is very easy, in fact the
easiest, but will require some simple maths to convert to temperature.
Other wise I2C is very easy too.

Read the data sheets to understand the parts and get an idea of a
typical circuit. Buy a Launchpad board if you can with the MSP430G2553
on it. That does everything you need, is cheap, and can easily be
interfaced to most sensors. It has an A/D if you go that way, it also
has a comm peripheral that can handle UART, I2C or SPI in the A channel
and SPI or I2C in the B channel. this is very easy to use, and combined
with, say a CP2102 UART to USB convetrer gets you comms to the PC to
download your data. Again the data sheet gives a circuit example, or you
can cheaply buy an evk board for the CP2102 and similar parts and hook
it to your Launchpad (the same goes for most temp sensors by the way.
Sparkfun is a good, though not particularly cheap source of pre-made EVK
boards.

Cheers

Al
Reply by Rui Maldonado April 8, 20132013-04-08
Oh, I see...
And I think you're right - having the right temperature might be also
useful and it's better have it from the start than having to adapt the
project at the end.
Is just that the information I've found for the ADC spoke on using a
voltage divider.
I guessed it would be the proper way to do it but it makes total sense what
you said.
I guess I'm complicating this too much.
Let's divide the "project" for now and simplify:
I need to measure and log temperature inside a tank of water, in front of a
fan (I thought about humidity too using an DHT11 sensor?) and temperature
in the heat-sink (3 measurements).
- Is the MSP430 the right microcontroller for this?
- Is the thermistor the right way to have this values?
- How would you log the values?

Could you please point me out some example (circuit and code) of something
similar?
Sorry to bother with what might be some silly questions, but I'm quite lost
in here... I'm so confused that I can only think in using some mercury
thermometers!!!