Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
erolfr
@erolfr
is this a normal time? Or I do something wrong
Timo Furrer
@timofurrer
Can you check how long it takes to read the sensor file directly?
erolfr
@erolfr
its an raspi 3b+
Timo Furrer
@timofurrer
Do you know where the sensor files are?
Can you measure how long it takes to do sudo on your raspi?
time sudo echo "Hello"
erolfr
@erolfr

time cat /sys/bus/w1/devices/28-0416c21372ff
cat: /sys/bus/w1/devices/28-0416c21372ff: Ist ein Verzeichnis

real 0m0,008s
user 0m0,001s
sys 0m0,007s

pi@raspberrypi:~ $ time sudo echo "Hello"
Hello

real 0m0,131s
user 0m0,023s
sys 0m0,017s

Timo Furrer
@timofurrer
Can you read the w1_slave file from the directory?
Where it said "Is ein Verzeichnis" ?
erolfr
@erolfr

pi@raspberrypi:~ $ time cat /sys/bus/w1/devices/28-0416c21372ff/w1_slave
a0 01 4b 46 1f ff 1f 10 e6 : crc=e6 YES
a0 01 4b 46 1f ff 1f 10 e6 t=26000

real 0m0,938s
user 0m0,001s
sys 0m0,032s

sry
Timo Furrer
@timofurrer
And how long did your 5 sensor read take?
erolfr
@erolfr
like 5 seconds :D. That means is normal?
Timo Furrer
@timofurrer
Seems like it - reading the w1_slave file from the kernel modules takes almost 1s itself ... (> real 0m0,938s)
so adding up those 5 sequential sensor reads - 5 seconds seems pretty much possible
You could do some threading to read those
since it's IO, threading helps
This summer I'll take some time to implement asyncio support into w1thermsensor
that would help to if you are in an asyncio environment
erolfr
@erolfr
thank you
Timo Furrer
@timofurrer
Bitte :)
erolfr
@erolfr
w1thermsensor precision funktioniert macht in der Abfragezeit nur kein Unterschied :(
sergeantpol
@sergeantpol
Hello and thanks for that beautiful code. Do you know how can I only use the 12-bits resolution?
sergeantpol
@sergeantpol

oh I found it, Some w1 therm sensors support changing the resolution for the temperature reads. w1thermsensor enables to do so with the W1ThermSensor.set_resolution() method:

sensor = W1ThermSensor(W1ThermSensor.THERM_SENSOR_DS18B20, "00000588806a")
sensor.set_resolution(9)

Timo Furrer
@timofurrer
Great!