I would like to read temperature from a LM75 using the ATtiny85 running a core by SpenceKonde and utilizing the TinyWireM library.

My Logic Analyzer does not pick up any I2C communication, when I connect it to an Arduino Nano, it works fine. On the Nano, there is no need for TinyWireM so that's a big difference.

Therefore I conclude that the ATtiny85 is not speaking the right I2C slang to the device.

I also use SoftwareSerial and this works fine. It is visible on the Logic Analyzer.

enter image description here

The LM75 library is not made for ATtiny or TinyWireM, I replace the Wire references in-place by TinyWireM reference.

Should it be possible to 'just' replace Wire by TineWireM in the library and could I expect some meaningful data this way?

[updated code]

#include <Arduino.h>
#include <TinyWireM.h>
#include <LM75.h>
#include <SoftwareSerial.h>


LM75 sensor;

void setup() {

void loop() {
  • Could you post your code? – Gerben Apr 24 '17 at 18:03
  • I have added te code I use to test – Thijs Apr 24 '17 at 21:12
  • 1
    Looks like the setup() is missing a call to TinyWireM.begin(). Also do not forget pullup resistors. – Mikael Patel Apr 24 '17 at 21:38
  • The TinyWireM.begin() is part of the library and I have the pull-ups, this setup works on an Arduino Nano – Thijs Apr 25 '17 at 8:27
  • 1
    i2c is fairly easy to implement, either hardware or software. so you may find it beneficial to just write your own. – dannyf May 6 '17 at 11:50

The current ATtiny core includes a Wire library for the USI hardware used in the Tinys. This way you don't need to modify the LM75 library which is error prone.

  • Thanks, that piece of the code went missing when I edited the question (6 months ago). Problem remains. – Thijs Oct 26 '17 at 15:57
  • Might help if you update the code to what you're actually using. Keep in mind that you won't see anything in the resolution you've chosen in the logic analyzer as I2C is about 50 times faster than the serial. – Pylon Oct 27 '17 at 17:14
  • I updated the six months old question you answered with the code I might have used back then. But please tell me more about the speed of I2C. – Thijs Oct 27 '17 at 20:43
  • Hi and welcome to the Arduino SE community. Please expand on your answer. You have identified some issues but please update your answer with how to resolve these issues. For example you could demonstrate the solution with some snippets of code and an explaination of how it fixes the problems the OP is having. – sa_leinad Nov 7 '17 at 7:20

This is an old post I know but hopefully this information is helpful to someone. I modified the lm75 library by replacing all instances of Wire with TinyWire and as above no go, but turns out a 10k pull up on SCL / SDA is a necessity for the attiny 85. For whatever reason i2c works fine on an arduino UNO without pull ups but not on an attiny 85. So in short, add pull up resistors and it works. Bonus potato grade picture of attiny, LM75 and display module showing temperature.

enter image description here

  • hi Tom, thanks for the reply and the great picture :D could you please share information about your code? what library and core you used for example. I’ll try it out but I think I had the pullups back then.. – Thijs Feb 17 at 6:24
  • I pretty much just used the lm75 and TinyWireM library, made a copy of the lm75 library, renamed it to lm75tiny and replaced any instances of Wire with TinyWireM. Ended up with this: #include <TinyWireM.h> #include <lm75tiny.h> TempI2C_LM75 termo = TempI2C_LM75(0x49,TempI2C_LM75::nine_bits); Then read temperature like so: int temp = termo.getTemp(); Only other gotcha is the address of the lm75 needs to be confirmed and updated for whatever sensor you are using. I think the default is 0x48 but my sensor was 0x49. – Tom Feb 18 at 9:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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