Go Down

Topic: Arduino Uno ds18b20 and sure 2416 dor matrix display (Read 2408 times) previous topic - next topic

danielb

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

PaulS

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.

danielb

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 ?

danielb

this is the full code

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


johncc

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?

danielb

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

danielb

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);
 

johncc

That does look much closer to being right.

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

danielb

ahhhh so  what i should change ??

float temperature = 0 ??


thanks in advance

johncc

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

danielb

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 ?

johncc

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

danielb

  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

johncc

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?

danielb

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

Go Up