EnviroDIY / Arduino-SDI-12

An Arduino library for SDI-12 communication with a wide variety of environmental sensors. This library provides a general software solution, without requiring any additional hardware.
https://github.com/EnviroDIY/Arduino-SDI-12/wiki
BSD 3-Clause "New" or "Revised" License
158 stars 100 forks source link

Update SDI12_boards.cpp #72

Closed gabbas1 closed 3 years ago

gabbas1 commented 3 years ago

Hey,

I think i found another bug in your lib using the ATtiny(85).

You set the prescaler for the timer on the register TCCR1A (chapter 13 in Attiny complete datasheet). This only works, when your Attiny is in the "ATtiny15 compatible mode" (can be set with fuses). If your Tiny is not in that mode (and I think it usually isnt) the prescaler is then wrong and the bits are banged way to fast. Instead you need to write to the TCCR1 register (chapter 12 in Attiny complete datasheet). Then the 1200 baud rate is right and the sensor is responding. (Tested with Attiny85@8Mhz)

With best regards

SRGDamia1 commented 3 years ago

I'll take your word for it. I've never tested with the Tiny.