{
    "ok": true,
    "data": {
        "title": "EP-0099",
        "rev_id": 15967,
        "updated_at": "2025-07-24T01:58:04+00:00",
        "chunk_count": 21,
        "chunks": [
            {
                "title": "EP-0099",
                "rev_id": 15967,
                "heading_path": "",
                "chunk_index": 0,
                "content": "# EP-0099",
                "char_count": 9,
                "token_estimate": 3
            },
            {
                "title": "EP-0099",
                "rev_id": 15967,
                "heading_path": "DockerPi 4 Channel Relay",
                "chunk_index": 1,
                "content": "<figure>\n<img src=\"Ddl-1.jpg\" title=\"Ddl-1.jpg\" width=\"300\" alt=\"Ddl-1.jpg\" \/>\n<figcaption aria-hidden=\"true\">Ddl-1.jpg<\/figcaption>\n<\/figure>\n\n-   Purchase URL \\[ <https:\/\/52pi.com\/products\/52pi-dockerpi-4-channel-relay-for-raspberry-pi> \\]",
                "char_count": 241,
                "token_estimate": 61
            },
            {
                "title": "EP-0099",
                "rev_id": 15967,
                "heading_path": "Description",
                "chunk_index": 2,
                "content": "DockerPi 4 Channel Relay is a member of the DockerPi Series,more commonly used in IOT applications.\n\nDockerPi 4 Channel Relay can relay AC\/DC, instead of traditional switches, to achieve more ideas.\n\nDockerPi 4 Channel Relay can stack up to 4, and can be stacked with other DockerPi expansion board. If you need to run for a long time, we also recommend that you use our DockerPi Power expansion board to provide more power.",
                "char_count": 424,
                "token_estimate": 106
            },
            {
                "title": "EP-0099",
                "rev_id": 15967,
                "heading_path": "Features",
                "chunk_index": 3,
                "content": "<figure>\n<img src=\"Ddl-2.jpg\" title=\"Ddl-2.jpg\" width=\"300\" alt=\"Ddl-2.jpg\" \/>\n<figcaption aria-hidden=\"true\">Ddl-2.jpg<\/figcaption>\n<\/figure>\n\n-   MCU Power IN: 5V (via GPIO pin)\n-   DockerPi Series\n-   Programmable\n-   Control directly(without programming)\n-   Extend the GPIO Pins\n-   4 Channel Relay\n-   4 Alt I2C Addr Support\n-   Relay Status Leds\n-   Support 3A 250V AC\n-   Support 3A 30V DC\n-   Can Stack with other Stack board\n-   Independent of the mainboard hardware (require I2C support)\n-   Compatible with 24AWG-30AWG wire",
                "char_count": 535,
                "token_estimate": 134
            },
            {
                "title": "EP-0099",
                "rev_id": 15967,
                "heading_path": "Official Compatibility Test",
                "chunk_index": 4,
                "content": "Not only support the following development boards, other development boards can be compatible if they have I2C peripherals. (Note: some software changes may be required)\n\n| Platform                  | DockerPi 4 Channel Relay | Notes                                |\n|---------------------------|--------------------------|--------------------------------------|\n| Raspberry Pi All Platform | √                        | Not Include CM Series & EOL Platform |\n| Banana Pi M3              | √                        | Python 3 & Modify DEVICE_BUS to 2    |\n| ASUS Tinker Board         | √                        | Python 3 & Modify DEVICE_BUS to 1    |\n| Orange Pi Zero            | √                        | Python 3 & Modify DEVICE_BUS to 0    |\n|                           |                          |                                      |",
                "char_count": 842,
                "token_estimate": 211
            },
            {
                "title": "EP-0099",
                "rev_id": 15967,
                "heading_path": "Gallery",
                "chunk_index": 5,
                "content": "|                                            |                                            |                                            |\n|--------------------------------------------|--------------------------------------------|--------------------------------------------|\n| ![ left \\|300px](Ddl-1.jpg \" left |300px\") | ![ none \\|300px](Ddl-2.jpg \" none |300px\") | ![ none \\|300px](Ddl-3.jpg \" none |300px\") |\n\n------------------------------------------------------------------------\n\n|                                            |                                            |                                            |\n|--------------------------------------------|--------------------------------------------|--------------------------------------------|\n| ![ left \\|300px](Ddl-4.jpg \" left |300px\") | ![ none \\|300px](Ddl-5.jpg \" none |300px\") | ![ none \\|300px](Ddl-6.jpg \" none |300px\") |\n\n------------------------------------------------------------------------",
                "char_count": 970,
                "token_estimate": 243
            },
            {
                "title": "EP-0099",
                "rev_id": 15967,
                "heading_path": "Gallery",
                "chunk_index": 6,
                "content": "|                                            |                                            |                                            |\n|--------------------------------------------|--------------------------------------------|--------------------------------------------|\n| ![ left \\|300px](Ddl-7.jpg \" left |300px\") | ![ none \\|300px](Ddl-8.jpg \" none |300px\") | ![ none \\|300px](Ddl-9.jpg \" none |300px\") |\n\n------------------------------------------------------------------------\n\n|                                            |                                             |                                            |\n|--------------------------------------------|---------------------------------------------|--------------------------------------------|\n| ![ left \\|300px](Ddl-2.jpg \" left |300px\") | ![ none \\|300px](Ddl-11.jpg \" none |300px\") | ![ none \\|300px](Ddl-9.jpg \" none |300px\") |",
                "char_count": 899,
                "token_estimate": 225
            },
            {
                "title": "EP-0099",
                "rev_id": 15967,
                "heading_path": "Package Include",
                "chunk_index": 7,
                "content": "-   1 x Docker Pi 4 Channel Relay\n-   1 x Instruction\n-   4 x M2.5\\*11 + 6 Copper stick\n-   4 x M2.5\\*6 Nut\n-   4 x M2.5\\*6 Half-round head screw\n\n<img src=\"Ddl-4.jpg\" title=\"Ddl-4.jpg\" width=\"300\" alt=\"Ddl-4.jpg\" \/>",
                "char_count": 216,
                "token_estimate": 54
            },
            {
                "title": "EP-0099",
                "rev_id": 15967,
                "heading_path": "Device Address Map",
                "chunk_index": 8,
                "content": "| DIP switch status icon                                                                  | Device Address |\n|-----------------------------------------------------------------------------------------|----------------|\n| <figure>\n <img src=\"Dipswitch01.jpg\" title=\"Dipswitch01.jpg\" width=\"150\" alt=\"Dipswitch01.jpg\" \/>\n <figcaption aria-hidden=\"true\">Dipswitch01.jpg<\/figcaption>\n <\/figure>                                                                                | 0x10           |\n| <figure>\n <img src=\"Dipswitch02.jpg\" title=\"Dipswitch02.jpg\" width=\"150\" alt=\"Dipswitch02.jpg\" \/>\n <figcaption aria-hidden=\"true\">Dipswitch02.jpg<\/figcaption>\n <\/figure>                                                                                | 0x11           |\n| <figure>\n <img src=\"Dipswitch03.jpg\" title=\"Dipswitch03.jpg\" width=\"150\" alt=\"Dipswitch03.jpg\" \/>\n <figcaption aria-hidden=\"true\">Dipswitch03.jpg<\/figcaption>\n <\/figure>                                                                                | 0x12           |\n| <figure>\n <img src=\"Dipswitch04.jpg\" title=\"Dipswitch04.jpg\" width=\"150\" alt=\"Dipswitch04.jpg\" \/>\n <figcaption aria-hidden=\"true\">Dipswitch04.jpg<\/figcaption>",
                "char_count": 1188,
                "token_estimate": 297
            },
            {
                "title": "EP-0099",
                "rev_id": 15967,
                "heading_path": "Device Address Map",
                "chunk_index": 9,
                "content": "<\/figure>                                                                                | 0x13           |",
                "char_count": 107,
                "token_estimate": 27
            },
            {
                "title": "EP-0099",
                "rev_id": 15967,
                "heading_path": "Register Map",
                "chunk_index": 10,
                "content": "| Register Address | Function | Value                   |\n|------------------|----------|-------------------------|\n| 0x01             | Relay 1  | 0(FULL OFF) - 1\/255(ON) |\n| 0x02             | Relay 2  | 0(FULL OFF) - 1\/255(ON) |\n| 0x03             | Relay 3  | 0(FULL OFF) - 1\/255(ON) |\n| 0x04             | Relay 4  | 0(FULL OFF) - 1\/255(ON) |",
                "char_count": 347,
                "token_estimate": 87
            },
            {
                "title": "EP-0099",
                "rev_id": 15967,
                "heading_path": "How to connect electrical device",
                "chunk_index": 11,
                "content": "Please pay attention to this mark on the board:\n<img src=\"Ddl-con.jpg\" title=\"Ddl-con.jpg\" width=\"500\" alt=\"Ddl-con.jpg\" \/> <img src=\"Ddl_shiyitu.jpg\" title=\"Ddl_shiyitu.jpg\" width=\"500\" alt=\"Ddl_shiyitu.jpg\" \/>\n\\* NC = Normal Close\n\n-   COM = Common\n-   NO = Normal Open",
                "char_count": 271,
                "token_estimate": 68
            },
            {
                "title": "EP-0099",
                "rev_id": 15967,
                "heading_path": "Mechanical Drawing",
                "chunk_index": 12,
                "content": "[ 500px \\|left](File:Dockerpi-relay-m.png \"wikilink\")",
                "char_count": 53,
                "token_estimate": 14
            },
            {
                "title": "EP-0099",
                "rev_id": 15967,
                "heading_path": "Configuring I2C(Raspberry Pi)",
                "chunk_index": 13,
                "content": "Run **sudo raspi-config** and follow the prompts to install i2c support for the ARM core and linux kernel\nGo to **Interfacing Options** <img src=\"Raspi-config-1.png\" title=\"Raspi-config-1.png\" width=\"320\" alt=\"Raspi-config-1.png\" \/> then **I2C** <img src=\"Raspi-config-2.png\" title=\"Raspi-config-2.png\" width=\"320\" alt=\"Raspi-config-2.png\" \/> Enable! <img src=\"Raspi-config-3.png\" title=\"Raspi-config-3.png\" width=\"320\" alt=\"Raspi-config-3.png\" \/> Done! <img src=\"Raspi-config-4.png\" title=\"Raspi-config-4.png\" width=\"320\" alt=\"Raspi-config-4.png\" \/>",
                "char_count": 550,
                "token_estimate": 138
            },
            {
                "title": "EP-0099",
                "rev_id": 15967,
                "heading_path": "Direct control without programming(Raspberry Pi)",
                "chunk_index": 14,
                "content": "-   Turn on channel No.1 relay\n\n`i2cset -y 1 0x10 0x01 0xFF`\n\\* Turn off channel No.1 relay `i2cset -y 1 0x10 0x01 0x00`\n----\n\n-   Turn on channel No.2 relay\n\n`i2cset -y 1 0x10 0x02 0xFF`\n\\* Turn off channel No.2 relay `i2cset -y 1 0x10 0x02 0x00`\n----\n\n-   Turn on channel No.3 relay\n\n`i2cset -y 1 0x10 0x03 0xFF`\n\\* Turn off channel No.3 relay `i2cset -y 1 0x10 0x03 0x00`\n----\n\n-   Turn on channel No.4 relay\n\n`i2cset -y 1 0x10 0x04 0xFF`\n\\* Turn off channel No.4 relay `i2cset -y 1 0x10 0x04 0x00`\n----",
                "char_count": 506,
                "token_estimate": 127
            },
            {
                "title": "EP-0099",
                "rev_id": 15967,
                "heading_path": "Program in Language C(Raspberry Pi)",
                "chunk_index": 15,
                "content": "Create source code and name it \"relay.c\"\n\n    #include <stdio.h>\n    #include <wiringPi.h>\n    #include <wiringPiI2C.h>\n\n    #define DEVCIE_ADDR  0x10\n    #define RELAY1  0x01\n    #define RELAY2  0x02\n    #define RELAY3  0x03\n    #define RELAY4  0x04\n    #define ON      0xFF\n    #define OFF     0x00\n\n    int main(void){\n        printf(\"Turn on Relays in C\\n\");\n        int fd;\n        int i = 0;\n        fd = wiringPiI2CSetup(DEVICE_ADDR);\n        for(;;){\n           for (i=1; i<=4; i++){\n              printf(\"turn on relay No.%d\\n\", i);\n              wiringPiI2CWriteReg8(fd, i, ON);\n              sleep(200);\n              printf(\"turn off relay No.%d\\n\", i);\n              wiringPiI2CWriteReg8(fd, i, OFF);\n              sleep(200);\n           }\n        }\n        return 0;\n    }\n\nCompile!\n\n`gcc relay.c -lwiringPi -o relay`\nExec It!\n\n`.\/relay`",
                "char_count": 851,
                "token_estimate": 213
            },
            {
                "title": "EP-0099",
                "rev_id": 15967,
                "heading_path": "Program in Python(Raspberry Pi)",
                "chunk_index": 16,
                "content": "The following code is recommended to be executed using Python 3 and install the **smbus** library:\n\n    import time as t\n    import smbus\n    import sys\n\n    DEVICE_BUS = 1\n    DEVICE_ADDR = 0x10\n    bus = smbus.SMBus(DEVICE_BUS)\n\n    while True:\n        try:\n            for i in range(1,5):\n                bus.write_byte_data(DEVICE_ADDR, i, 0xFF)\n                t.sleep(1)\n                bus.write_byte_data(DEVICE_ADDR, i, 0x00)\n                t.sleep(1)\n        except KeyboardInterrupt as e:\n            print(\"Quit the Loop\")\n            sys.exit()\n\n------------------------------------------------------------------------",
                "char_count": 633,
                "token_estimate": 159
            },
            {
                "title": "EP-0099",
                "rev_id": 15967,
                "heading_path": "Program in Java(Raspberry Pi)",
                "chunk_index": 17,
                "content": "Create a new file named: I2CRelay.java and paste following code:\n\nimport java.io.IOException;\n    import java.util.Arrays;\n\nimport com.pi4j.io.i2c.I2CBus;\n    import com.pi4j.io.i2c.I2CDevice;\n    import com.pi4j.io.i2c.I2CFactory;\n    import com.pi4j.io.i2c.I2CFactory.UnsupportedBusNumberException;\n    import com.pi4j.platform.PlatformAlreadyAssignedException;\n    import com.pi4j.util.Console;\n\npublic class I2CRelay {\n\n\/\/ relay's register address.\n        public static final int DOCKER_PI_RELAY_ADDR = 0x10;\n\n\/\/ channel of relay.\n        public static final byte DOCKER_PI_RELAY_1 = (byte)0x01;\n        public static final byte DOCKER_PI_RELAY_2 = (byte)0x02;\n        public static final byte DOCKER_PI_RELAY_3 = (byte)0x03;\n        public static final byte DOCKER_PI_RELAY_4 = (byte)0x04;\n\n\/\/ Relay status\n        public static final byte DOCKER_PI_RELAY_ON = (byte)0xFF;\n        public static final byte DOCKER_PI_RELAY_OFF = (byte)0x00;\n\npublic static void main(String[] args) throws InterruptedException, PlatformAlreadyAssignedException, IOException, UnsupportedBusNumberException {\n\nfinal Console console = new Console();",
                "char_count": 1133,
                "token_estimate": 284
            },
            {
                "title": "EP-0099",
                "rev_id": 15967,
                "heading_path": "Program in Java(Raspberry Pi)",
                "chunk_index": 18,
                "content": "I2CBus i2c = I2CFactory.getInstance(I2CBus.BUS_1);\n            I2CDevice device = i2c.getDevice(DOCKER_PI_RELAY_ADDR);\n\nconsole.println(\"Turn on Relay!\");\n            device.write(DOCKER_PI_RELAY_1, DOCKER_PI_RELAY_ON);\n\nThread.sleep(500);\n\nconsole.println(\"Turn off Relay!\");\n            device.write(DOCKER_PI_RELAY_1, DOCKER_PI_RELAY_OFF);\n        }\n    }\n\n-   Compile it and running:\n\n<!-- -->\n\njavac I2CRelay.java -classpath .:classes:\/opt\/pi4j\/lib\/'*'\n\nsudo java -classpath .:classes:\/opt\/pi4j\/lib\/'*' I2CRelay",
                "char_count": 516,
                "token_estimate": 129
            },
            {
                "title": "EP-0099",
                "rev_id": 15967,
                "heading_path": "Customer Application",
                "chunk_index": 19,
                "content": "-   Thanks for 11je \\[ <https:\/\/plus.google.com\/114848996385924765358> \\] provides a demo that using 4 Channel Relay works with Arduino IDE.\n-   Project URL: \\[ <https:\/\/www.instructables.com\/I2C-Relay-Met-Arduino-IDE\/> \\]",
                "char_count": 222,
                "token_estimate": 56
            },
            {
                "title": "EP-0099",
                "rev_id": 15967,
                "heading_path": "Git Repository",
                "chunk_index": 20,
                "content": "You can also clone the repository from github:\n\n    sudo apt-get update\n    sudo apt-get -y install git\n    git clone https:\/\/github.com\/geeekpi\/dockerpi\n    cd dockerpi\/\n\nRunning Differenet program with different way.",
                "char_count": 218,
                "token_estimate": 55
            }
        ]
    }
}