readtemp ->serout

barbababa

Member
Hello all!

I am using 08M2 and the DS18B20 in PICAXE Experimenter Kit (AXE091U)to read ad display temperature.
With this code:

Code:
Temp:

readtemp C.1,b11 'Read temp high resoluti

serout C.2,N2400,(254,203) ; move to start+14 of second line
serout C.2,N2400,(#b11)
serout C.2,N2400,(254,206) ; move to start+14 of second line
pause 10
serout C.2,N2400,(%11011111) ; move to start+13 of second line
pause 10
serout C.2,N2400,("C") ; move to start+13 of second line
pause 10
return
I am getting displayed readings of 63 degrees.
Is this the internal temperature of the DS18B20 or something completely wrong.
I was expecting room temperature...

thanks.
 

hippy

Ex-Staff (retired)
Put a DEBUG or SERTXD after the READTEMP command so you can see exactly what value you are getting in 'b11'.

You are correct that with READTEMP the value in the variable should represent the actual room temperature in degrees C.
 

westaust55

Moderator
@barbababa,

It is also a good practice to try and ensure that your comments are correct.
Although relatively minor in your code example they may confuse some people.

It can also help to indent code to reflect the level of the code so only labels are in the left most column.

Code:
Temp:

	readtemp C.1,b11 'Read temp high resolution

	serout C.2,N2400,(254,203) ; move to start+11 of second line
	serout C.2,N2400,(#b11)
	serout C.2,N2400,(254,206) ; move to start+14 of second line
	pause 10
	serout C.2,N2400,(%11011111) ; display the raised "o" for degrees
	pause 10
	serout C.2,N2400,("C") ; display "C" for degrees Celcius
	pause 10
	return
Finally, most LCD displays do not require a pause after every SEROUT command.
Only those that take a more extended time such as a reset, clearing the screen, displaying a pre-defined message.

The value "65" suggests the DS18B20 is doing something.
Typically, a value of "85" can indicate that the DS18B20 has not performed the temperature conversion and is still at power-up state.
 

barbababa

Member
Hi!
Sorry for the wrong comments, i must have changed the code along the way...
I put debug after readtemp, and i got:

b11 64 $40 %01000000 '@'

but what does this mean?
 

nick12ab

Senior Member
The different numbers following b11 are just different formats for 64: decimal (64), hexadecimal ($40), binary (%01000000) and ASCII (@).

What happens if you try readtemp12?
 

barbababa

Member
So...

Code:
readtemp12 C.1,w2
serout C.2,N2400,(#w2)
displayes 1035

With...

[/CODE]
readtemp12 C.1,w2
BINTOASCII w2,b13,b14,b15,b16,b17
serout C.2,N2400,(b13)
serout C.2,N2400,(b14)
serout C.2,N2400,(b15)
serout C.2,N2400,(b16)
serout C.2,N2400,(b17)[/CODE]

it displayes 01032

having a pause 1000
after the readtemp does not help...
 

westaust55

Moderator
In simple terms 1032 / 16 = 64.5 degC

The resolution with READTEMP12 is 0.0625 degrees.

Does the result change if you hold the DS18B20?

Are you sure that you have a DS18B20 (ie not a DS1820, DS18S20 or other variant)?
 

barbababa

Member
I think 63 degrees is the right temperature.
I put the readtemp in a loop statement and
"squeezed" the DS18B20 in between my fingers.
Then the temperature started to go down to a final temperature of 43....

weird.
 

hippy

Ex-Staff (retired)
What's the point with this temperature measurement using DS18B20 if it gets so hot by its own?!?!?!?
DS18B20's do not usually get hot by themselves, and if it were 63C you would probably have noticed that when you squeezed it.

Are you using the DS18B20 included on the AXE091U board or your own wired on breadboard ?

Assuming it's simply an 08M2 in the appropriate socket, wire link from leg 6 ( pin C.1 ) to the DS18B20 temperature connection it's hard to see what could possibly be going wrong. Perhaps disconnect everything else from the board ( including LCD ) and post a photo of what you have which shows all the connections made.
 

lbenson

Senior Member
The DS18B20 will only get hot "on its own" if it is miswired (and then I think it's not very likely to be giving you accurate readings). It would feel very hot if it were 63 degrees C--does it?
 

barbababa

Member
HI!

You were right!

I measured the current going through the LCD and it was as high as ~0.3 A!
The resistance between +/- poles was only ~5 ohms when the LCD controlling 18M2 was connected
and 0.5Mohms when disconnected.
I guess i have to order new 18M2's....

thanks.
 

Technical

Technical Support
Staff member
If it gets hot to touch by itself you have not wired it correctly - and damaged it!

However are you sure it is a DS18B20 - it must have B (not S) in the middle.
 

barbababa

Member
Hello!

I am using the DS18B20, which is mounted in the PICAXE Experimenter Kit (AXE091U). I don't see any way to
connect it wrongly. I had the TMP pin connected to the 08M2 pin 6 C.1 .
I have to order some new 18M2 and fix the LCD, and check this again.

thanks again for all replies!
 

inglewoodpete

Senior Member
If something is faulty then replacing the 18M2 may just extend the damage. From what I've read in this thread, the cause of the problem does not appear to have been identified and rectified.

If the DS18B20 is getting very hot to touch and is giving a reading of 64C, it suggest that the sensor is actually working, although something else is clearly wrong.

300mA through the LCD module is quite high. Is the LCD module working at all? Does it have a backlight? If so, are you using current limiting resistors for the backlight?

Finally, in PICAXE language, we prefer to say: 08M2 Leg 6 Pin C.1.
 

westaust55

Moderator
It may still be worthwhile posting a clear photo of all your connections on The dev board so folks can try to verify the wiring.
What voltage are you applying to the circuit?
 

hippy

Ex-Staff (retired)
Also, does the earlier test program now give the correct / expected results with the LCD disconnected ?
 

barbababa

Member
Hello again!

I changed the power supply and now the debug command gives the right 23 degrees without any other connections in the breadboard.
But i still measure 0.8 A going through the LCD when 18M2 is connected and 30mA without.
So i guess i still have to change that 18M2. Thank you all for support and i am very sorry for wasting your time for
silly problem like this...

Cheers,
toni

p.s. nice command this debug. i wish i had known it earlier...
 

inglewoodpete

Senior Member
Your 18M2 may not be at fault. Is it getting really hot, really quickly when you plug it in? 500mA at 5v is 2.5 Watts.

If it is not getting hot, it is probably not at fault.
 

barbababa

Member
I was unable to find any typical power consumption values for the HD44780 1602 LCD Module Display.
Does anyone know how much current these consume?

Also i have the backlight of the LCD (legs 15 16) connected to the same power source as the LCD (legs 1 2).
Is this a good idea?
 

westaust55

Moderator
i have the backlight of the LCD (legs 15 16) connected to the same power source as the LCD (legs 1 2).
Is this a good idea?
It depends upon how "robust" your power source is and the current draw of the backlight.
I generally power the LCD module and the backlight from the same source - but typicvally have a 7805 5 Volt 1 Amp voltage regulator with sufficient capacitors as the power source.
I have LCD modules which have a single hi-brightness LED and the current is <= 20mA yet others have an array of LEDs and the max current can be around 200 mA.
If using the same supply enusre that you have some electro/tantalum capacitors as an energy reservoir against the high current switching and a decoupling capacitor (100 nF) to filter out high frequency noise caused by switching of transistors within the IC(s).

Unless the LCD module has sufficient series resistors with the backlight you will need some external series resistance to limit the backlight current draw.
 

nick12ab

Senior Member
I was unable to find any typical power consumption values for the HD44780 1602 LCD Module Display.
Does anyone know how much current these consume?
N28AZ.pdf - This datasheet for a large module says maximum 1mA so consumption will normally be much less than that without the backlight.
 

inglewoodpete

Senior Member
N28AZ.pdf - This datasheet for a large module says maximum 1mA so consumption will normally be much less than that without the backlight.
Nick, Is that datasheet the correct one for barbababa's LCD? There is a lot of difference in the configurations of LCD backlights. Your sheet says it has a several series-connected pairs of LEDs connected in parallel, with a total backlight current around 200mA with 5v directly connected. I have an LCD with backlight that needs a series resistor to limit the current to 80mA.

Toni, Can you post a link the the data sheet for your specific 16x2 LCD? Can you disconnect the backlight supply and check the current?
 

westaust55

Moderator
N28AZ.pdf - This datasheet for a large module says maximum 1mA so consumption will normally be much less than that without the backlight.
For the N28AZ which you linked to, on page 6 for the backlight it states:
Backlight Current (I) 192 mA and indicates a 24x2 LED array.
On Page 14, the Idd1 and Idd2 at 0.7 mA and 0,4 mA respectively are just the controller electronics and LCD itself - not the backlight.
 

nick12ab

Senior Member
On Page 14, the Idd1 and Idd2 at 0.7 mA and 0,4 mA respectively are just the controller electronics and LCD itself - not the backlight.
"maximum 1mA so consumption will normally be much less than that without the backlight."

I won't make a fuss, though. I should have put that bold bit straight after the 1mA.
 
Top