With the Pi 3B, I could either read the sensors sequentially taking
about 0.9s each, or using threads simultaneously in 1.0s. The Pi 4B with Bookworm reads the sensors sequentially a shade faster at just over
0.8s, but when reading simultaneously, returns 2 after 0.8s, another 2
after 1.6s and the last two at 2.4s.
After getting another Pi 5, I've moved a Pi 4B running Bookworm in to
the role taken by a Pi 3B running Bullseye, which is monitoring 6
ds18b20 sensors, configured as 2 1-wire buses with 3 sensors on each.
With the Pi 3B, I could either read the sensors sequentially taking
about 0.9s each, or using threads simultaneously in 1.0s. The Pi 4B with Bookworm reads the sensors sequentially a shade faster at just over
0.8s, but when reading simultaneously, returns 2 after 0.8s, another 2
after 1.6s and the last two at 2.4s.
Anyone have an explanation for this?
On Thu, 19 Sep 2024 10:36:16 +0100, druck wrote:
With the Pi 3B, I could either read the sensors sequentially taking
about 0.9s each, or using threads simultaneously in 1.0s. The Pi 4B with
Bookworm reads the sensors sequentially a shade faster at just over
0.8s, but when reading simultaneously, returns 2 after 0.8s, another 2
after 1.6s and the last two at 2.4s.
Is this Python code? Python threading cannot currently take full advantage
of multiple CPUs, owing to having to serialize all interpreter operations through the “Global Interpreter Lock”.
This is going to be fixed from 3.13 onwards.
No, but AIUI the "right" way to do this is to send the text "trigger" to /sys/bus/w1/devices/w1_bus_master1/therm_bulk_read before reading the
values as normal. The trigger causes them all to start a conversion at
once, following which the reads all complete immediately once a single conversion time has elapsed.
As a quick hack, try executing the following before reading your
sensors...
sudo su <<EOF
echo trigger > /sys/bus/w1/devices/w1_bus_master1/therm_bulk_read
EOF
On 20/09/2024 11:17, John Aldridge wrote:
[Reading ds18b20 sensors in parallel]
No, but AIUI the "right" way to do this is to send the text "trigger" to /sys/bus/w1/devices/w1_bus_master1/therm_bulk_read before reading the values as normal. The trigger causes them all to start a conversion at once, following which the reads all complete immediately once a single conversion time has elapsed.
As a quick hack, try executing the following before reading your
sensors...
sudo su <<EOF
echo trigger > /sys/bus/w1/devices/w1_bus_master1/therm_bulk_read
EOF
Thanks, that seems to works for the first bus, but I get a permission
denied when using w1_bus_master2.
In article <vckmfh$17vkc$2@dont-email.me>, news@druck.org.uk says...
On 20/09/2024 11:17, John Aldridge wrote:
[Reading ds18b20 sensors in parallel]
No, but AIUI the "right" way to do this is to send the text "trigger" to >>> /sys/bus/w1/devices/w1_bus_master1/therm_bulk_read before reading the
values as normal. The trigger causes them all to start a conversion at
once, following which the reads all complete immediately once a single
conversion time has elapsed.
As a quick hack, try executing the following before reading your
sensors...
sudo su <<EOF
echo trigger > /sys/bus/w1/devices/w1_bus_master1/therm_bulk_read
EOF
Thanks, that seems to works for the first bus, but I get a permission
denied when using w1_bus_master2.
Sorry, I've no idea why that might be :(
Though I do recall the permission checking being a bit odd -- hence the
"sudo su" rather than a plain "sudo".
Though I do recall the permission checking being a bit odd -- hence the
"sudo su" rather than a plain "sudo".
On Sun, 22 Sep 2024 11:53:07 +0100, John Aldridge wrote:
Though I do recall the permission checking being a bit odd -- hence the
"sudo su" rather than a plain "sudo".
Either you’re root or you’re not. There’s no need to say “I am root”
twice.
On 22/09/2024 at 11:53, John Aldridge wrote:
In article <vckmfh$17vkc$2@dont-email.me>, news@druck.org.uk says...
On 20/09/2024 11:17, John Aldridge wrote:
[Reading ds18b20 sensors in parallel]
sudo su <<EOF
echo trigger > /sys/bus/w1/devices/w1_bus_master1/therm_bulk_read
EOF
Have you tried
'echo trigger | sudo tee /sys/bus/w1/devices/w1_bus_master1/therm_bulk_read'
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 997 |
Nodes: | 10 (0 / 10) |
Uptime: | 217:26:30 |
Calls: | 13,045 |
Files: | 186,574 |
Messages: | 3,292,403 |