Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 23:36 02 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : DS18B20 Function

Author Message
DaveC166
Regular Member

Joined: 13/09/2012
Location: New Zealand
Posts: 44
Posted: 09:07pm 31 Aug 2014
Copy link to clipboard 
Print this post

I am currently building a 28 pin micromite HRV controller to replace a Picaxe 28x2.
I have 3 DS18B20 sensors connected,2 using parasite power and 1 normally powered,all three with 4.7K pullups,default resolution .
The DS18b20() function only seems to work above zero degrees. Below zero degrees all 3 sensors return -127.00 degrees whether it is actually -0.5 to -10.0 deg. any one else encountered probs with DS18b20 sensors at below zero temps. Do I have to use one wire functions?
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 09:17pm 31 Aug 2014
Copy link to clipboard 
Print this post

@DaveC166, I'm so glad you posted this - I seem to have seen a similar issue.

I am helping someone use a DS18B20 as a temperature sensor in an application where temperatures fall to around -75 degC. In tests we also notice the temperature returning -127 (but I'm sure we did get some -ve readings - will check this).

So yes, I have seen it too. I was going to do more tests today (using the freezer) to see if it is a -ve temp issue. I get the feeling there may be a small bug in the firmware.

I will try bit-banging first to make sure the temp sensor isn't faulty - and then post again to let you know what I find.

WW
For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
DaveC166
Regular Member

Joined: 13/09/2012
Location: New Zealand
Posts: 44
Posted: 09:34pm 31 Aug 2014
Copy link to clipboard 
Print this post

Thanks.
That's what I tried, sticking all 3 sensors in the freezer one at a time. all were ok until 0 deg c. Even just below 0 they all return between -125 deg and -127 deg
I guess the onewire function is the only alterative
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 09:41pm 31 Aug 2014
Copy link to clipboard 
Print this post

I am getting (incorrect) -ve values other than -127. For example -83.25 when it should be around -15.
I am not at home at the moment; are you able to try the ONEWIRE command easily?

If so then I recommend initially displaying the temp in binary format and check this against the datasheet. Then I believe it will highlight that the error is located in the 'conversion' to a 'readable' format maybe??



For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
DaveC166
Regular Member

Joined: 13/09/2012
Location: New Zealand
Posts: 44
Posted: 09:49pm 31 Aug 2014
Copy link to clipboard 
Print this post

I will give it a go. May take a day or two
 
DaveC166
Regular Member

Joined: 13/09/2012
Location: New Zealand
Posts: 44
Posted: 09:37am 01 Sep 2014
Copy link to clipboard 
Print this post

I have tried onewire commands instead of the DS18b20 function. the same result, temperature displayed correctly down to 0 deg. Bellow 0 deg getting between -125 and -127.0 displayed.
I have also tried displaying the temperature register high byte + low byte, this shows data reducing to 0 at 0 deg, but increasing to 401 below 0 deg, I thought the Ds18b20 would show 65528 for -0.5 deg .
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 09:55am 01 Sep 2014
Copy link to clipboard 
Print this post

OK - I can confirm that Geoff (in his usual rapid way ) has fixed this -ve temperature 'issue'.

It will be included in 4.5D release along with a few other fixes.

Keep an eye out for news from Geoff as to when he is releasing 4.5D . . . .

WW


For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
DaveC166
Regular Member

Joined: 13/09/2012
Location: New Zealand
Posts: 44
Posted: 12:02pm 01 Sep 2014
Copy link to clipboard 
Print this post

Ok I will hunt on EBAY for a PICKIT3
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2290
Posted: 12:28pm 01 Sep 2014
Copy link to clipboard 
Print this post

or use an FT232RL bridge and one resistor, with the software written by 'DaveS'.


rob :-)
 
DaveC166
Regular Member

Joined: 13/09/2012
Location: New Zealand
Posts: 44
Posted: 12:34pm 01 Sep 2014
Copy link to clipboard 
Print this post

HI Rob, can you provide any more info about the FT232RL bridge and software ?.
I managed to modify a onewire Function I found on this forum to work at negative temps
 
DaveC166
Regular Member

Joined: 13/09/2012
Location: New Zealand
Posts: 44
Posted: 01:31pm 01 Sep 2014
Copy link to clipboard 
Print this post

White wizard ,
this code seems to work
SUB STARTMEASURE (pinnbr)
onewire RESET pinnnbr
Onewire WRIte pinnnbr,2,5, &HCC, &H4E,&H00,&H00,&H7F
ONewire Write pinnnbr,8,2,&HCC,&H44
End SUB


FUNCTION GETREADING (pinnbr)
LOCal TH,TL
onewire write pinnbr, 1, 2, &HCC, &HBE
ONEwire read pinnbr, 2, 2, TL, TH
IF TH<16 Then GETREADING=((TH and &b111)*256 +TL)/16 '0 to 125 deg
if TH>=16 then
GETREADING=(256-TL)/16 'bellow 0 deg
GETREADING= -GETREADING
endif
end function
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3661
Posted: 08:03pm 01 Sep 2014
Copy link to clipboard 
Print this post

It's in the ZIP here from this page of a long thread.

You need an FT232R where you can get at the pins listed in the howto. Suitable boards on fleabay are about $3.

JohnSEdited by JohnS 2014-09-03
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024