[solved] Connecting external w1-temperatur sensor to quad sata hat

Hello radxa community,

my quad sata hat is running well on a Pi 4b with DietPi.
I noticed in fan.py that an optional w1-sensor is queried and the max of that value and the cpu temperature is used to control the fans and in misc.py a w1-interface is activated.
Would it work and cause no conflict if I solder a DS18B20 data wire (DQ) to GPIO 4 (pin 7, bcm 4)?

Background:
I like to take better control over HHD temperature in case of low cpu usage and spun down HDDs.
The only working way I found to read HHD temperature is by
smartctl -a /dev/sda | grep Tempe | cut -d" " -f 2,37
But this spins up HDDs that are asleep over night to preserve their life span.

Regards
Michael

Why would you want to check HDD temp in case of low CPU and spun down HDD?

If it’s environment temp you need to monitor there are several options. I don’t think you can directly pilot a DS18B20 (or any other 1w device) without additional coding. But I guess the radxa people are better placed to answer that question.
You could also opt for an LM75 which you can connect over i2c-bus and talk to with native Linux lmsensors library.

Thank you, my observation is that even with low CPU on Pi4 the CPU causing continous heat dissipation affecting the on top mounted HDDs.
On low CPU the fan has as CPU bound low duty cycle. This is heaten up the HDDs more by CPU dissipation as on high CPU with a high fan duty cycle.
With spun down HDD I could only guess the HDD temperature is still OK and therefore I like to measure with an additianal sensor if on low CPU the duty cycle should be extended to keep HHD temp in a good range.

As written I found in the scripts the needed addititional code is already there and like to know if GPIO 4 is unused by SATA HAT and could be used for my purpose.

Solved by try: You can connect an external w1-temp and its temp is considered in the installed software.

As my Pi is noiseless cooled in an external aluminium case I do not need to consider the CPU temp and therefore the only modification is for fan regulating temparatures in the config file to match HDD temperatures e.g. 35, 37, 39, 41 degree Celsius.

Cool thx for sharing. So you wired it just as you mentioned in opening post? Nothing more, nothing less?

yes, the usual wiring: A DS18B20 with 3,3V wire, GND wire and a 4,7k pulled up data wire.
And the software recognize it (by “miracle”).

Meanwhile I conduct further experiments:
I extended slightly the code in fan.py to read up to 4 DS18B20 mounted on the 4 HDD housing to read the individual temperatures and I modified slightly the code in oled.py to display more information on a 128x64 SH1106 controlled OLED.

… now I put all things together Almost fan less SATA HAT and Pi by separating SATA HAT and Pi

Regards
Michael