Pages: [1] 2 3   Go Down
Author Topic: Arduino Uno ds18b20 and sure 2416 dor matrix display  (Read 1948 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 31
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everybody
I'm Daniele from Italy and I'm happy to be here.

I'm tryng to dispaly a temperature by this display ( i've read everything )
but I've got a big problem

I see on dispaly      e127 °C
and if i unplug +5 volts to ds18b20 it become 0 27 °C

this is the code that I wrote

Serial.println(temperature,DEC);
      char buffer[4];
      itoa(temperature,buffer,10);
      ht1632_putchar(0 , 0, buffer[0]);
      ht1632_putchar(6 , 0, buffer[1]);
      ht1632_putchar(12 , 0, buffer[2]);
      ht1632_putchar(18 , 0, buffer[3]);
      ht1632_puttinychar(26 , 0, 'o');
      ht1632_putchar(33 , 0, 'C');
      delay(150);

any idea ???

thank you so much

Daniele
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 615
Posts: 49388
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
and if i unplug +5 volts to ds18b20 it become 0 27 °C
Why does that surprise you? If the sensor isn't powered, it can't function. If it can't function, you really can't expect to read a temperature from it, can you?

Of course, it's hard to tell much from your snippet of code.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 31
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thank you so much !

of course that if the sensor isn't powered it doesn't works !

i try it to be sure that the input pin was correct and the buffer was filled by data !

I shoult post full code ?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 31
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

this is the full code

I use pin 13 of atmel ( input 7 of arduino )


* 2416 temperature.txt (15.08 KB - downloaded 30 times.)
Logged

Temple, Texas
Offline Offline
Sr. Member
****
Karma: 14
Posts: 361
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think there needs to be a call to "sensors.requestTemperatures()" and "sensors.getTemp..." in there.  Did you look at the sample code for DallasTemperature?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 31
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks for your answer

"sensors.requestTemperatures()"  ( i forgot to write it on here but is present on sketch )

what and where else exatly ?

char temperature = 0 ;

sensors.requestTemperatures();

Serial.println(temperature,DEC);

      char buffer[4];
      itoa(temperature,buffer,10);
      ht1632_putchar(0 , 0, buffer[0]);
      ht1632_putchar(6 , 0, buffer[1]);
      ht1632_putchar(12 , 0, buffer[2]);
      ht1632_putchar(18 , 0, buffer[3]);
      ht1632_puttinychar(26 , 0, 'o');
      ht1632_putchar(33 , 0, 'C');
      delay(150);


thanks
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 31
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

sorry for multiple post

like this ??

char temperature = 0 ;
sensors.requestTemperatures();

temperature = (sensors.getTempCByIndex(0));


Serial.println(temperature,DEC);
      char buffer[4];
      itoa(temperature,buffer,10);
      ht1632_putchar(0 , 0, buffer[0]);
      ht1632_putchar(6 , 0, buffer[1]);
      ht1632_putchar(12 , 0, buffer[2]);
      ht1632_putchar(18 , 0, buffer[3]);
      ht1632_puttinychar(26 , 0, 'o');
      ht1632_putchar(33 , 0, 'C');
      delay(150);
 
Logged

Temple, Texas
Offline Offline
Sr. Member
****
Karma: 14
Posts: 361
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That does look much closer to being right.

getTempCByIndex() does not return a char though, it returns float. 
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 31
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ahhhh so  what i should change ??

float temperature = 0 ??


thanks in advance
Logged

Temple, Texas
Offline Offline
Sr. Member
****
Karma: 14
Posts: 361
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Actually no, sorry, you were better off with the char, you just won't be getting fractional degrees.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 31
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't understand.
I' can't convert ?

What's the problem with decimal ?

ie I can't show on this dispaly 22,5 °C ?
Logged

Temple, Texas
Offline Offline
Sr. Member
****
Karma: 14
Posts: 361
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think at this point you should just try it and see.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 31
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

  float temperature=0 ;
sensors.requestTemperatures();

temperature = (sensors.getTempCByIndex(0));


Serial.println(temperature,DEC);
      char buffer[4];
      itoa(temperature,buffer,10);
      ht1632_putchar(0 , 0, buffer[0]);
      ht1632_putchar(6 , 0, buffer[1]);
      ht1632_putchar(12 , 0, buffer[2]);
      ht1632_putchar(18 , 0, buffer[3]);
      ht1632_puttinychar(26 , 0, 'o');
      ht1632_putchar(33 , 0, 'C');
      delay(150);


do not works... e127 °C show
Logged

Temple, Texas
Offline Offline
Sr. Member
****
Karma: 14
Posts: 361
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Which part do you suppose is not working-- the part that reads the temperature from the sensor, or the part that displays the temperature on the LCD screen?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 31
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think that inside buffer there is nothing becouse it write 127. The ds 18b20 works perfectly becouse with lcd skecht show the correct temperature
Logged

Pages: [1] 2 3   Go Up
Jump to: