LM34 Temp sensor

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Bill Felker
Flowcode v5 User
Posts: 47
Joined: Tue Sep 24, 2013 7:21 pm
Has thanked: 18 times
Been thanked: 12 times
Contact:

LM34 Temp sensor

Post by Bill Felker »

I am looking to make a greenhouse environmental controller and am thinking of using a PIC and was wondering if anyone has had experience with LM34 temp sensor (Fahrenheit readings) Also looking for a humidity sensor. Any help with experiences with this would be greatly appreciated . 8)

Bill

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: LM34 Temp sensor

Post by acestu »

Hi Bill,

Welcome to the forums,

I think there is probably quite a bit about using that sensor and DHT11 sensors and so on in the forums, I have done some stuff myself, if you want to search the whole of the forum, you can type LM34 into the search box at the top right of the page, you should find lots of stuff on there.

Hope this helps / Just shout if you need anything else
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: LM34 Temp sensor

Post by acestu »

Hi Bill,

You might find this old post of mine interesting, it uses a DHT-11 sensor if I remember rightly and they are only a couple of pounds to buy.

http://www.matrixmultimedia.com/mmforum ... 46&t=11583

cheers
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

K9ACT
Posts: 20
Joined: Wed Oct 23, 2013 1:29 am
Been thanked: 1 time
Contact:

Re: LM34 Temp sensor

Post by K9ACT »

Bill Felker wrote:I am looking to make a greenhouse environmental controller and am thinking of using a PIC and was wondering if anyone has had experience with LM34 temp sensor (Fahrenheit readings) Also looking for a humidity sensor. Any help with experiences with this would be greatly appreciated . 8)

Bill
Funny you should mention this application as it is how I got into PIC in the first place. I didn't know about the F version so I used the LM35 but after hacking away and even with the help of a very experienced PIC programmer we ended up using a 12f675 as a comparator for the fan control and then LM2903's for the heat controllers. They could have been combined into one but I was in a hurry for the fan so I did it the easy way.

I would like to use a PIC with an LCD for this but I need to learn to program first as nothing seems to fall out of the sky for me on this and my friend is getting weary of doing all the work.

Have you come up with anything yet?

Jack

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: LM34 Temp sensor

Post by dazz »

Hi Fella

With flow-code try to make all your variable meaningful to the job they perform again comment your code extensively as it will help you remember what a particular calculation or something else is trying to do , also try using a switch icon instead of a decision icon as a switch icon lays nice on screen and is quicker to read than nested decision icons(although they do the same job),
an example of a variable for a temp sensor rather than S1 try Temp_sensor_1 (although its looks a longer way you can just copy past it to a new variable then change the number, and it explains more readily what that variable does.
Make a Flowchart and paste it to the forum as some one will offer help or advice( i tend to give a quick answer so you can work it out as that way you will pick it up quicker, also if 10 people reply with different ways of doing the same thing, that's because ethers many ways of achieving the end result so pick the ones that fit in with your style etc.. So have a fiddle with say an LCD simulate it and if your stuck post your chart and someone will steer you right.

Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

Bill Felker
Flowcode v5 User
Posts: 47
Joined: Tue Sep 24, 2013 7:21 pm
Has thanked: 18 times
Been thanked: 12 times
Contact:

Re: LM34 Temp sensor

Post by Bill Felker »

K9ACT wrote:
Bill Felker wrote:I am looking to make a greenhouse environmental controller and am thinking of using a PIC and was wondering if anyone has had experience with LM34 temp sensor (Fahrenheit readings) Also looking for a humidity sensor. Any help with experiences with this would be greatly appreciated . 8)

Bill
Funny you should mention this application as it is how I got into PIC in the first place. I didn't know about the F version so I used the LM35 but after hacking away and even with the help of a very experienced PIC programmer we ended up using a 12f675 as a comparator for the fan control and then LM2903's for the heat controllers. They could have been combined into one but I was in a hurry for the fan so I did it the easy way.

I would like to use a PIC with an LCD for this but I need to learn to program first as nothing seems to fall out of the sky for me on this and my friend is getting weary of doing all the work.

Have you come up with anything yet?

Jack
Hi Jack here is a quick and easy that I did to establish some of my concepts. I am using the ADC knob as a temp sensor and the LCD to record my ADC reading and my temp conversion. I did it to play with flowcode 6 and do not know if it is portable to lower flowcodes.

Bill
Attachments
temp example.fcfx
(7.62 KiB) Downloaded 514 times

K9ACT
Posts: 20
Joined: Wed Oct 23, 2013 1:29 am
Been thanked: 1 time
Contact:

Re: LM34 Temp sensor

Post by K9ACT »

I downloaded your program and diddled with it a bit but have no idea of how this all goes together and am getting totally frustrated again trying to learn even this seemingly simple method.

As one able to retire at 40 after a successful career manufacturing computer chips, I always thought I was pretty smart but this PIC stuff makes me feel like an idiot.

I have come to the conclusion more recently that the idiots are the ones trying to explain how to use the programs and not the users.

I have spent about 3 days looking for useful info on just this program and have come up only with videos that are out of focus, English that I can not understand, help lists to nowhere and tutorials more like hardware commercials than help.

I can't even find samples of working programs that I can putz around with.

Can anyone point to some help or should I just give up?

Even stranger, several emails to the sales department have never been answered.


Jack
Marengo Il

prasha920
Posts: 30
Joined: Tue Apr 16, 2013 3:10 pm
Has thanked: 48 times
Been thanked: 9 times
Contact:

Re: LM34 Temp sensor

Post by prasha920 »

HI Bill, can you upload the image of the program in jpg etc. format as i dont have F6 version to run the file you uploaded..

even i am using LM35 tempsensor in my current project. so i would like to know tthe method you used to display the output temperature.

Prashant

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: LM34 Temp sensor

Post by medelec35 »

Hi Prashant & Bill , I have not got an LM34 so this is only my theory so I can't guarantee it will work.
Reading variable as int (not Byte) then try the following formula:
Fahrenheit = ReadADCVariable *50/102

Below is my theory if you would like to know how I came up with the formula:
If you use ReadAsInt then resolution of ADC will be 5/1023 = 4.89mV
5 = 5V ADC reference
1023 = max number of steps of ADC (0 to 1023)

Since LM34 has a resolution of 10mV per 1F then ADC will increase by just over 2 every 1F
So we need to divide the total by 2 then by approx 1.02 (0.05/0.0489)
Since it's not recommended using Floats with PIC's that have lower ROM space (Floats can take 32 bits of ROM + space in ram for calculations), then we have to take the int result and multiply it first, just so we can divide by 1.02
= ReadADCVariable*100/2 then divide by 102
Since 100/2 = 50
I came up with the final formula of
Fahrenheit = ReadADCVariable *50/102

If anyone requires help in creating a flowchart with the formula integrated, then please let me know.

Since this is only theory can you please let me know if it works or not.

Thanks.
K9ACT wrote:I have come to the conclusion more recently that the idiots are the ones trying to explain how to use the programs and not the users.
I believe that's a bit harsh Jack, as the people you're calling "idiots" are trying to help you.
Many of those people e.g VC members and other forum users give up their free time to help as we are not employed By Matrix.
Martin

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: LM34 Temp sensor

Post by medelec35 »

I have created a flowchart (with Flowcode V5) to display Fahrenheit and Celsius using LM34
Its untested so hope it works.

I have left both readings of Fahrenheit and Celsius on the LCD, so you can edit flowchart as you see fit.
LM34 Thermometer.png
(85.31 KiB) Downloaded 15004 times
Martin
Attachments
LM34 Themometer.fcf
(10 KiB) Downloaded 531 times
Martin

K9ACT
Posts: 20
Joined: Wed Oct 23, 2013 1:29 am
Been thanked: 1 time
Contact:

Re: LM34 Temp sensor

Post by K9ACT »

medelec35 wrote: I believe that's a bit harsh Jack, as the people your calling "idiots" are trying to help you.
Many of those people e.g VC members and other forum users give up their free time to help as we are not employed By Matrix.
My apologies to the group if it was taken as referring to them. I was referring to the packaged information "out there" that is supposed to teach beginners how to program. I have purchased books and spent countless hours on the net trying to understand how to program pics using asm, C and not flowcode but I still can seem to get off the ground. The blinking led I referred to in another posting is the first thing I have ever done on my own but I can't take it any farther because of a lack of foundation and beginners information.

Here is an example of a brick wall for me.

The program in this thread uses an ADC. A component icon is pulled down but I have no idea how it became and ADC. I can't find a list of components anywhere.

This is the level I am at and need some help.

Thanks,

js

Bill Felker
Flowcode v5 User
Posts: 47
Joined: Tue Sep 24, 2013 7:21 pm
Has thanked: 18 times
Been thanked: 12 times
Contact:

Re: LM34 Temp sensor

Post by Bill Felker »

WOW, once again the membership here has taken a concept and shown way to go to make it a reality. This site is way better than the manufactures sites which deal with customers as tho they are all engineers. Love the ideas for this sensor use and the examples are great.

And Jack ,don't be so hard on everyone.I am an electronics guy who did maintenance in the semiconductor industry for 25 years. So I started with a little knowledge on programming, I was versed on the early basic and had a course in "C" in the early 90's .So I am NO expert but what they have accomplished here with flowcode is amazing and it will help you understand "C" better as you go along.As far as the PIC line of micro-controllers it is as good as the next and they do have customer support if you are having some problems. I guess the question you need to ask yourself is were are you lacking in knowledge on this subject and how can you gain this info in a way that is useful to helping you. As for a beginner in my opinion there is no better way to program a project than flowcode (unpaid endorsement :lol: ) I have been brought back into electronics because of the chance of coming across a pic controller at work and being told to ignore it because I did not have the knowledge to understand the design or programming of it. By the way that was the gauntlet and I not only learned how it worked I also with flowcode help wrote a program to make it work a little better.

:D Bill

Bill Felker
Flowcode v5 User
Posts: 47
Joined: Tue Sep 24, 2013 7:21 pm
Has thanked: 18 times
Been thanked: 12 times
Contact:

Re: LM34 Temp sensor

Post by Bill Felker »

medelec35 wrote:I have created a flowchart (with Flowcode V5) to display Fahrenheit and Celsius using LM34
Its untested so hope it works.

I have left both readings of Fahrenheit and Celsius on the LCD, so you can edit flowchart as you see fit.
LM34 Thermometer.png
Martin
OK nicely done Martin. Now how would you go to 1 decimal like say 86.3º F ?

Bill

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: LM34 Temp sensor

Post by dazz »

Bill Felker wrote:WOW, once again the membership here has taken a concept and shown way to go to make it a reality. This site is way better than the manufactures sites which deal with customers as tho they are all engineers. Love the ideas for this sensor use and the examples are great.
Yup love it here too

And Jack ,don't be so hard on everyone.I am an electronics guy who did maintenance in the semiconductor industry for 25 years. So I started with a little knowledge on programming, I was versed on the early basic and had a course in "C" in the early 90's .
I have been using pics for a while, i remember the early days trying to learn ASM , the only bit of ASM i ever got a grasp of was doing my c&g 224 had to programme a z80 to count if i remember correctly, hated Asm ever since :lol:, been trying to graso C as well, i've learnt more about C since using flowcode than i have in the last 25 years, ah basic the joys of programming sinclair zx products lmao.
Bill Felker wrote:So I am NO expert but what they have accomplished here with flowcode is amazing and it will help you understand "C" better as you go along.As far as the PIC line of micro-controllers it is as good as the next and they do have customer support if you are having some problems. I guess the question you need to ask yourself is were are you lacking in knowledge on this subject and how can you gain this info in a way that is useful to helping you. As for a beginner in my opinion there is no better way to program a project than flowcode (unpaid endorsement :lol: )
Said above about c i look at the c files and flowcharts as you can grasp a lot by working what does wha, tAs for learning flowcode we all had to start fresh at one point in time i can remember getting very frustrated trying to make a button do two things, worked on it for days and asked for help on here ,i was blown away as 2 very different solutions appeared, almost immediately, another tip is if you want to see what a component does, simply select it and then click on help and a page appears with the basics. I was lucky enough to beta test along with others, i also have visited Matrix and believe me even under pressure the Matrix Team are always enthusiastic about the product,and make time to visit the forums several times a day(also Matrix staff visit the forum off the clock in the evenings, goes to show how much they are behind the product), and will listen to users, how many software houses are like that
Bill Felker wrote: I have been brought back into electronics because of the chance of coming across a pic controller at work and being told to ignore it because I did not have the knowledge to understand the design or programming of it. By the way that was the gauntlet and I not only learned how it worked I also with flowcode help wrote a program to make it work a little better.

:D Bill

Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

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: LM34 Temp sensor

Post by medelec35 »

Hi Bill,
Bill Felker wrote:OK nicely done Martin. Now how would you go to 1 decimal like say 86.3º F ?
Attached is a flowchart that displays to 1 decimal:
LM34 V2.png
(49.66 KiB) Downloaded 14808 times
If you want the accuracy, then either floats or a different sensor that has a digital output should be used instead.
Just had a thought, What about this:
http://www.matrixmultimedia.com/mmforum ... 55&#p42394
I know its not the LM34, but it may just what your looking for?

Martin
Attachments
LM34 Themometer V2.fcf
(10.5 KiB) Downloaded 417 times
Martin

Bill Felker
Flowcode v5 User
Posts: 47
Joined: Tue Sep 24, 2013 7:21 pm
Has thanked: 18 times
Been thanked: 12 times
Contact:

Re: LM34 Temp sensor

Post by Bill Felker »

medelec35 wrote:Hi Bill,
Bill Felker wrote:OK nicely done Martin. Now how would you go to 1 decimal like say 86.3º F ?
Attached is a flowchart that displays to 1 decimal:
LM34 V2.png
If you want the accuracy, then either floats or a different sensor that has a digital output should be used instead.
Just had a thought, What about this:
http://www.matrixmultimedia.com/mmforum ... 55&#p42394
I know its not the LM34, but it may just what your looking for?

Martin
After uploading it I tried to simulate it in flowcode 5 and the LCD shows no data. :shock: I noticed that in the upper left corner of the calculation icon is a big red dot and when it hits this it stops there and I have to hit run again to get it to read . :?: What does this red dot signify ?
Bill
Last edited by Bill Felker on Thu Oct 31, 2013 12:02 am, edited 1 time in total.

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: LM34 Temp sensor

Post by medelec35 »

Hi Bill
Bill Felker wrote:After uploading it I tried to simulate it in flowcode 5 and the LCD shows no data. :shock:
Oops sorry, I have left a breakpoint set (Red dot), and simulation stops at every breakpoint that's encountered:
Removing Breakpoint.png
(10.37 KiB) Downloaded 14793 times
Just right click on the Icon that's got a red dot, and select Toggle breakpoint to removed it from the calculation box.
Then simulation should run fine:
simulation LM34.png
(7.95 KiB) Downloaded 14793 times
Martin

Bill Felker
Flowcode v5 User
Posts: 47
Joined: Tue Sep 24, 2013 7:21 pm
Has thanked: 18 times
Been thanked: 12 times
Contact:

Re: LM34 Temp sensor

Post by Bill Felker »

LOL ,I had edited my reply and afterwards I saw that you had addressed my question. :? Thanks I did it and it worked fine. :mrgreen:

Bill

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: LM34 Temp sensor

Post by medelec35 »

Hi Bill,
Glad simulation is working for you.
I was wondering if you have had a chance to test with hardware or not?
If so, did it work OK?

Thanks

Martin
Martin

Bill Felker
Flowcode v5 User
Posts: 47
Joined: Tue Sep 24, 2013 7:21 pm
Has thanked: 18 times
Been thanked: 12 times
Contact:

Re: LM34 Temp sensor

Post by Bill Felker »

I have not had the time to order a sensor to try it yet. I suppose I could use a lm35 that I have and see how it works for Celsius now all I need is some spare time, anyone have some? LOL :mrgreen:
Bill

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: LM34 Temp sensor

Post by medelec35 »

Hi Bill,
Due to the fact that LM35 is 10mv per deg C
and LM34 is 10mv per deg F then all you do is change your flowchart from displaying F to C
It should be a easy as that. :)
Bill Felker wrote:now all I need is some spare time, anyone have some? LOL
Sorry had a look and not got much spare myself.

Guess you need to buy some :lol:


Martin
Martin

prasha920
Posts: 30
Joined: Tue Apr 16, 2013 3:10 pm
Has thanked: 48 times
Been thanked: 9 times
Contact:

Re: LM34 Temp sensor

Post by prasha920 »

hi bill and Martin,

if you want and have some 'spare time :lol: ' you can implement lm34 with the help of opamp and lm35 as you dont have lm34 sensor.
Using conversion formula of degC to degF. using opamp make circuit that will add 32 as an offset and anjust the gain of (9/5).
collectively the circuit output will be = (input * (9/5) + 32) which is degF output.
i guess u can try this out on simulation first.
hope this works.. :D





regards,
Prashant

Bill Felker
Flowcode v5 User
Posts: 47
Joined: Tue Sep 24, 2013 7:21 pm
Has thanked: 18 times
Been thanked: 12 times
Contact:

Re: LM34 Temp sensor

Post by Bill Felker »

OK , after MONTHS I've finally set aside time to hook it up and try it and the program works well. It is very slow in response time and updating the LCD but pat of that could be my changing the chip parameters to "INTRC as clock out" because of not having a crystal in this circuit. What would the appropriate setting be for no external crystal ? But the bottom line is the program works :D Bill

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: LM34 Temp sensor

Post by medelec35 »

Hi Bill,
Glad it works ok for you.
It should update nice and fast, unless its the sensor?

Would you like to post the flowchart, if you have altered it, then I can take a look at it for you.
If you have the config set to clockout then are you able to measure the output frequency?

I have attached a flowchart that has internal osc set for 8MHz
Martin
Attachments
LM34 Themometer V2 16F88 8MHz internal osc.fcf
(10.5 KiB) Downloaded 337 times
Martin

Bill Felker
Flowcode v5 User
Posts: 47
Joined: Tue Sep 24, 2013 7:21 pm
Has thanked: 18 times
Been thanked: 12 times
Contact:

Re: LM34 Temp sensor

Post by Bill Felker »

I can post it. :) Bill
Attachments
LM34_Themometer_V2.fcf
(11 KiB) Downloaded 339 times

Post Reply