I am trying to get the MAX30102 heart sensor to run and have recompiled the kernel with the necessary module. I have loaded the follwing modules to be sure


I can verify this with lsmod

Module                  Size  Used by
max30102               16384  0
kfifo_buf              16384  1 max30102
regmap_i2c             16384  1 max30102
industrialio           73728  2 max30102,kfifo_buf
i2c_dev                20480  0

I have now found this device tree documentation and have tried adding


to my /boot/config.txt as they are mentioned under the section "required" in the documentation. I just need to pass my interrupt pin which is connected to GPIO 4. But when I look under

$ for file in /sys/bus/i2c/devices/i2c-1/of_node/*; do ( echo $file; cat $file; echo "\n" )  ; done













I still get the same values in the device tree. They are either empty or wrong.

  • You might like to read the following post to see the root cause of the problem, and one way to fixt it: How can Rpi read the MAX30100 / MAX30102 Oximeter? Asked 1 year, 3 months ago Active 10 months ago Viewed 6k times: raspberrypi.stackexchange.com/questions/111955/….
    – tlfong01
    Aug 17, 2021 at 9:21
  • 1
    Thanks, I have already stumbled across this, but all of it is for Python and I want a C/C++ implementation utilizing the Linux kernel driver for the MAX30102 instead of using the Python library.
    – neolith
    Aug 17, 2021 at 9:33
  • Ah, I see. C/C++ might have another problem. Good luck. Cheers.
    – tlfong01
    Aug 17, 2021 at 11:01

1 Answer 1


After a lot of research I found out that you have to create a device tree overlays for the driver module

// Overlay for max30102 heart rate sensor


/ {
    compatible = "brcm,bcm2835";

    fragment@0 {
        target = <&i2c_arm>;

        __overlay__ {
            #address-cells = <1>;
            #size-cells = <0>;

            max30102: heart-rate@57 {
                compatible = "maxim,max30102";
                reg = <0x57>;
                maxim,red-led-current-microamp = <7000>;
                maxim,ir-led-current-microamp  = <7000>;
                interrupt-parent  = <&gpio>;
                interrupts = <4 2>;

    __overrides__ {
        int_pin = <&max30102>, "interrupts:0";

You can then configure the overlay in /boot/config.txt like this

# The default interrupt GPIO is still 4
# Or to specify a different interrupt GPIO, e.g. 18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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