[DIS] Help needed: Temperature sensing & filtering with

Go To Last Post
25 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi, gentlemen:

I had wrote a little tutorial to teach how to read and filter non linear sensors, applied to NTC's,... in spanish. That's because I live in Spain, and spanish is the most popular of my mother tongues (I'm lucky, I have two).

But I begin to translate it to english as soon as I finished the spanish version, in order to post it here (of course). The problem is that english is not my mother tonge, so I'm not fluent and I need someone that could help me to edit and correct all mistakes (I promise to do many of them ;)).

So, any volunteer here? Is this a wrong forum for that?

BTW: I attach the spanish version. Afterall, many people in the world could read it.

Ah, and I have another problem, but this is NOT the right forum for that. This is my first WinAVR program (it also compiles smoothly and works flawlessly with IAR thought), and it don't compile with it. So I'm stuck at this point. If someone would help me, anything is welcome.

Have fun.

EDIT: Added the english (unedited) version. Now it runs with WinAVR, thanks to S-Sohn (see later posts).

Attachment(s): 

Guillem.
"Common sense is the least common of the senses" Anonymous.

Last Edited: Tue. Mar 25, 2008 - 03:05 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My spanish is much poorer than my Swahili (Jambo, Rafiki, Habari?, Nzuri!, Hakuna Matata... :D )
But I tried to compile your code with WinAVR 20071221 and found the following issues:

TempNTC.h:26: error: expected declaration specifiers or '...' before '(' token
You use the reserved keyword "ADC" as function parameter for int TempNTC(unsigned int ADC, int To, int dT);. Renaming "ADC" to "adc" should fix it.

warning: array subscript has type 'char'
Use unsigned char instead.

Have you looked at the WinAVR Tool "MFile"? It's a standard WinAVR makefile generator. Very comfortable and maintained by Jörg Wunsch - so it must be good!

Regards
sebastian

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks, Sebastian. I would do the changes you suggest.

I should take a look at MFile. If Jörg mantains it, then it would be good. ;)

About the language, I'm currently doing the main translation for it, I only need help to edit and correct the mistakes that I'm shure I would do.

Thanks again.

BTW: I found other 'mistakes' on the code: I used the ADC2 input instead of the ADC0 that is shown on the schematic. I will update this also. And 'export' the excel sheed to an older version, to do it more generic.

Guillem.
"Common sense is the least common of the senses" Anonymous.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

¿Can we have a .zip version as well as the .rar Por favor señor?

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

stu_san did a fantastic work when reviewing my random number tutorial. Maybe he has the time to review yours as well.

Regards
Sebastian

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Good morning:

@Sebastian: I had implemented your suggestions, and now it works fine with WinAVR also. Thank you very much.

@John: Por supuesto, señor. But I must advice you: I'm an evil, I wrote it in C, but it is not optimized in any way, it's straight forward, and small routines. With your knowledge of spanish (or italian), you are capable to follow the program, I'm shure of it. ;)

Anyway, when I begin to write all this, I do with portability in my mind, so it should be easy to port to other platforms, to assembler (for Mr. Samperi), with different compilers (it compiles with IAR 4.30A Kick start free version, limited to 4KBytes of code, that I have at home, IAR 5.1 that I use at home, and now, thanks to S-Sohn, with WinAVR). It also should be easily modified to support external ADC's.

This is a 'preview' of the introduction, already translated (but not corrected):

Quote:

Measurement and filtering of temperatures with an NTC.
Introduction to signal processing.

Introduction.

Measurement of temperature is one of the most recurrent problems that one can find when is starting in the measurement, sensors and instrumentation world. Probably is the most common sensor that don’t measure electrical parameters.

Perhaps that’s the reason why there are many models and methods to measure temperature. And that’s the reason why appeared a particular way (NTC) to do it that is pretty simple, so this is a good starting point to interact with the ‘real world’.

The main objective of this tutorial is to explain how to work with a measurement chain in a simple and efficient way, seen from a generic point of view, thus the most particular and specific parts of the implementation are seen as less relevant. This way, this explanation should serve to port it easily to a broad range of uC, from the simple ones to the worst specimen of ARM. Or it can be implemented with an external ADC. Anyway, for this case, it had been applied with an AVR, since this is the uC family that the writter knows better.

Have fun.

Attachment(s): 

Guillem.
"Common sense is the least common of the senses" Anonymous.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The Spanish bits are pretty clear. :lol:
The C bits.... :(

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, you can always open the TempNtc.lss file in the default directory. It contains the assembled program in your language ;). It looks like Swahili to me, even when I wrote some asm programs for AVRs years before :(

Guillem.
"Common sense is the least common of the senses" Anonymous.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As I promissed, I had added the english version.

Any suggestions are welcomed.

Guillem.
"Common sense is the least common of the senses" Anonymous.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Guillem ...

This is an excellent tutorial , will try it soon.

One thing though (it might be out of scope but ...) , i have read about using a bias resistor the NTC , if you want to get more accuracy in a certain area , ie. the 20..35 degrees area.

Is that correct or is the biasresistor just to get the output more linear , for an ADC without using lookup and/or linear approximation ??

/Bingo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AFAIK, the bias resistor is used to linearize the NTC within a certain range, thus avoid the use of LUT's. But I'm abusing from my memory, that read this issue within a text book a long time ago, so take it with a grain of salt.

At my job we use this technique a lot, not only for NTC's, but also Thermocouples, PTC's, Pt100/1000, and other nonlinear temperature sensors, with great success. And the good point is that this can also be used for other purposes, since I used this to do a temperature compensation for an ultrasonic level controler, where instead of ºC, the table gaves me directly cm/ms.

BTW, it's hard to me to express myself in english, that's why I needed few days to have this tranlation, so please, be easy on me about this ;), and if you have some other questions or hints, let me know.

Guillem.
"Common sense is the least common of the senses" Anonymous.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Guillem

See my attachment with the translation to English.
You need to proof read & correct any thing that might be out of place.

Cheers
Ken

ps Mind you I left the pictures out due to size of the file was over 1MB.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks, Ken.

I will check and compare with the english version I had translated, and correct anything out of place.

Guillem.
"Common sense is the least common of the senses" Anonymous.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thanks to recomend me to this tread...its very usefull

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You are welcome.

Guillem.
"Common sense is the least common of the senses" Anonymous.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the very simple and clear tutorial, Guillem.
I am using this for my application. I had a question. I was looking at the values you have in your spreadsheet and used Excel to come up with a regression curve equation for the datapoints. Here is the equation I got:

Temp in deg C = -((ADCValue - 713.79))/7.8

My apologies if this is a silly question: can I just insert that equation in my C code to display the degrees C value on the LCD? I know this equation would be specific to a particular Semitec NTC sensor. But maybe I can measure my own temperature sensor and ADC values or get this equation from the datasheet and then insert this equation in my code?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Buenas:

Si aun te hace falta te lo puedo traducir, sin problema. Di me exactamente que te falta y yo me encargaré de eso.

Saludo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sir i m using bascomavr compiler and atmega32 mcu
i just want to measure temp with ntc thermister
how i calculate the adc for when i use resister in parraller with 10k ntc 10k ntc from 5volt grounded with 10k resister the node is given to adc directly
plz solve my probelem as soon as possible

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Guillem,

I would like to thank you for a really clear explanation of a really useful technique that now seems simple to me but previous to reading your tutorial mystified me.
It is further more a fine solution to the problem I have been facing. I am new to electronics and micro controllers also math is not a strong point for me I have been trying to measure temperature using the Steinhart-Hart equation with little success and I now realise unnecessary. Your solution is elegant simple and well explained. Thank you again. :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi, you are welcome!!

Guillem.
"Common sense is the least common of the senses" Anonymous.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Lo felicito Sr. Planisi.
Un excelente material, con explicaciones claras y ejemplos magníficos.

Thank you so much for your time and patient.

Teach is learn twice. So, what do you think regarding learn again?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Muito obrigado, senhor ;)

Guillem.
"Common sense is the least common of the senses" Anonymous.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi guys, need some help from you all..
..about the temperature sensor which is located at back of the avr butterfly...do you all know the simple program by using the existed temperature sensor at the back of that avr butterfly..

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

First, this question is inappropriate for the tutorials forum. Please read forum guidelines.

Second, please do not hijack other peoples threads, start your own.

Regards,
Steve A.

The Board helps those that help themselves.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i've wrote this blog post which contains a reference to guillem tutorial, hope it will be usefull, and hope i can reference your tutorial, if not, please let me know.

http://davidegironi.blogspot.it/...