I didn’t have any problems with this temperature sensor on Raspberry, but on Rock there is problem getting it to work. Mostly the sensor is not visible even after loading the kernel modules.
I have Python3 and connected the sensor, then gone through commands:
apt install python-pip
pip install w1thermsensor
Then I’ve rebooted the board, modprobe’d two modules but nothing seems to be in folder /sys/bus/w1/devices/.
But you will need to use Armbian with a modern kernel Rockpi 4 - Armbian which is WIP. I do agree this enabling is not as simple as on other boards (Allwiner for exmple) where w1, uart, … is enabled via menu driven armbian-config utility. When you are done that, you can start thinking about upper level/python.
However it changes its id (there are even few folders) and I can’t read the temperature.
There is not temperature file anywhere…
Not sure if it is correctly connected, but it is connected as for Rasp Pi.
Should I change the connection pins or add argument to the /boot/hw_intfc.conf file? intfc:dtoverlay=w1-gpio4-30 is already in the file.
Can you please share how the wires should be connected to the GPIO?
My sensor’s w1_slave file is visible but does hang up the shell when trying to open it with mc viewer (cat also does not work).
Python script returns that the sensor is not ready.
I am getting errors:
Traceback (most recent call last):
File "./temp2.py", line 5, in <module>
print("Sensor %s has temperature %.2f" % (sensor.id, sensor.get_temperature()))
File "/usr/local/lib/python2.7/dist-packages/w1thermsensor/core.py", line 255, in get_temperature
return factor(self.raw_sensor_value)
File "/usr/local/lib/python2.7/dist-packages/w1thermsensor/core.py", line 210, in raw_sensor_value
raise SensorNotReadyError(self)
w1thermsensor.errors.SensorNotReadyError: Sensor 01186bce26ff is not yet ready to read temperature
Pins:
left to GND #39
middle to GPIO4_D6 #37 (4.7kOhm resistor is connecting middle to right)
right to +3.3V #1
#!/usr/bin/env python2
from w1thermsensor import W1ThermSensor
for sensor in W1ThermSensor.get_available_sensors():
print("Sensor %s has temperature %.2f" % (sensor.id, sensor.get_temperature()))
which, when the sensor is visible in /sys/bus/w1/devices/, gives:
Traceback (most recent call last):
File "./temp2.py", line 5, in <module>
print("Sensor %s has temperature %.2f" % (sensor.id, sensor.get_temperature()))
File "/usr/local/lib/python2.7/dist-packages/w1thermsensor/core.py", line 255, in get_temperature
return factor(self.raw_sensor_value)
File "/usr/local/lib/python2.7/dist-packages/w1thermsensor/core.py", line 210, in raw_sensor_value
raise SensorNotReadyError(self)
w1thermsensor.errors.SensorNotReadyError: Sensor 01186bce26ff is not yet ready to read temperature
Sensor sometimes appears, sometimes disappears. What can be wrong here?