The Monarco HAT uses a DS2482 chip for 1-Wire communication over the I2C bus. To make this work seamlessly, you need to install the owserver service, prevent the default Linux kernel from interfering with the chip, and configure the I2C bus properly.
Follow the steps below to set up your 1-Wire interface from scratch.
💡 Note for REXYGEN users: If you plan to use the Monarco HAT with the REXYGEN system, you can skip this entire manual setup by using the official REXYGEN Raspberry Pi image. It comes with all Monarco HAT drivers, owserver, and low-level system optimizations pre-configured out of the box.
Step 1: Install Packages and Apply Configurations
You can complete the installation and configuration in one go. Simply copy the entire block of commands below, paste it into your Raspberry Pi terminal, and press Enter.
This script will install the necessary tools, blacklist the conflicting default driver, configure the I2C speed, and write the exact required settings to your owfs.conf file.
Shell# 1. Install required 1-Wire and I2C packages
sudo apt update
sudo apt install -y i2c-tools owserver ow-shell
# 2. Blacklist the default kernel driver so owserver gets exclusive access
echo "blacklist ds2482" | sudo tee /etc/modprobe.d/rex-ds2482.conf > /dev/null
# 3. Set I2C baudrate to 400kHz (Fast mode)
if ! grep -q '^dtparam=i2c_baudrate=400000' /boot/firmware/config.txt; then
echo 'dtparam=i2c_baudrate=400000' | sudo tee -a /boot/firmware/config.txt > /dev/null
fi
# 4. Ensure the i2c-dev module is loaded to create /dev/i2c-* nodes
echo "i2c-dev" | sudo tee /etc/modules-load.d/i2cdev.conf > /dev/null
# 5. Cleanly overwrite owfs.conf with the exact required settings
cat <<EOF | sudo tee /etc/owfs.conf > /dev/null
!server: server = localhost:4304
allow_other
server: port = localhost:4304
server: i2c = ALL:ALL
timeout_volatile = 2
EOFStep 2: Reboot Your Raspberry Pi
For the kernel module changes and I2C configurations to take effect, a system restart is mandatory. Run:
Shellsudo rebootStep 3: Verify the Setup
Once your Raspberry Pi boots back up, you should verify that owserver is successfully communicating with the Monarco HAT and detecting your 1-Wire sensors.
Run the following command in your terminal:
Shellowdir /uncachedExpected Result: The terminal should output a list of your connected 1-Wire devices. Temperature sensors typically appear as directories starting with 28. (e.g., /28.FFD2F2581604).
If you see these sensor IDs, your 1-Wire setup is complete, and your application can now read the sensor data correctly.