Page 1 of 1

DS1820 + DS18B20

Posted: Mon Jun 10, 2019 8:38 pm
by jgu1
Hi Team!

A wish. I have played around with the different examble with DS1820 an DS 18B20 (Ben´s and Martin´s) here in forum. They work fine as long the temperature is above 0.00 Degree, but as soon I go under 0 Degree I get some strange value in the display Eks. -3.-10 should be -3.10

I would be nice with a component in the "drop down list" (Just like the DHT22 and the SHT21 wich work fine) for the DS18 device, and maybe if it is possible in properties to change between the B and the none B type and working with Pic and Arduino devices.

Unfortunately I am not able to create one, sorry :( . Hope some can and will spend some time for that.


Br Jorgen

Re: DS1820 + DS18B20

Posted: Mon Jun 10, 2019 9:47 pm
by mnf
Looks like an error in the display routine . Can you post your code?

Martin

Re: DS1820 + DS18B20

Posted: Tue Jun 11, 2019 5:16 pm
by jgu1
Hi Martin!

Hereby two Programs. One for the DS1820 and one for DS18B20 It is some programs taken from here in fora, I think one of Ben´s and one of Martin´s

Common for both of them, they work both perfect as long the temperatur is over 0 Degree. But under eks. -2.-23
You are right, maybe something with display readout.

In these test, I use LDC, but my plan is to use them in a project in your nice MAX7219 component. :D

Hope you can help, please.

Br Jorgen

Re: DS1820 + DS18B20

Posted: Tue Jun 11, 2019 10:01 pm
by mnf
Hi Jorgen

I think the problem is here:
Capture.PNG
(6.7 KiB) Downloaded 2283 times
Temp2 is getting the same sign as temp - which works AOK with +ve numbers (as the '+' isn;t displayed)

The simplest fix should be to use the 'abs' function:

Code: Select all

temp2 = abs((temp mod 2) * 5)
- but I've only FC7 here and it doesn't seem to support it so:

Code: Select all

if temp2<0 then temp2 = 0-temp2
Though fabs night work too??

Martin

Re: DS1820 + DS18B20

Posted: Wed Jun 12, 2019 5:41 pm
by jgu1
Hi Martin!

Sorry it doesn't work. :(


Br Jorgen

Re: DS1820 + DS18B20

Posted: Wed Jun 12, 2019 7:06 pm
by medelec35
I created a flowchart here a fair while ago that displayed temperatures below 0.
Maybe you can use the formula in that within your flowchart?

Re: DS1820 + DS18B20

Posted: Wed Jun 12, 2019 7:52 pm
by jgu1
Hi Martin!

Thank you. For test, I change the device to an Arduino Mega and an I2c display, perfect, working so nice and perfect :lol:

Thank´s. have a nice evening.

Br Jorgen

Re: DS1820 + DS18B20

Posted: Wed Jun 12, 2019 8:53 pm
by medelec35
Hi Jorgen,
Glad you now have a working version.
Thanks for letting us know. :)