DS1820 + DS18B20

Moderator: Benj

Post Reply
jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

DS1820 + DS18B20

Post 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

mnf
Valued Contributor
Valued Contributor
Posts: 1188
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Re: DS1820 + DS18B20

Post by mnf »

Looks like an error in the display routine . Can you post your code?

Martin

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: DS1820 + DS18B20

Post 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
Attachments
SingleOneWireDS1820Arduino.fcfx
(11.79 KiB) Downloaded 210 times
1. Single OneWire DS18B20ArduinoMega.fcfx
(12.46 KiB) Downloaded 205 times

mnf
Valued Contributor
Valued Contributor
Posts: 1188
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Re: DS1820 + DS18B20

Post 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

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: DS1820 + DS18B20

Post by jgu1 »

Hi Martin!

Sorry it doesn't work. :(


Br Jorgen

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: DS1820 + DS18B20

Post 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?
Martin

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: DS1820 + DS18B20

Post 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

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: DS1820 + DS18B20

Post by medelec35 »

Hi Jorgen,
Glad you now have a working version.
Thanks for letting us know. :)
Martin

Post Reply