i hope you're having a nice day.

For a project i want to implement 1-Wire communication in a Raspberry Pi Zero W. The goal is to use a Maxim Integrated Max17313 Fuel Gauge for inspecting battery usage.

To make sure the implementation will work on the first hand, I started with emulating different 1-Wire devices with an ESP8266 and using this library: https://github.com/orgua/OneWireHub

For wiring and setting up the Pi, i followed this article: https://pinout.xyz/pinout/1_wire# Also tried the steps with a vanilla Raspbian install.

Sticking to the basics I started emulating a DS18B20. I can get readings via a connected ESP32 running micropython. Sadly, the device never shows up on the /sys/bus/w1/devices/ folder on the Pi using the standard w1 driver.

I then tried "bitbanging" GPIO4 directly via this code: https://github.com/danjperron/BitBangingDS18B20 . When using this method, the sensor is detected and readings are possible. That means, the wiring must be correct at least and GPIO4 is working.

When I remove the 4.7k pullup resistor, random devices appear on the Pi, but with the pullup connected, nothing happens.

I tried a lot of different approaches like using OWFS, different GPIO Pins, loading kernel modules like w1-gpio and w1-temp. The modules always load successfully. The device tree debug log also never shows any errors related to 1-wire.

As far as i understand the topic, the emulated sensor should be at least appearing in the /sys/bus/w1/devices/ folder. I also double checked the behavior with a raspberry Pi 3: Same result. The only thing showing up is the w1_bus_master_1 .

Attached you will find a picture of my current breadboard wiring. The emulated data pin is pin 5 on the ESP.

I would really appreciate your help.

Kind regards



  • which overlay are you using to use OneWire – Jaromanda X Feb 7 at 2:37

After a weekend full of research I finally found the error: Somehow, the Raspberry Pi implementation doesn't exactly follow the 1-Wire specification which leads to timing issues in conjunction with OneWireHub. Thankfully, I found the solution for my problem on Github: https://github.com/orgua/OneWireHub/issues/44

Now the communication is working fine in the default raspbian config.

The thread can be closed now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.