ds18b20 on attiny 1. series (3216, 1614, etc.) not works

Hi. My DS18B20 works on atmega328p (three wires). When I wired ds18b20 on attiny 1. series, not works. Why? I used same library for ds18b20 (https://www.milesburton.com/Dallas_Temperature_Control_Library). I used also example from OneWire on DS18b20, also not works (on attiny328p this example works right)... Can you help me? Thanks.

Probably not defined properly in your code. Please post your code and a schematic, not a frizzy drawing and we will be able to help you.

This is scheme my circuit:

This is my code in Arduino IDE - it is modify “simple” example from library. On LCD display “error”:

// Include the libraries we need
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x21,16,2); // set address & 16 chars / 2 lines

// Data wire is plugged into port 2 on the Arduino
#define ONE_WIRE_BUS 14

// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);


  • The setup function. We only start the sensors here
    void setup(void)
    lcd.begin(); // initialize the lcd
    lcd.clear(); // Print a message to the LCD.

// Start up the library


  • Main function, get and show the temperature
    void loop(void)
    // call sensors.requestTemperatures() to issue a global temperature
    // request to all devices on the bus
    sensors.requestTemperatures(); // Send the command to get temperatures
    // After we got the temperatures, we can print them here.
    // We use the function ByIndex, and as an example get the temperature from the first sensor only.
    float tempC = sensors.getTempCByIndex(0);

// Check if reading was successful
lcd.setCursor(0, 0);
lcd.setCursor(0, 0);

LCD works right. All another equipment throught I2C works right. Only this DS18B20 not works. I have pin "14" right (it is pin 17 on SOIC20). I try all another pins also. Ucc on DS18B20 rights. I think, probably problem is on 1 wire bus. Attiny3216 works on default clock. I think, 3,33333 MHz. Prescaler is 6, default is 20 MHz internal. When I try 1000x function delaymilisecond(1000) on connected LED, approximately is 1 second. I do not know, where is mistake.

I found a library that works on AVR-1: GitHub - pstolarz/OneWireNg: Arduino 1-wire service library. OneWire compatible. Dallas thermometers support.
Everything is alright. :slight_smile: