DS18B20 Temperature Component Macro
Moderator: Benj
DS18B20 Temperature Component Macro
Good day,
I am inquiring whether there is a DS18B20 component macro download available for Flowcode V6? I have scratched around the forums but maybe I missed it?
The LM75B macro which is supplied as standard with FC 6 is an SMD chip in real life which is difficult to mount and be able to use when learning to write programs utilizing temperature sensors, the DS18B20 is much easier to use with a breadboard.
Thank you.
Ted
I am inquiring whether there is a DS18B20 component macro download available for Flowcode V6? I have scratched around the forums but maybe I missed it?
The LM75B macro which is supplied as standard with FC 6 is an SMD chip in real life which is difficult to mount and be able to use when learning to write programs utilizing temperature sensors, the DS18B20 is much easier to use with a breadboard.
Thank you.
Ted
Re: DS18B20 Temperature Component Macro
Hello,
Have tried the "One Wire" example which I downloaded from Matrix website, however, the component used is a DS1820 and not a DS18B20....are there no examples for the latter available?
Thanks
Ted
Have tried the "One Wire" example which I downloaded from Matrix website, however, the component used is a DS1820 and not a DS18B20....are there no examples for the latter available?
Thanks
Ted
Re: DS18B20 Temperature Component Macro
The 18B20 temp sensor does not work with FC6. Works fine with FC5, but not FC6. There is a timing problem with the macro. I have asked the guys at MM to have a look at it numerous times, but alas...still nothing.
Re: DS18B20 Temperature Component Macro
I use PIC18F series clocked at 20MHz. The exact same hardware reads the temp 100% with FC5, but not with FC6.
- 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: DS18B20 Temperature Component Macro
Hello,
Is it possible to send us a known working program in v5. I will compile to hardware here and then see if I can compare the waveforms generated by v5 and v6 to see if we can sort this out.
V6 has a more universal but slightly less efficient way of writing to the I/O which is probably effecting the strict 1 wire timings on slower devices. I may need to add a bit of a fiddle factor to the delays on certain families if the clock speed is under a specific threshold.
I may have a program stored somewhere so I'll have a root.
Is it possible to send us a known working program in v5. I will compile to hardware here and then see if I can compare the waveforms generated by v5 and v6 to see if we can sort this out.
V6 has a more universal but slightly less efficient way of writing to the I/O which is probably effecting the strict 1 wire timings on slower devices. I may need to add a bit of a fiddle factor to the delays on certain families if the clock speed is under a specific threshold.
I may have a program stored somewhere so I'll have a root.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- 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: DS18B20 Temperature Component Macro
Hello,
I have just tried my known working v5 program in v6 using a 16F1937 running at 19.6608Mhz and it's working fine for me.
If you have a simple file that shows the problem then I will look into that.
Here is my file,
I have just tried my known working v5 program in v6 using a 16F1937 running at 19.6608Mhz and it's working fine for me.
If you have a simple file that shows the problem then I will look into that.
Here is my file,
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: DS18B20 Temperature Component Macro
Hi All,
I have been playing around with the LM35DZ temperature sensor which is much more user friendly to novices like me. Using the potentiometer to simulate the input for the sensor, I found that one needs to convert the input voltage to try and accurately determine the temperature which I did, but the temperature starts going horribly wrong when the temp is compared to a reference thermometer when the temp starts to drop at night.
With the LM35DZ giving an output of 10mV for each degree of Centigrade, reading the device with a multimeter gives one the temperature in millivolts, however, I am struggling to display the temp consistently over the whole spectrum of the devices range, ie if I deduct the amount that it is over reading according to the reference, it will only be accurate over about a 5 degree variance up and down, there after it becomes inaccurate.
Does anybody have the answer to read the input of the device over the whole range accurately, I am using a PIC16F690 chip at 20Mhz displaying on an LCD?
Thanks Benj for the sample DS18B20 program...will run it and see how it goes.
Thank you
Ted
I have been playing around with the LM35DZ temperature sensor which is much more user friendly to novices like me. Using the potentiometer to simulate the input for the sensor, I found that one needs to convert the input voltage to try and accurately determine the temperature which I did, but the temperature starts going horribly wrong when the temp is compared to a reference thermometer when the temp starts to drop at night.
With the LM35DZ giving an output of 10mV for each degree of Centigrade, reading the device with a multimeter gives one the temperature in millivolts, however, I am struggling to display the temp consistently over the whole spectrum of the devices range, ie if I deduct the amount that it is over reading according to the reference, it will only be accurate over about a 5 degree variance up and down, there after it becomes inaccurate.
Does anybody have the answer to read the input of the device over the whole range accurately, I am using a PIC16F690 chip at 20Mhz displaying on an LCD?
Thanks Benj for the sample DS18B20 program...will run it and see how it goes.
Thank you
Ted
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: DS18B20 Temperature Component Macro
Hi Ted,
What I do is ReadAsInt then use:
Temperature = ReadIntValue * 49 * 10
The temperature will be temperature x 10
E.g if result is 214 then Temperature is 21.4 deg.
Personally I use MCP9701-E/TO becuse they are cheap, and very easy to use since the resolution of this device is 19.53mV/C
Which is the resolution of a bit = 5/256 = 0.01953
This means the calculation is more simple and accurate.
The temperature change measured is also more accurate and less rounding up/down to do
If you change to MCP9701-E/TO I can post the formula I currently use.
Martin
What I do is ReadAsInt then use:
Temperature = ReadIntValue * 49 * 10
The temperature will be temperature x 10
E.g if result is 214 then Temperature is 21.4 deg.
Personally I use MCP9701-E/TO becuse they are cheap, and very easy to use since the resolution of this device is 19.53mV/C
Which is the resolution of a bit = 5/256 = 0.01953
This means the calculation is more simple and accurate.
The temperature change measured is also more accurate and less rounding up/down to do
If you change to MCP9701-E/TO I can post the formula I currently use.
Martin
Martin
Re: DS18B20 Temperature Component Macro
Hi Martin
Thanks for the valuable advice on the Lm35DZ sensor, I really appreciate your help. I am definitely going to acquire some of the MCP sensors suggested, got tired of struggling with the One Wire DS18B20 device that frustrated me to no end, hence me trying to get the LM35DZ to work instead. Will give the DS18B20 another go once I am a little more experienced in using temp sensors.
Please post the temp program that you spoke about, it helps tremendously to follow an experienced programmers flowchart.
Regards
Ted
Thanks for the valuable advice on the Lm35DZ sensor, I really appreciate your help. I am definitely going to acquire some of the MCP sensors suggested, got tired of struggling with the One Wire DS18B20 device that frustrated me to no end, hence me trying to get the LM35DZ to work instead. Will give the DS18B20 another go once I am a little more experienced in using temp sensors.
Please post the temp program that you spoke about, it helps tremendously to follow an experienced programmers flowchart.
Regards
Ted
Re: DS18B20 Temperature Component Macro
Hi Martin
I checked my flowchart with the potentiometer macro that simulates the temp sensor but I do not see the commands that you spoke about, namely the ReadAsInt and ReadIntValue, all I have is GetInt which I am currently using?? Are you using something different or is this a piece of C code that one enters?
Please forgive the ignorance, but we all have to go through this learning curve.
Rgds
Ted
I checked my flowchart with the potentiometer macro that simulates the temp sensor but I do not see the commands that you spoke about, namely the ReadAsInt and ReadIntValue, all I have is GetInt which I am currently using?? Are you using something different or is this a piece of C code that one enters?
Please forgive the ignorance, but we all have to go through this learning curve.
Rgds
Ted
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: DS18B20 Temperature Component Macro
Hi Ted,
Sorry, I had V5 on my mind as that uses ReadAsInt.
You are correct in saying GetInt as that is the V6 equivalent..
There is no C code
Martin
Sorry, I had V5 on my mind as that uses ReadAsInt.
You are correct in saying GetInt as that is the V6 equivalent..
There is no C code
Martin
Martin
Re: DS18B20 Temperature Component Macro
Hi Martin
I found this LM35 thermometer flowchart on the internet, it works perfectly well on the simulator, but alas, when it comes time to compile the program it gives me an "error 1" code.
Please can you check it out for me, as I have confidence in your ability having helped me very well with the fuel gauge project.
Thank you
Regards
Ted
I found this LM35 thermometer flowchart on the internet, it works perfectly well on the simulator, but alas, when it comes time to compile the program it gives me an "error 1" code.
Please can you check it out for me, as I have confidence in your ability having helped me very well with the fuel gauge project.
Thank you
Regards
Ted
- Attachments
-
- Themometer LM35 V1.fcfx
- (8.27 KiB) Downloaded 421 times
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: DS18B20 Temperature Component Macro
Hi Ted,
Thanks.
Reason Flowchart does not compile is because there are Two LCD's!
One on the Dashboard panel which is OK because it's pins are connected to C port.
The other is on the System panel which is causing compile to fail as its pins are connected to B port which does not exist on the selected target device 16F1824
If you select that LCD then right click select Cut you should be able to recompile.
Martin
Thanks.
Reason Flowchart does not compile is because there are Two LCD's!
One on the Dashboard panel which is OK because it's pins are connected to C port.
The other is on the System panel which is causing compile to fail as its pins are connected to B port which does not exist on the selected target device 16F1824
If you select that LCD then right click select Cut you should be able to recompile.
Martin
Martin
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: DS18B20 Temperature Component Macro
As MCP9701 you can try attached flowchart.
Martin
Martin
- Attachments
-
- MCP9701 TEST.fcfx
- (9.82 KiB) Downloaded 432 times
Martin
Re: DS18B20 Temperature Component Macro
Thank you very much, I did not notice the second LCD to be honest. Will try the MCP9701 sensor flowchart as soon as I have received the sensors that I have ordered, much appreciated, you are a star....thank you.
Rgds
Ted
Rgds
Ted
Re: DS18B20 Temperature Component Macro
Hi Martin
Have managed to compile the Thermometer flowchart only to find that in reality it does not work as it is reading 102.3 degrees C while the ambient temp was 16 degrees C, so what a waste of time.
Will be receiving my order for the MCP9701 sensors tomorrow, am keen to get to know them better.
Thanks once again
Rgds
Ted
Have managed to compile the Thermometer flowchart only to find that in reality it does not work as it is reading 102.3 degrees C while the ambient temp was 16 degrees C, so what a waste of time.
Will be receiving my order for the MCP9701 sensors tomorrow, am keen to get to know them better.
Thanks once again
Rgds
Ted
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: DS18B20 Temperature Component Macro
Hi Ted,
I can also let yo know how to check hardware side if you like?
Martin
I can look at the flowchart and sort the issue out for you.TedO wrote: it does not work as it is reading 102.3 degrees C while the ambient temp was 16 degrees C
I can also let yo know how to check hardware side if you like?
Martin
Martin
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: DS18B20 Temperature Component Macro
Spotted the issue in your flowchart.
There is a vital calculation missing:
So you should have:
Floats are not really recommended with 16F pics,
But if you want a more accurate thermometer then floats can be used, but will take a fair bit of storage depending on the target device.
Martin
There is a vital calculation missing:
Code: Select all
Celsius = Celsius * 49 / 10
Code: Select all
Celsius = Celsius * 49 / 10
CelsiusString = ToString$ (Celsius)
Length = Length$ (CelsiusString)
TempString = Left$ (CelsiusString,Length - 1)
But if you want a more accurate thermometer then floats can be used, but will take a fair bit of storage depending on the target device.
Martin
Martin
Re: DS18B20 Temperature Component Macro
Hi Martin
Have just realized my error in trying to use a 16F690 chip with the LM35 sensor, have just read your post from 2014 in which you speak about the internal voltage reference which the 16F1824 chip has, so once again......a valuable lesson.
Thanks
Ted
Have just realized my error in trying to use a 16F690 chip with the LM35 sensor, have just read your post from 2014 in which you speak about the internal voltage reference which the 16F1824 chip has, so once again......a valuable lesson.
Thanks
Ted
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: DS18B20 Temperature Component Macro
Hi Ted,
Understood.
Flowchart you posted will work on 16F690 so long as you add the missing calculation line.
If the calculation line is removed then its for the 16F18xx range.
So basically the calculation line I added above will convert flowchart from Very accurate temperature sensor for 16F18xx to
not so accurate for all other target devices including 16F690
So if you add the calculation, change target device, change configuration settings ofr 16F690,
Display should show temperature with a small error.
Martin
Understood.
Flowchart you posted will work on 16F690 so long as you add the missing calculation line.
If the calculation line is removed then its for the 16F18xx range.
So basically the calculation line I added above will convert flowchart from Very accurate temperature sensor for 16F18xx to
not so accurate for all other target devices including 16F690
So if you add the calculation, change target device, change configuration settings ofr 16F690,
Display should show temperature with a small error.
Martin
Martin
Re: DS18B20 Temperature Component Macro
Hi Martin
I added the calculation formula as you posted, when I run the program on a breadboard the LM35 outputs 102.3 and will not budge up or down.
I am struggling a bit to convert the ADC input from the LM35 to celsius degrees. When I take a reading direct from the sensor, it writes 43 on the LCD when the reference thermometer that I have hanging in my office shows 20 degrees C. I subtracted the amount that it is over reading to give me 20 degrees, however, this I found is not correct as the degree of accuracy goes completely out when the temp changes dramatically away from 20 degrees.
I am trying to help my friend (also a Martin) with a simple temp controller for his homemade bio diesel plant. He uses 2 temps for the process namely 60 and 110 deg C so I made this flowchart to simplify his having to babysit the heating cycle to prevent the oil from being overheated. My problem being that the temp is not correct.
Please can you check it for me and come up with some solution? By the way, your MPC9701 thermometer works very well, tried to modify it to suit the above application but came undone, will get there one day I suppose.
The program uses 2 switches, sw= 60 deg and sw2= 110 deg, I have added a reset button to break the loop as the program will shut down the heater at 60 deg and switch it back on when the temp goes down to 55 deg the same on the higher temp, this cycle will continue until the reset button is pressed. The LED is the relay output to the contactor.
Thanks
Ted
I added the calculation formula as you posted, when I run the program on a breadboard the LM35 outputs 102.3 and will not budge up or down.
I am struggling a bit to convert the ADC input from the LM35 to celsius degrees. When I take a reading direct from the sensor, it writes 43 on the LCD when the reference thermometer that I have hanging in my office shows 20 degrees C. I subtracted the amount that it is over reading to give me 20 degrees, however, this I found is not correct as the degree of accuracy goes completely out when the temp changes dramatically away from 20 degrees.
I am trying to help my friend (also a Martin) with a simple temp controller for his homemade bio diesel plant. He uses 2 temps for the process namely 60 and 110 deg C so I made this flowchart to simplify his having to babysit the heating cycle to prevent the oil from being overheated. My problem being that the temp is not correct.
Please can you check it for me and come up with some solution? By the way, your MPC9701 thermometer works very well, tried to modify it to suit the above application but came undone, will get there one day I suppose.
The program uses 2 switches, sw= 60 deg and sw2= 110 deg, I have added a reset button to break the loop as the program will shut down the heater at 60 deg and switch it back on when the temp goes down to 55 deg the same on the higher temp, this cycle will continue until the reset button is pressed. The LED is the relay output to the contactor.
Thanks
Ted
- Attachments
-
- Oil Temp Controller.fcfx
- (18.89 KiB) Downloaded 427 times