ATtiny84 and DS18B20 LoRa Node

Marco asked me if it was possible to connect a DS18B20 temperature sensor to my ATtin84 LoRa Node. Challenge accepted and changed the code for using the DS18B20 node. This post is for explaining the this configuration and has a link to the code.

First prototype with open DS18B20 sensor plugged in
DS18B20 schematics

The DS18B20 is an onewire temperature sensor. I use the DallasTemperature Arduino Library for reading the sensor. The Data sensor is connected to ATtiny pin PA7 = Arduino pin 7 in the software.


The code for the sensor can be found here: The code is programmed and compiled with the PlatformIO IDE. With this code you can read 1 sensor. It should be possible to read more sensors with the DallasTemperature library: Now reading getTempCByIndex(0). You should be able to read next index. Remember to send 2 extra bytes to your LoRa backend at “// move into bytebuffer” I did not test with multiple sensors.


I made a testmodel with a shielded DS18B20 sensor, so I can also measure liquid temperature. The electronics is compacted in a Lab-tube.

In my test the first measurements after booting the node give a 85.0 Celsius temperature.

Node with sensor and CR2 battery
All waterproof 🙂

I measured the voltage and current in sleep mode. The values are an indication.

9 thoughts on “ATtiny84 and DS18B20 LoRa Node

  1. Marco

    Thanks Leo for your effort, I use 18650 lithium ion battery for my nodes and fully charged the voltage is actually too high for the RFM95. (one of my nodes, died).
    That is why I made a simple LDO circuit with the HT7333 and 2 capacitors (SMD) on a 10x5mm prototype pcb which is glued to the battery holder with a drop of hotglue. As a result, the current in sleep mode increases to approximately 6uA
    I have a 1.50m cable on the DS18B20 and had problems with the correct readout, after replacing the 4k7 with a 2k2 the correct temperature value was given.

  2. joba1

    @Leo: what happened to STM?
    @Marco: 6uA is good for an LDO, but still bad for battery life. How about just using a diode in series with the battery? Should drop voltage by 0.7V to safe values.

  3. Leo Post author

    Hello Joachim,

    I have made my third STM32F103 Bluepill mini board, with minimal components.
    I will continue in the holidays on Christmas with testing and then make a LoraWan Node with the LIMC library.
    I have already done that with the Bluepill boards but they use to much power.
    My goal is to use the STM32L051 with low power consumption and reduce the current to about 1uA in sleep modus.
    But I will take some time to learn to program this controller and use the low power options in the right way.

    With kind regards,


  4. Richard

    Hi Leo,
    I was building a LoraWan node with DS18B20 and arduino mini for checking my pond temperature until i found your solution (much cleaner and smaller). I have one question why are you using a different power source instead of the 675 cells?

    btw thanks for sharing your PCB files

  5. Leo Post author

    Hello Richard,

    Great, I hope you have fun with it. I do not use the 675 cell because that was only to test it for very small casing, for example the weather casing.
    The 675 cells only last for 3-4 month in my tests. Now I am testing with Alkaline cell type LR44/A76/V13GA. The have the same size of the 675 cells.
    The reason I used the 675 cells is that I could buy them for a few euro’s per 8.
    The LR44 does a beter job I think.

    I also test some other batteries with my ATtiny device, I do not have results on them all.
    For the longes time you can use the LS14250 (small) and LS14500 (longer), they did not stopped yet, and I started the LoRa project 2 years ago.
    I have a LS14500 for almost 2 years in the refrigerator (-20 degrees) every 5 minutes sending data.

    Merry Christmas!


  6. Richard

    Thanks for your feedback and sharing your status regarding power sources. I use LS14250 for my z-wave nodes so when i receive my hardware i will give it a try.

    enjoy the Christmas

  7. Andreas

    Hello Leo,

    Great work! I finaly got my test installation running, but I am too stupid to get the payload decoder at ttn working. Could you please tell me how you set up the payload decoder?

    Thanks in advance and best regards!


  8. Leo Post author

    Hello Andreas,

    Done this in a personal mail.


Leave a Reply

Your email address will not be published. Required fields are marked *