DS18B20 temp sensor/08M/AXE033 LCD Module question

Hello.

Thanks to Hippy, I got my 08M chip communicating with my AXE033 LCD module.

I have connected my DS18B20 Temp Sensor as per "Digital Sensor Temp Kit" -http://www.picaxe.com/docs/axe113.pdf. ie. DS18B20 to Leg 3 of chip and leg 7 of chip to LCD module .When I run the simple four line code to display temp value on screen, I just get an LCD screen full of quite active black blobs!
Anyone any thoughts as to to how I can get my LCD screen to show ongoing temperature?

David Miles.
 

BeanieBots

Moderator
... DS18B20 to Leg 3 of chip and leg 7 of chip to LCD module ...
Might be a good idea to post a diagram and also your code.

Forget the DS18B20 for now. Can you display correct text on the LCD (I assume yes but please confirm)

Can you get the display to show numbers correctly?
eg if w0 has the value 1234 can you get the display to show "w0 = 1234"
(don't forget the # before w0 in serout line or use BINTOASCII)


Once the above is working, then and only then involve the DS18B20.
Are you using ReadTemp or ReadTemp12?
Can you get the correct value by using Sertxd instead of sending it to the LCD?
If not, what value do you get? (maybe 0, 255 or 85. Any of those three values will give us a clue about what is happening)
Do you have a 4k7 pull-up resistor on pin 2 of the DS18B20?
 

Technical

Technical Support
Staff member
Leg 7 (C.0) is also the sertxd pin so any debug or sertxd or new program download will mess up the serial LCD screen. Use a different output like leg 6 (C.1) for the LCD
 
DS18B20 temp sensor/08m/AXE033 LCD module question

Might be a good idea to post a diagram and also your code.

Forget the DS18B20 for now. Can you display correct text on the LCD (I assume yes but please confirm)

Can you get the display to show numbers correctly?
eg if w0 has the value 1234 can you get the display to show "w0 = 1234"
(don't forget the # before w0 in serout line or use BINTOASCII)


Once the above is working, then and only then involve the DS18B20.
Are you using ReadTemp or ReadTemp12?
Can you get the correct value by using Sertxd instead of sending it to the LCD?
If not, what value do you get? (maybe 0, 255 or 85. Any of those three values will give us a clue about what is happening)
Do you have a 4k7 pull-up resistor on pin 2 of the DS18B20?
Leg 7 (C.0) is also the sertxd pin so any debug or sertxd or new program download will mess up the serial LCD screen. Use a different output like leg 6 (C.1) for the LCD
Thanks for getting back to me.

I'm afraid that I didn't quite understand all your questions, but this is what I have been able to find out so far.

If I use this code:-
main:
readtemp 4,b1 'read temperature
debug b1 'display on screen
pause 250 'short pause
goto main

Leg 7 to LCD gives "debug" box on Prog/Ed screen plus all black blobs LCD screen with blob ativity when I hold temp sensor.
Leg 6 to LCD gives "debug" box with empty LCD screen.

If I use this code:- (using correct leg # in code )

init: pause 500
main: serout 1,N2400,(254,128)
serout 1,N2400,("1234")
end

Leg 7 ( c.0 ) to LCD gives nonsense on the LCD creen and empty serial terminal box (2400,n,8,1 ) on Prog/Ed screen
Leg 6 ( c.1 ) to LCD gives just 1234 and empty serial terminal box (2400,n,8,1 ) on Prog/Ed screen.

Yes, I have 4.7k resistor on middle leg of temp sensor.

I didn't understand the Sertxd bit, but as it seemed important, I tried this code:-

main:
for b1 = 0 to 63 ; start a loop
sertxd(“255 ”,#b1,13,10)
pause 1000
next b1 ; next loop

When I ran this code I got nonsense on terminal box in Prog/Ed and an LCD screen full of nonsense that changed when I held Temp sensor.

I hope that you can make some sense of all this and are ( hopefully ) able to come up with some ideas to enable me to read the DS18B20 in 12 bit mode!

David Miles.
 

jims

Senior Member
David..... This thread in the FORUM Code Snippets has a lot of good info about using the DS18B20. It may be helpful for your project. Take a look at it. Jims
DS18B20 Code Examples
Started by marks, 03-06-2010 00:49
123...4
 

Technical

Technical Support
Staff member
Connect the LCD screen to leg 6 (C.1) and then run this- it will work on both screen (debug window) and LCD
We'll let you work out why from the comments....
Code:
main:
readtemp C.4,b1 'read temperature on C.4
debug b1 'display on screen via download cable on C.0
serout C.1,N2400,(254,128) 'move to LCD position top line (LCD on C.1)
serout C.1,N2400,("Temp=",#b1, "   ") 
pause 250 'short pause
goto main
 
Connect the LCD screen to leg 6 (C.1) and then run this- it will work on both screen (debug window) and LCD
We'll let you work out why from the comments....
Code:
main:
readtemp C.4,b1 'read temperature on C.4
debug b1 'display on screen via download cable on C.0
serout C.1,N2400,(254,128) 'move to LCD position top line (LCD on C.1)
serout C.1,N2400,("Temp=",#b1, "   ") 
pause 250 'short pause
goto main
Hello.
Yes, Something readable did arrive on LCD screen - "Temp=85".

What exactly do you mean by, "We'll let you work out why from the comments...."

David Miles.
 

Technical

Technical Support
Staff member
The LCD and computer connection are no longer clashing (one on C.0 and the other on C.1) so they both now work.

Check the sensor type, it is a DS18B20? Also check the power supply to the sensor.
 
The LCD and computer connection are no longer clashing (one on C.0 and the other on C.1) so they both now work.

Check the sensor type, it is a DS18B20? Also check the power supply to the sensor.
Thank you for getting back to me.

the sensor is a to-92 package. The first ( top ) two lines read:-

DALLAS
18B20

I am using a battery box power supply - 4 .50 volts loaded. I tried a mains power supply set to 5.04 volts with it changing anything.

Running code:

main:
readtemp C.4,b1 'read temperature on C.4
debug b1 'display on screen via download cable on C.0
serout C.1,N2400,(254,128) 'move to LCD position top line (LCD on C.1)
serout C.1,N2400,("Temp=",#b1, " ")
pause 250 'short pause
goto main

Gives me an LCD reading of "Temp=85" plus debug box. No temp change if I hold sensor.

David Miles.
 

Technical

Technical Support
Staff member
85 is the default reading of the sensor when not correctly powered. Double check your connections to the sensor.
 
85 is the default reading of the sensor when not correctly powered. Double check your connections to the sensor.
You were correct about the sensor, and now something is happening. I double checked all connections and voltages, looked for veroboard solder bridges and suddenly realised I had a resistor +led connected as an output indicator on lots of output legs, ( all now removed ) including temp probe input ( leg 3 ). Now LCD reads 47, increases to 54 when I hold sensor.

I am not sure what the number 47 refers to, but do you think it is possible to get a measurement in celsius to a 12bit resolution?

David Miles.
 

sniper887

Member
You can use the readtemp12 command, but be sure to use a word variable. If I recall correctly that will give you the temp down to 1/16 of a degree celsius. The lower 4 bits are the fraction, the high 8 are the whole number.
 

BeanieBots

Moderator
ReadTemp12 C.4,w1 'Use a WORD variable
w1 = w1 * 10 / 16 'convert to Celcius in 10ths of degrees

eg 123 would be 12.3 deg C
 

westaust55

Moderator
You were correct about the sensor, and now something is happening
Now LCD reads 47, increases to 54 when I hold sensor.

I am not sure what the number 47 refers to......
With the READTEMP command (as opposed to READTEMP12) the value you receive is the temperature whole degrees on the Celsius scale. The values you are seeing suggest there may still be something wrong with such high numbers. Working properly most folks will see a value of around 30 when they put a finger on the DS18B20.

As others have indicated you will need some maths to convert the return value to a meaningful temp when using READTEMP12.

Suggest you check and get the basic circuit working first before advancing to 12-but mode.
 
With the READTEMP command (as opposed to READTEMP12) the value you receive is the temperature whole degrees on the Celsius scale. The values you are seeing suggest there may still be something wrong with such high numbers. Working properly most folks will see a value of around 30 when they put a finger on the DS18B20.

As others have indicated you will need some maths to convert the return value to a meaningful temp when using READTEMP12.

Suggest you check and get the basic circuit working first before advancing to 12-but mode.
Thank you both BeanieBots and westaust55 for trying to help. I have tried both ReadTemp and ReadTemp12 with all C. variations without getting anything on my LCD screen.

This code looks most promising :-
main:
readtemp C.4,b1 'read temperature on C.4
debug b1 'display on screen via download cable on C.0
serout C.1,N2400,(254,128) 'move to LCD position top line (LCD on C.1)
serout C.1,N2400,("Temp=",#b1, " ")
pause 250 'short pause
goto main

It's just not giving a proper temp readout.

David Miles.
 
Top