I did a very similar configuration a while back under the Arduino IDE, and everything was rock-solid.
My configuration:
Wemos D1 Mini
DS1631+ i2c temp sensor (https://datasheets.maximintegrated.com/ ... DS1731.pdf)
4.7k pull-ups and a .1uF cap near the sensor
Code: Select all
import time
import machine
from machine import Pin, I2C
i2c = I2C(scl=Pin(5), sda=Pin(4), freq=1000) # pins d1 for clk and D2 for sda
time.sleep(2)
i2c.writeto(76,b'\x51') #set advanced temp sense to startup
def read_advanced_temp():
i2c.writeto(76,b'\xAA')
temp = i2c.readfrom(76,2)
print(temp)
while True:
time.sleep(3)
read_advanced_temp()
Code: Select all
b'\x1a\xd0'
b'\x1b\x80'
b'\x1c0'
b'\x1c\xb0'
b'\x1c\xa0'