Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
Guillem Planisi
PostPosted: Mar 13, 2008 - 08:31 PM
Raving lunatic


Joined: Jun 11, 2004
Posts: 2422
Location: Vilanova (Barcelona)

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 Wink).

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).

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


Last edited by Guillem Planisi on Mar 25, 2008 - 03:05 PM; edited 1 time in total
 
 View user's profile Send private message  
Reply with quote Back to top
S-Sohn
PostPosted: Mar 13, 2008 - 09:13 PM
Posting Freak


Joined: Aug 22, 2004
Posts: 1624
Location: Germany

My spanish is much poorer than my Swahili (Jambo, Rafiki, Habari?, Nzuri!, Hakuna Matata... Very Happy )
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
 
 View user's profile Send private message  
Reply with quote Back to top
Guillem Planisi
PostPosted: Mar 13, 2008 - 09:22 PM
Raving lunatic


Joined: Jun 11, 2004
Posts: 2422
Location: Vilanova (Barcelona)

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. Wink

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.
 
 View user's profile Send private message  
Reply with quote Back to top
js
PostPosted: Mar 13, 2008 - 11:15 PM
10k+ Postman


Joined: Mar 28, 2001
Posts: 20387
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)

¿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
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
S-Sohn
PostPosted: Mar 13, 2008 - 11:54 PM
Posting Freak


Joined: Aug 22, 2004
Posts: 1624
Location: Germany

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

Regards
Sebastian
 
 View user's profile Send private message  
Reply with quote Back to top
Guillem Planisi
PostPosted: Mar 14, 2008 - 08:41 AM
Raving lunatic


Joined: Jun 11, 2004
Posts: 2422
Location: Vilanova (Barcelona)

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. Wink

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.

_________________
Guillem.
"Common sense is the least common of the senses" Anonymous.
 
 View user's profile Send private message  
Reply with quote Back to top
js
PostPosted: Mar 14, 2008 - 08:53 AM
10k+ Postman


Joined: Mar 28, 2001
Posts: 20387
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)

The Spanish bits are pretty clear. Laughing
The C bits.... Sad

_________________
John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Guillem Planisi
PostPosted: Mar 14, 2008 - 09:46 AM
Raving lunatic


Joined: Jun 11, 2004
Posts: 2422
Location: Vilanova (Barcelona)

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

_________________
Guillem.
"Common sense is the least common of the senses" Anonymous.
 
 View user's profile Send private message  
Reply with quote Back to top
Guillem Planisi
PostPosted: Mar 25, 2008 - 03:06 PM
Raving lunatic


Joined: Jun 11, 2004
Posts: 2422
Location: Vilanova (Barcelona)

As I promissed, I had added the english version.

Any suggestions are welcomed.

_________________
Guillem.
"Common sense is the least common of the senses" Anonymous.
 
 View user's profile Send private message  
Reply with quote Back to top
Bingo600
PostPosted: Mar 26, 2008 - 08:07 PM
Raving lunatic


Joined: Apr 25, 2004
Posts: 3809
Location: Denmark

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
 
 View user's profile Send private message  
Reply with quote Back to top
Guillem Planisi
PostPosted: Mar 27, 2008 - 08:40 AM
Raving lunatic


Joined: Jun 11, 2004
Posts: 2422
Location: Vilanova (Barcelona)

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 Wink, and if you have some other questions or hints, let me know.

_________________
Guillem.
"Common sense is the least common of the senses" Anonymous.
 
 View user's profile Send private message  
Reply with quote Back to top
pykedgew
PostPosted: Mar 27, 2008 - 01:56 PM
Posting Freak


Joined: Jun 18, 2001
Posts: 1085
Location: Brisbane Queensland Australia

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.
 
 View user's profile Send private message  
Reply with quote Back to top
Guillem Planisi
PostPosted: Mar 27, 2008 - 02:57 PM
Raving lunatic


Joined: Jun 11, 2004
Posts: 2422
Location: Vilanova (Barcelona)

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.
 
 View user's profile Send private message  
Reply with quote Back to top
mashura
PostPosted: Dec 19, 2008 - 09:19 AM
Newbie


Joined: Dec 11, 2008
Posts: 12


thanks to recomend me to this tread...its very usefull
 
 View user's profile Send private message  
Reply with quote Back to top
Guillem Planisi
PostPosted: Dec 20, 2008 - 06:27 PM
Raving lunatic


Joined: Jun 11, 2004
Posts: 2422
Location: Vilanova (Barcelona)

You are welcome.

_________________
Guillem.
"Common sense is the least common of the senses" Anonymous.
 
 View user's profile Send private message  
Reply with quote Back to top
npat_avr
PostPosted: Apr 11, 2009 - 03:16 PM
Posting Freak


Joined: Feb 02, 2009
Posts: 1004


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:
Code:

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?
 
 View user's profile Send private message  
Reply with quote Back to top
Cardiuz
PostPosted: Apr 21, 2009 - 12:21 PM
Newbie


Joined: Apr 03, 2009
Posts: 10
Location: Barcelona

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
 
 View user's profile Send private message  
Reply with quote Back to top
elt_engineers
PostPosted: Nov 23, 2009 - 08:11 AM
Newbie


Joined: Nov 20, 2009
Posts: 2


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
 
 View user's profile Send private message  
Reply with quote Back to top
niblok
PostPosted: Feb 19, 2010 - 01:07 AM
Newbie


Joined: Jan 26, 2010
Posts: 1


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. Smile
 
 View user's profile Send private message  
Reply with quote Back to top
Guillem Planisi
PostPosted: Feb 19, 2010 - 07:36 AM
Raving lunatic


Joined: Jun 11, 2004
Posts: 2422
Location: Vilanova (Barcelona)

Hi, you are welcome!!

_________________
Guillem.
"Common sense is the least common of the senses" Anonymous.
 
 View user's profile Send private message  
Reply with quote Back to top
Liontec
PostPosted: Sep 26, 2010 - 02:01 AM
Rookie


Joined: Jun 30, 2007
Posts: 47
Location: Florianópolis - Brazil

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?
 
 View user's profile Send private message  
Reply with quote Back to top
Guillem Planisi
PostPosted: Oct 08, 2010 - 03:31 PM
Raving lunatic


Joined: Jun 11, 2004
Posts: 2422
Location: Vilanova (Barcelona)

Muito obrigado, senhor Wink

_________________
Guillem.
"Common sense is the least common of the senses" Anonymous.
 
 View user's profile Send private message  
Reply with quote Back to top
syakir
PostPosted: Apr 17, 2011 - 09:12 AM
Newbie


Joined: Apr 16, 2011
Posts: 6


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..
 
 View user's profile Send private message  
Reply with quote Back to top
Koshchi
PostPosted: Apr 17, 2011 - 05:12 PM
10k+ Postman


Joined: Nov 17, 2004
Posts: 13848
Location: Vancouver, BC

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.
 
 View user's profile Send private message  
Reply with quote Back to top
hozone
PostPosted: Jun 11, 2012 - 09:27 PM
Rookie


Joined: Sep 12, 2009
Posts: 49


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/2012/06 ... -read.html
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits