DS18B20 Temp sensor
Moderator: Benj
-
- Flowcode v5 User
- Posts: 115
- Joined: Tue Jul 23, 2013 10:02 am
- Been thanked: 15 times
- Contact:
DS18B20 Temp sensor
Hi,
I am trying to get a DS18B20 temp sensor to work with FC6. I have used the example file and tweaked it for my setup, but the only value displayed on the gLCD is 32767.5. The one-wire component macro in FC6 has an option for the DS1820 which is a bit different to the DS18B20.
Has anyone managed to get the DS18B20 to work in FC6? Any help will be appreciated.
I am trying to get a DS18B20 temp sensor to work with FC6. I have used the example file and tweaked it for my setup, but the only value displayed on the gLCD is 32767.5. The one-wire component macro in FC6 has an option for the DS1820 which is a bit different to the DS18B20.
Has anyone managed to get the DS18B20 to work in FC6? Any help will be appreciated.
-
- Flowcode v5 User
- Posts: 115
- Joined: Tue Jul 23, 2013 10:02 am
- Been thanked: 15 times
- Contact:
Re: DS18B20 Temp sensor
With the exact same hardware setup, I can get it to work 100% with FC5. Seems that the FC6 component macro is obviously not compatible with the DS18B20. The FC5 component macro specifically states that it is for the DS18B20 and the FC6 states that it's for the DS1820. Is this correct?
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: DS18B20 Temp sensor
I was using this DS18B20 sensor just last week. I didn't use the parasitic power to supply it.
Can you please attach your FC program file and I'll have a look. Also if you could show how it is connected (between DS18B20/MCU/Vdd/Vss etc.) that would help.
Can you please attach your FC program file and I'll have a look. Also if you could show how it is connected (between DS18B20/MCU/Vdd/Vss etc.) that would help.
-
- Flowcode v5 User
- Posts: 115
- Joined: Tue Jul 23, 2013 10:02 am
- Been thanked: 15 times
- Contact:
Re: DS18B20 Temp sensor
Thanks for the reply. I'm pretty sure the hardware is ok because it works great with FC5. As soon as I program the exact same hardware setup with FC6 .hex file then it doesn't work. I've attached the FC6 file here for you to check if you'd like. I am also not using parasite power, but the conventional power supply with the 4k7 resistor included.
Thanks again..
Thanks again..
- Attachments
-
- DS18B20_Test_v6.fcfx
- (8.2 KiB) Downloaded 936 times
Re: DS18B20 Temp sensor
Hi
perhabs it helps
attached is a Example with a PIC18F2550 and a DS18B20 Temp Sensor on RA3
i have a RS232 no LCD conected, because i send this over ´xbee 868 pro'..
and - i have not used the one wire icon ..
but this you can change by yours..
one Problem ( i puzzled where the mistake is perhabs Martin can look to this - i am not so fit in Flowcode )
allways full DIGI
example:
Celsius : 22.0
Celsius : 21.0
Celsius : 23.0
Celsius : 19.0
never show
Celsius : 22.3
Celsius : 21.2
Celsius : 23.4
Celsius : 19.5
i think i have a mistake in convert ..
..i have make paused in this becaue i need the help in INTCON2Bits...
http://www.matrixtsl.com/mmforums/viewt ... =7&t=15260
Best wishes
Rudi
perhabs it helps
attached is a Example with a PIC18F2550 and a DS18B20 Temp Sensor on RA3
i have a RS232 no LCD conected, because i send this over ´xbee 868 pro'..
and - i have not used the one wire icon ..
but this you can change by yours..
one Problem ( i puzzled where the mistake is perhabs Martin can look to this - i am not so fit in Flowcode )
allways full DIGI
example:
Celsius : 22.0
Celsius : 21.0
Celsius : 23.0
Celsius : 19.0
never show
Celsius : 22.3
Celsius : 21.2
Celsius : 23.4
Celsius : 19.5
i think i have a mistake in convert ..
..i have make paused in this becaue i need the help in INTCON2Bits...
http://www.matrixtsl.com/mmforums/viewt ... =7&t=15260
Best wishes
Rudi
Re: DS18B20 Temp sensor
keejay wrote:Thanks for the reply. I'm pretty sure the hardware is ok because it works great with FC5. As soon as I program the exact same hardware setup with FC6 .hex file then it doesn't work. I've attached the FC6 file here for you to check if you'd like. I am also not using parasite power, but the conventional power supply with the 4k7 resistor included.
Thanks again..
Hi keejay,
i have test your flowchart. This runs very well with FC 6.0.10 and a PIC18F2550 and a DS18B20 ( 10k Resistor see attached electric shema )
I change only the LCD -> RS232
The Result is:
21.48
21.54
21.48
21.42
21.48
21.48
21.48
21.48
perfect!
Your Flowchart makes the Dezi perfect for me
I will study your calculation..
I have try this like you made with one wire icon
The DS18B20 is connected at my Experiment like this shema: ( 10 k Resistor ) ..
Next step i will try the Formula for Farenheit too. If you have the Formula for your Calculation i would be happy if you post it so i do not puzzle longer how this must go on
Best wishes
Rudi
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: DS18B20 Temp sensor
Please try this one:
- Attachments
-
- DS18B20_Test_v6.fcfx
- (8.65 KiB) Downloaded 749 times
Re: DS18B20 Temp sensor
Hi keejay,
i supply/added only Info to the DS18B20.
Normaly the DS18B20 is corect calibrated - this is for -10 .... + 85 °C with Tolerance that given by the Manufacturer.
This is the Temp Area for corect "Deviations" that is in the Appplication Note / Datasheet write (Tolerance)
But this mean not, if the "LCD shows 21,2 °C" that 21,2 °C is corect - you must compare with a Thermometer if you want to work with the temp value and if this must be right..
example:
My Ds18B20 works ,
the Thermometer shows ~ 19,4 °C
the DS18B20 gives 22,9 °C
So i subtract the Difference ( 3.5 ) from the get and make test.
this was not enough - so i make a substract of 4.3 then a substract of 4.5
Now, the value from DS18B20 agrees with the "eyes reading value " from Thermometer ca ...
Each DS18B20 works difference. My second has a Difference of ca. -1.3 so i make a 1.5 add to the Measurement result of the DS18B20.
One Tip
The measurement will be Difference if you make measurement very fast, because the Self-heating by the current consumption exist at/in the DS18B20 ( it must work faster ... remember to this..
My Delay is 5000 ms = 5 sec
I attached a picture.
This run at Pic 18F2550, without ( MPLAP ) and with the OneWire Icon ( FC ) same.
Best wishes!
Rudi
i supply/added only Info to the DS18B20.
Normaly the DS18B20 is corect calibrated - this is for -10 .... + 85 °C with Tolerance that given by the Manufacturer.
This is the Temp Area for corect "Deviations" that is in the Appplication Note / Datasheet write (Tolerance)
But this mean not, if the "LCD shows 21,2 °C" that 21,2 °C is corect - you must compare with a Thermometer if you want to work with the temp value and if this must be right..
example:
My Ds18B20 works ,
the Thermometer shows ~ 19,4 °C
the DS18B20 gives 22,9 °C
So i subtract the Difference ( 3.5 ) from the get and make test.
this was not enough - so i make a substract of 4.3 then a substract of 4.5
Now, the value from DS18B20 agrees with the "eyes reading value " from Thermometer ca ...
Each DS18B20 works difference. My second has a Difference of ca. -1.3 so i make a 1.5 add to the Measurement result of the DS18B20.
One Tip
The measurement will be Difference if you make measurement very fast, because the Self-heating by the current consumption exist at/in the DS18B20 ( it must work faster ... remember to this..
My Delay is 5000 ms = 5 sec
I attached a picture.
This run at Pic 18F2550, without ( MPLAP ) and with the OneWire Icon ( FC ) same.
Best wishes!
Rudi
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
- Contact:
Re: DS18B20 Temp sensor
Hi Rudi!
Would you share your last update with me. As you see: http://www.matrixtsl.com/mmforums/viewt ... 54&t=15265
I also have make experiment with this device.
Thank´s in advance
Best regard
Jorgen
Would you share your last update with me. As you see: http://www.matrixtsl.com/mmforums/viewt ... 54&t=15265
I also have make experiment with this device.
Thank´s in advance
Best regard
Jorgen
Re: DS18B20 Temp sensor
jgu1 wrote:Hi Rudi!
Would you share your last update with me.
Hi Jorgen,
of course - I'll here tonight after work ( MEZ ca 19:30 ) as attachement. I will post both Mplap and Flowcode.
Edit: Jorgen, if will be late today at work ( trainings ..) , i will post it at weekend, I hope this is ok
Best wishes!
Rudi
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
- Contact:
Re: DS18B20 Temp sensor
Hi Jorgen, hi guys,
attached is the mplap ( i use x version 1.85 ). later i attached the FC6 too - i will sort out for better reading -
you will have it here until monday morning
Best wishes!
Rudi
ps: remove the .zip from file, ( MPLAP.DS18B20.7z.zip -> MPLAP.DS18B20.7z )
attachment as 7z is not allowed so i added simply the point and zip ( .zip )
EDIT: Attached is the FC OnWire Version now, too
attached is the mplap ( i use x version 1.85 ). later i attached the FC6 too - i will sort out for better reading -
you will have it here until monday morning
Best wishes!
Rudi
ps: remove the .zip from file, ( MPLAP.DS18B20.7z.zip -> MPLAP.DS18B20.7z )
attachment as 7z is not allowed so i added simply the point and zip ( .zip )
EDIT: Attached is the FC OnWire Version now, too
-
- Flowcode v5 User
- Posts: 115
- Joined: Tue Jul 23, 2013 10:02 am
- Been thanked: 15 times
- Contact:
Re: DS18B20 Temp sensor
Hi Rudi/hyperion,
Thanks for the posts. I have been away for a few days. I will try the various suggestions that you made and see what I can achieve. Will let you know. Maybe its just a timing issue or something like that.
Thanks for the posts. I have been away for a few days. I will try the various suggestions that you made and see what I can achieve. Will let you know. Maybe its just a timing issue or something like that.
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
- Contact:
Re: DS18B20 Temp sensor
Hi Rudi!
Thank's for sharing. Look forward to make a test. I dowload later today.
Thank you
Best regard
Jorgen
Thank's for sharing. Look forward to make a test. I dowload later today.
Thank you
Best regard
Jorgen
-
- 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: DS18B20 Temp sensor
Today I ordered two of these:
So i'm going to have a play with the temperature sensor as well.
Will post how I get on with it
Martin
At £1.99 for stainless steel waterproof version with free P&P not a bad price. So i'm going to have a play with the temperature sensor as well.
Will post how I get on with it
Martin
Martin
- JohnCrow
- Valued Contributor
- Posts: 1367
- Joined: Wed Sep 19, 2007 1:21 pm
- Location: Lincolnshire
- Has thanked: 364 times
- Been thanked: 716 times
- Contact:
Re: DS18B20 Temp sensor
They go for about £8 on some of the component websites, and that's for the plastic coated ones.
They look very good, and they don't have to come from China etc.
They look very good, and they don't have to come from China etc.
1 in 10 people understand binary, the other one doesn't !
-
- 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: DS18B20 Temp sensor
Hi John,
Since postage is free, they can't be making that much on them.
The come from Singapore.JohnCrow wrote:and they don't have to come from China etc.
Since postage is free, they can't be making that much on them.
Martin
-
- 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: DS18B20 Temp sensor
Had some spare time today, so I have created a flowchart to read the DS18B20 Temperature sensor (see above post) that arrived some time ago.
The the flowchart/hardware works with temperatures above and below 0C.
So if temperature is -3.2 for example, that should be displayed on the hardware.
Tested on a EB006 V9 programmer (16F1937 fitted), EB005 LCD.
resistor used is a 4K7 and is pulling data line up to +5V supply.
Accuracy is very good and temperature is displayed to 2 decimal places.
Here are features from the datasheet including range and accuracy: Thanks Jac for mentioning accuracy
Martin
The the flowchart/hardware works with temperatures above and below 0C.
So if temperature is -3.2 for example, that should be displayed on the hardware.
Tested on a EB006 V9 programmer (16F1937 fitted), EB005 LCD.
resistor used is a 4K7 and is pulling data line up to +5V supply.
Accuracy is very good and temperature is displayed to 2 decimal places.
Here are features from the datasheet including range and accuracy: Thanks Jac for mentioning accuracy
Martin
- Attachments
-
- DS18B20 Thermometer V1a.fcfx
- (10.79 KiB) Downloaded 741 times
Martin
Re: DS18B20 Temp sensor
hi martin
happy new year!
thanks for sharing!
i have two thing changed. my ds18b20 shows 2.7 °C to much. so i have add a variable for calibrate.
i found the formula that value of reading the ds18b20 allways 16 each 1°C so i make my variable for correction
2.7 x 16 = 43.2 , i make it without float so 43 was ok.
one problem i get, if meassuring value example xx.06 °C the zero is not show, only xx.6
i add a controll icon for temp2 and add then a Zero
i add two picture.
nice calculate " > 64000"
this is the best formula way i see for DS18B20 !
thanks to jac, too!
runs like clockwork and like a dream
best wishes!
rudi
happy new year!
thanks for sharing!
i have two thing changed. my ds18b20 shows 2.7 °C to much. so i have add a variable for calibrate.
i found the formula that value of reading the ds18b20 allways 16 each 1°C so i make my variable for correction
2.7 x 16 = 43.2 , i make it without float so 43 was ok.
one problem i get, if meassuring value example xx.06 °C the zero is not show, only xx.6
i add a controll icon for temp2 and add then a Zero
i add two picture.
nice calculate " > 64000"
this is the best formula way i see for DS18B20 !
thanks to jac, too!
runs like clockwork and like a dream
best wishes!
rudi
-
- Posts: 61
- Joined: Sat Apr 11, 2015 12:07 pm
- Has thanked: 20 times
- Been thanked: 14 times
- Contact:
Re: DS18B20 Temp sensor
Hello from a baffled man in need of a brain transplant
I was trying medelec35 DS18B20 Thermometer V1a program
I happen to have the arduino connected so I tried it on that and it's works perfectly temp readings perfect as far as I can tell.
But I then tried using the pic chip as in the program and all I get in minus readings, I've checked the clock freq settings it's getting data back but it's up in the 65000 area but the raw coming back on the arduino is down in the 100's I can't see where I'm going wrong,
Thanks for any help
I was trying medelec35 DS18B20 Thermometer V1a program
I happen to have the arduino connected so I tried it on that and it's works perfectly temp readings perfect as far as I can tell.
But I then tried using the pic chip as in the program and all I get in minus readings, I've checked the clock freq settings it's getting data back but it's up in the 65000 area but the raw coming back on the arduino is down in the 100's I can't see where I'm going wrong,
Thanks for any help
-
- 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: DS18B20 Temp sensor
Hi Pactor,
If you can post your flowchart, I can take a look at it for you.
Martin
If you can post your flowchart, I can take a look at it for you.
Martin
Martin
-
- Posts: 61
- Joined: Sat Apr 11, 2015 12:07 pm
- Has thanked: 20 times
- Been thanked: 14 times
- Contact:
Re: DS18B20 Temp sensor
Hello Thanks for the reply,
Well its your own flow chart I've changed nothing except selected the arduino UNO and changed the ports used all else is the same.
As I say it works perfectly on the Arduino temp readings returned perfect seem dead right.
But when I tried it on a PIC 887 I get readings miles out, down in the minus when it should be about 20.
Not sure where I'm going wrong.
I have ordered a slower crystal as the uno runs at 16Mz and I have the PIC at 20Mz
I try that first before I bother you too much
Thanks very much
Well its your own flow chart I've changed nothing except selected the arduino UNO and changed the ports used all else is the same.
As I say it works perfectly on the Arduino temp readings returned perfect seem dead right.
But when I tried it on a PIC 887 I get readings miles out, down in the minus when it should be about 20.
Not sure where I'm going wrong.
I have ordered a slower crystal as the uno runs at 16Mz and I have the PIC at 20Mz
I try that first before I bother you too much
Thanks very much
-
- 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: DS18B20 Temp sensor
That's why I wanted to see the flowchart.Pactor wrote:But when I tried it on a PIC 887 I
You need to have altered configuration settings to make it work.
That could be the issue.
I always do a 1sec flasher test if any flowchart does not work on hardware.
Martin
-
- Posts: 61
- Joined: Sat Apr 11, 2015 12:07 pm
- Has thanked: 20 times
- Been thanked: 14 times
- Contact:
Re: DS18B20 Temp sensor
Hello
Yes I did the LED flash and it seem to be 1 sec.
I've tried it on a PIC877 there's not many settings to change on that, I've set the freq and HS and disabled watchdog
I was wondering if it had to be used on a certain pin on a PIC mirco as the arduino has a Serial Data pin marked and it works perfectly on that.
At the moment the display reads -0.6 and the RAW is 65535
but run the same program on the UNO and its reading in the 20's.
I'm doing something stupid I'm sure of it.
I'll give it a rest for a while
Thanks very much
Yes I did the LED flash and it seem to be 1 sec.
I've tried it on a PIC877 there's not many settings to change on that, I've set the freq and HS and disabled watchdog
I was wondering if it had to be used on a certain pin on a PIC mirco as the arduino has a Serial Data pin marked and it works perfectly on that.
At the moment the display reads -0.6 and the RAW is 65535
but run the same program on the UNO and its reading in the 20's.
I'm doing something stupid I'm sure of it.
I'll give it a rest for a while
Thanks very much
- 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 Temp sensor
Hello,
What clock speed are you clocking the PIC at? Could be the PIC is running too slowly to correctly achieve the strict 1-wire timings. An AVR with the same crystal frequency as a like for like PIC will run approx 4 times faster which might explain why the AVR/Arduino is managing to drive the 1-wire bus.
What clock speed are you clocking the PIC at? Could be the PIC is running too slowly to correctly achieve the strict 1-wire timings. An AVR with the same crystal frequency as a like for like PIC will run approx 4 times faster which might explain why the AVR/Arduino is managing to drive the 1-wire bus.
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