3

I'm trying to read the temperature of a DS18B20 with my ATTiny85 - but I'm getting rubbish data :D

I should have gotten ~22 degrees, but I'm getting 129! I followed this tutorial i found here, but maybe there is something funky with the ATTiny85?

5
  • 1
    Do you have a 4K7 Ohm pullup resistor between the DQ and 5v pins of the DS18B20?
    – Omer
    Dec 28, 2014 at 13:00
  • 1
    Hi Omer! I'm using a 4k7 between DQ and 5v source. Does it need to be the 5v pin of the ds18b20? It's on my breadboard so just attached it to the power rail on the side, and not the same as the 5v pin for the sensor
    – Jason94
    Dec 28, 2014 at 16:22
  • it needs to be between the ds18b20's 5v and DQ.
    – Omer
    Dec 28, 2014 at 16:48
  • Try to connect the VDD-pin of the sensor to +5V instead. This makes sampling easier.
    – Ariser
    Dec 28, 2014 at 17:35
  • I just rewired to my UNO and it works like a charm. I add a blinking led to the attiny, so I know its doing something :P it's running on 8mhz, does it matter?
    – Jason94
    Dec 28, 2014 at 21:41

1 Answer 1

-1

I would suggest it has to be the clock speed or memory. Whilst you can program the ATTiny85 with the Arduino IDE, it will take up quite a lot of its flash memory. There is a thread on the Arduino form here which might help pinpointing the issue.

One solution is to write it in AVR-C but I don't know if there is an easy way (or a library) for the 1-wire. I think you'll have to do it with the 1-Wire library alone as the DallasTemperature library is too much for the 8Kb of memory you have to play with.

Please feedback any breakthroughs you make as this is a nice project, the ATTiny is an awesome little chip...

5
  • 2
    The code in the link that Jason94 attached to his question works perfectly with ATtiny85, I used it many times. No need to re-implement OneWire in pure AVR-C :)
    – Omer
    Dec 29, 2014 at 11:32
  • Apologies for my assumptions. Just to clarify @Omer, you can run the ATtiny85 with both the 1wire and DallasTemperature libraries (and of course, the sketch provided in the original post)? It might be time I got the breadboard out again ;)
    – Jelby-John
    Dec 29, 2014 at 13:42
  • Yes. leaves almost no room for other code. Don't forget to make sure the ld.exe is fixed, to enable 8kb sketches (otherwise it will allow only 4kb) - github.com/TCWORLD/ATTinyCore/tree/master/…
    – Omer
    Dec 29, 2014 at 14:05
  • Thanks for all the replies! I've found dozends of project where the ATTiny does one or the other, but not both... so maybe there are memory issues. Have some ATTiny84, but they have the same spec but more pins so would not do me any good... sad
    – Jason94
    Dec 29, 2014 at 20:09
  • @Jason94 was this issue solved? Aug 26, 2015 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.