Temperature/humidity sensor

For users of Matrix Multimedia Electronics software to discuss projects, circuits and any other electronics concepts.

Moderators: Benj, Mods

Post Reply
bonst
Posts: 2
Joined: Fri Dec 11, 2009 7:56 am
Contact:

Temperature/humidity sensor

Post by bonst »

Hi, Has anyone been able to use the MIAC for accurate temp or/and humidity readings (between approx 0deg and 45deg). The A/D only has a resolution of 50mV and almost all of the available 3 pin temperature sensors have a resolution of 10mV. The other possibility is to use a Thermistor as in MIAC examples 'sensor1.fcf' , and use a lookup table, which brings me to another question....How can I change the 'C code' in an .fcf format (ie. change the table contents in the 'sensor.fcf' program so I can adapt to my own thermistor). Obviously I am a bit 'green' when it comes to programming with this flowcode programming but I have done a small amount of programming in 'C'.
Thanks in advance for any help.
Cheers Tony

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Temperature/humidity sensor

Post by Benj »

Hello Tony

I have used the MIAC to do accurate temperature readings to create a closed loop temperature controlled environment using fans.

To do this I followed the information available from here

http://www.matrixmultimedia.com/mmforum ... =26&t=4869

Basically I created an array of size 256. Then I used the ADC in 8-bit mode and used the sampled value as the array pointer. To create my data array I used Excel to work out the specific temperature relative to the voltage measured by the MIAC. I also created a second look up table of 256 bytes that corresponded to the fan speed at a given temperature.

I will post up my program, the thermistor i used and the excel calculations tonight as the files are currently sat on my home PC.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Temperature/humidity sensor

Post by medelec35 »

This is another possibility is using KTY81 series of sensor.
See: http://docs-europe.electrocomponents.co ... 423e40.pdf.
It’s a two wire silicon temperature with a PTC, and it is vitally linear (unlike thermistors) which could mean a formula can be derived to calculate the temperature.
Failing that, on the datasheet the temperatures are given with corresponding resistances. This would be ideal for data lookup table.

I had a quick look at RS components and it is part number 483-6875 (Β£0.34 + vat each) or 483-7991 (Β£0.74 + vat each) both are min quantity of 5
Not tried it myself but since I will use MIAC for temperature measurement, I will buy some then give them a try.
Martin

bonst
Posts: 2
Joined: Fri Dec 11, 2009 7:56 am
Contact:

Re: Temperature/humidity sensor

Post by bonst »

Thanks for the replies,
Look forward to seeing your example Ben.
I have looked at several temperature sensor components, and I will look further at the KTY81, thanks medelec 35. The problem I am experiencing however is the small amount of resistance variation (or voltage variation) these components offer over the required temperature range.
The MIAC ADC has 240 usable steps over 0V - 12V which relates to a resolution of 50mV/degree. As I will be making several of these controllers to control fans and Airconditioners, I need to get consistency with every unit and would prefer to have the program consistent also.
At the moment I am having reasonable success using an AD592 which provides a current through relative to Temp. Measuring the voltage across a 50k series resistor relates to 50mV/deg.....however supply voltage needs to be increased to between 20V and 24V , a suitable zener is required to drop the measured voltage down to a range the ADC can read, and a buffer is also required so the 10k input impedance of MIAC doesn't load circuit.
I would prefer a simpler approach....
Any ideas on measuring Humidity?

Cheers Tony

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Temperature/humidity sensor

Post by Benj »

Hi Tony

Right here are the files. I think I used this part from Rapid 61-0410 for Β£0.21 but I will try and confirm this, I should have the bag lying around here somewhere.

Here is the spreadsheet file I used to create my look up table. It measures temperatures from 0 to 95 degrees though for my program I was only interested in values between 6 and 58 so these are the values in the seperate table on the right. I then copied this table out into a new file and then saved as a .csv and relayed out the file into rows instead of columns. I think you can do this simply by saving as CSV and then reopening the file and you will be asked how you want it laying out. Then resave (there may be an easier way Im a bit rusty on this new excel). This generated the code to go directly into the array so you dont actually have to type in all those values.
thermistor.xls
(42.5 KiB) Downloaded 577 times
Here is the flowcode file for the MIAC. The MIAC has an internal 10K pulldown resistor so this was taken into account by the calculations in the excel file. If you are using a normal ADC pin on a uC then adding a 10K pulldown to ground will allow you to have the same results with the thermistor as on the MIAC.
TempController.fcf
(16.59 KiB) Downloaded 727 times
The temperature look up table is stored in C inside the supplementary code window which is available via the View -> project options menu.

The lookup is performed near the top of the main while 1 loop. The program is a real time temperature and pump controller. It updates the display with the time and two thermistor readings and fan speeds every 250 milliseconds. It should be quite easy to tailor it to meet your requirements. The file is currently for v4 of Flowcode only.

Let me know how you get on and I will see if I can confirm the thermistor component as being the exact one I used.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Temperature/humidity sensor

Post by medelec35 »

Ben that is a Very useful sheet indeed!
Benj wrote: there may be an easier way Im a bit rusty on this new excel). This generated the code to go directly into the array so you dont actually have to type in all those values.
I have fully automated your excel sheet.
You can aslo apply this sheet to non miac applications where just using any microcontroller. Just click on cell E2 to change, Then Extra prompts will appear (see screen shots)
All you do is:
Enter Values for Thermistor B and resistance at 25 deg C.
Then spread sheet will automatically produce all the data (except variable and semicolon braces etc) in Cell D10 For you to copy and paste directly into Supplementary code window.

Note: you will only see =D7&D8&D9 in excel window, all the data including commas will be copied.
Just delete data not required i.e any commas at the end and data outside range your interested in.
Re: read as int. Not sure how practical this is since I believe the Variable used in supplementary code window can only accept up to 255 chars? Perhaps changing type of variable can allow more?
@Ben. Since you originally posted sheet. would you mind test the automated version and post comments so I can amend where necessary. Thank you in advance.

There is no need to enter any data into MIAC look up columns as this has also been automated.
Try it, just enter a new temperature in A13 and watch all values change.
Hope you like improvements.

Note: Sheet is protected just to stop cells being edited accidentally. No password is required to unlock.
Only tested with excel 2007.
Thermistor_automated2A.jpg
(219.57 KiB) Downloaded 5538 times
Thermistor_automated2B.jpg
(216.37 KiB) Downloaded 5538 times
Happy Christmas to all!
From Martin.
Attachments
thermistor_automated2.xls
(228.5 KiB) Downloaded 519 times
Martin

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Temperature/humidity sensor

Post by Benj »

Hi Martin

Hope you had a good holiday. That modified sheet you have done looks great many thanks for helping to polish it off. :mrgreen:

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Temperature/humidity sensor

Post by medelec35 »

Thanks and your welcome Hope your holiday also went well. If you can put sheet though its paces ,and let me know if you find any problem will be great!
What I like about your sheet is if you use a different thermistor, you just enter new resistance and 25 Deg C and Beta values, then rest is done for you.
Happy new year to all!
Martin

jack kallis
Posts: 1
Joined: Tue Apr 17, 2012 10:14 am
Contact:

Re: Temperature/humidity sensor

Post by jack kallis »

I have also used MIAC to do accurate temperature readings to create a closed loop temperature controlled environment using fans.

Post Reply