BTT Pi uses AllWinner H616 CPU, and on https://github.com/bigtreetech/CB1 system, w1-gpio
kernel module does not work.
However, there is an excellent custom module https://github.com/pstolarz/w1-gpio-cl
The following steps were tested on CB1 v2.3.3.
Connect sensor VCC pin to 3.3V, GND to GND (obviously), and signal pin to selected GPIO. I used PC7
, since it corresponds to the default w1 pin location on the Raspberry Pi header.
Don't forget to add a pull-up resistor between 3.3V and the signal pin. A 4.7 kOhm resistor is the recommended value.
NEVER connect anything while the printer is powered on!
I did not try parasitic power mode, and I don't recommend it. Klipper will shut down on subsequent read errors, and it might ruin your prints randomly. I did not have any problems with the standard 3-wire connection yet.
The easiest way is to compile it directly on the device. The official guide needed to be modified slightly.
sudo apt-get install build-essential bc bison flex libssl-dev
sudo apt-get install linux-headers-current-sun50iw9
git clone https://github.com/pstolarz/w1-gpio-cl.git
cd w1-gpio-cl
ln -s /lib/modules/`uname -r`/build/include/linux w1
make
sudo make install
Optionally, you can install it using DKMS
sudo dkms add .
sudo dkms install w1-gpio-cl/1.2.2
where 1.2.1
is the latest w1-gpio-cl
release version.
For details, read the original README.
The w1-gpio-cl
module does not accept pin names; instead, it needs pin index. To list all available pins, run
sudo cat /sys/kernel/debug/pinctrl/300b000.pinctrl/pinmux-pins
Find your preferred pin (note that some pins might not work). I used PC7
pin 71 (PC7): UNCLAIMED
Now you can configure module options
echo 'options w1-gpio-cl m1="gdt:71"' | sudo tee /etc/modprobe.d/w1-gpio-cl.conf
Try loading the module manually
sudo modprobe w1-gpio-cl
Verify that the module is loaded
lsmod | grep w1
You should see something like
w1_therm 28672 0
w1_gpio_cl 16384 0
You can verify the output of the dmesg
for errors.
To load the module during boot, run
echo 'w1-gpio-cl' | sudo tee /etc/modules-load.d/w1-gpio-cl.conf
Reboot and verify that the module is properly loaded and working.
See https://www.klipper3d.org/Config_Reference.html#ds18b20-temperature-sensor
Find out connected sensor addresses
sudo ls /sys/bus/w1/devices/
You will see output like
28-011319f769fe w1_bus_master1
With that address, add a Klipper config section like this
[temperature_sensor my_sensor]
sensor_type: DS18B20
serial_no: 28-011319f769fe
sensor_mcu: CB1
Note that sensor_mcu
must be set to the host, which is CB1
by default.
After restarting Klipper, your new temperature sensor should appear in the Mainsail/Fluidd UI automatically.
Thanks for the response. I found a solution and thought I’d share it—maybe somebody else wants to try this.
How to Compile the Kernel Headers and w1-gpio-cl
You should be able to use these commands to cross-compile the driver and then install it on the BTT Pi.
Use the branch for your build. You can find it in the release for the BTT image you used. This is for the current latest version V3.0.0 of the OS image.
In the Makefile, update the EXTRAVERSION line:
This must be done because this is the name of the kernel in the os image and it only worked for me if they matched
Edit the kernel configuration to enable W1 (1-Wire) support:
I got a Error 2 at the end of the build process. When you see this at the end
it might still work. Your milage might vary.
Check the compiled module for compatibility:
Ensure the vermagic matches uname -r on the BTT Pi.
7. Install the Driver on the BTT Pi
Transfer the compiled w1-gpio-cl.ko to your BTT Pi, then:
Now 1w shoude work.