Anyone having issues with READTEMP and DS18B20 on a 18M2?

johndimo

New Member
I was testing some stuff out on a 08M I had and everything worked great. It was reading temps as it should.

I just got an 18M2 this past week and tried to use the readtemp command along with the ds18b20 temp sensor. All I get is 85*C out of it all the time.

I took out the 18m2 from my breadboard, plug in the old 08m I had, changed a few values around in the code and everything works as it should.

So identical circuit, 08m works, 18m2 does not. I'm not sure where to go from here. Any suggestions?

code I used for the 08m was:
readtemp 4,w0
debug

code i used for the 18m2 was:
readtemp c.6,w0
debug

I used a simple pushbutton to call up the code above so that it wasn't running continuous.

The only thing I noticed was that it seemed to display the values in the debug screen much faster for the 18m2 than for the 08m. I thought that the readtemp command had an internal pause to compensate for the 750ms conversion time? Could this be the issue?

Could this be a bug with the 18m2?
 

hippy

Technical Support
Staff member
Could this be related to 'DS18B20 manufacturing issues' which bit a few years ago ? Perhaps not; where was it bought from and when did you buy it ?

I would agree, works on 08M, should work on 18M2. Perhaps there's something subtly different in the two circuits and/or voltage levels. What is the operating voltage, what's the full circuit being used, how far away physically is the DS18B20 ?

I'm not seeing any problems with my 18M2 and DS18B20 on an AXE091
 

lbenson

Senior Member
As I recall, 85C means something is not connected properly--power, ground, pullup, dataline--I don't remember which.

You do know that C.6 is not the same as pin 4 on the 08M?

Also (not the problem) for READTEMP you can use a byte register (for example, b0) instead of a word register (w0).
 
Last edited:

johndimo

New Member
I used word registers because of the conversion math to fahrenheit. I didn't want to run into issues with numbers getting to big.

As far as the circuits. A have a large breadboard and both were installed on it. Same power supply, same sensor. Both chips were running different code to compensate for the different naming schemes. I would simply move a jumper connected to the data line on the sensor to one chip, ran it to see the temp in the debug screen and then plug it into the other chip and ran it again. In the debug screen, the 08m would return the correct value and the 18m2 would return only 85.

It's confusing. I even tried modifying the code for the 18m2 to use a different pin. I have 3 sensors and all produce the same results. I wish I had another 18m2 to compare against but I don't.

Is it possible I got one with buggy firmware?

I even tried using the readtemp12 command and same thing. No change in reported temperature when I hold the sensor to warm it up some.

The main reason I'm trying to use the 18m2 is because it is better suited for a serial enabled lcd screen I have lying around which runs at a baud rate of 9600. The end result I was looking for is to be able to display temp data on the lcd screen.

I'm thinking I may have to order 18m2 so I can have more than 1 in my inventory of parts.
 
Last edited:

MartinM57

Moderator
...and the 4k7 pullup resistor needed for correct operation of a DS18B20 is in place on the input pin of each PICAXE irrespective of the "data line jumper" position?

Is it possible I got one with buggy firmware?
No (well some chance I suppose, but infinitesimally small)
 

johndimo

New Member
...and the 4k7 pullup resistor needed for correct operation of a DS18B20 is in place on the input pin of each PICAXE irrespective of the "data line jumper" position?

No (well some chance I suppose, but infinitesimally small)
Yes. I have the pullup resistor. It's plugged into the same row on the breadboard and goes to vcc. That way I only need one resistor and only have to move the jumper from chip to chip for testing. I have the sensor tied to only one chip at a time.

VCC is regulated at 5V.
 

Technical

Technical Support
Staff member
Check carefully the V+ line connection from the DS18B20. This result is often caused by the DS18B20 not receiving sufficient power to operate correctly.

M2 and X2 parts do readtemp conversions quicker than the M parts, as they continuously poll the device to 'ask it' when it has finished the conversion. The M parts simply wait 750ms regardless.
 
Top