# Robot Framework I2C Library
[](https://badge.fury.io/py/robotframework-i2c)
[](https://opensource.org/licenses/MIT)
Robot Framework library for interfacing I2C devices on Raspberry Pi and other embedded systems.
## Installation
```bash
pip install robotframework-i2c
```
## Requirements
- Robot Framework (>=3.2.2)
- smbus2 (>=0.4.0)
- I2C enabled on the system
## Quick Start
```robot
*** Settings ***
Library robotframework_i2c.I2CLibrary.I2CLibrary
*** Test Cases ***
Test I2C Communication
Open I2C Bus 1
${devices}= Scan I2C Bus
Log Found devices: ${devices}
Close I2C Bus
```
## Keywords
### Bus Management
- `Open I2C Bus` - Opens an I2C bus for communication
- `Close I2C Bus` - Closes the currently open I2C bus
- `Scan I2C Bus` - Scans the I2C bus for connected devices
### Device Communication
- `Read I2C Register` - Reads data from a device register
- `Write I2C Register` - Writes data to a device register
- `Read I2C Block` - Reads a block of data from a device
- `Write I2C Block` - Writes a block of data to a device
- `I2C Device Present` - Checks if a device is present at an address
### Utility
- `Set I2C Delay` - Sets a delay between I2C operations
## Examples
### Basic Device Communication
```robot
*** Settings ***
Library robotframework_i2c.I2CLibrary.I2CLibrary
*** Test Cases ***
Read Temperature Sensor
Open I2C Bus 1
${present}= I2C Device Present 0x48
Should Be True ${present}
${temp_raw}= Read I2C Register 0x48 0x00
Log Raw temperature: ${temp_raw}
Close I2C Bus
```
### Block Data Operations
```robot
*** Settings ***
Library robotframework_i2c.I2CLibrary.I2CLibrary
*** Test Cases ***
Read Configuration Block
Open I2C Bus 1
${config_data}= Read I2C Block 0x48 0x10 4
Log Configuration: ${config_data}
${new_config}= Create List 0x01 0x02 0x03 0x04
Write I2C Block 0x48 0x10 ${new_config}
Close I2C Bus
```
### Device Discovery
```robot
*** Settings ***
Library robotframework_i2c.I2CLibrary.I2CLibrary
*** Test Cases ***
Discover I2C Devices
Open I2C Bus 1
${devices}= Scan I2C Bus
Log Found ${devices.__len__()} devices
FOR ${device} IN @{devices}
Log Device found at: ${device}
END
Close I2C Bus
```
## Supported Platforms
- Raspberry Pi (all models)
- Other Linux-based embedded systems with I2C support
- Any system with `/dev/i2c-*` device files
## Hardware Setup
Before using this library, ensure I2C is enabled on your system:
### Raspberry Pi
1. Enable I2C via `raspi-config` or add `dtparam=i2c_arm=on` to `/boot/config.txt`
2. Reboot the system
3. Verify I2C is working: `ls /dev/i2c-*`
### General Linux
1. Load I2C kernel modules: `modprobe i2c-dev`
2. Ensure your user has access to I2C devices (usually in `i2c` group)
## Error Handling
The library provides detailed error messages for common issues:
- **Bus not open**: Ensure you call `Open I2C Bus` before other operations
- **Device not found**: Check wiring and device address
- **Permission denied**: Ensure proper user permissions for I2C devices
- **smbus2 not available**: Install with `pip install smbus2`
## License
MIT License. See LICENSE file for details.
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
## Support
For issues and questions, please use the GitHub issue tracker.
Raw data
{
"_id": null,
"home_page": null,
"name": "robotframework-i2c",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "robot, framework, i2c, raspberry, pi, embedded, hardware, automation",
"author": null,
"author_email": "RZ-CI Team <rz-ci@renesas.com>",
"download_url": "https://files.pythonhosted.org/packages/e0/f6/5077356e04e48ba5e064b9d2ff58468e17deccd3798a741320cb888138f6/robotframework_i2c-1.0.0.tar.gz",
"platform": null,
"description": "# Robot Framework I2C Library\n\n[](https://badge.fury.io/py/robotframework-i2c)\n[](https://opensource.org/licenses/MIT)\n\nRobot Framework library for interfacing I2C devices on Raspberry Pi and other embedded systems.\n\n## Installation\n\n```bash\npip install robotframework-i2c\n```\n\n## Requirements\n\n- Robot Framework (>=3.2.2)\n- smbus2 (>=0.4.0)\n- I2C enabled on the system\n\n## Quick Start\n\n```robot\n*** Settings ***\nLibrary robotframework_i2c.I2CLibrary.I2CLibrary\n\n*** Test Cases ***\nTest I2C Communication\n Open I2C Bus 1\n ${devices}= Scan I2C Bus\n Log Found devices: ${devices}\n Close I2C Bus\n```\n\n## Keywords\n\n### Bus Management\n- `Open I2C Bus` - Opens an I2C bus for communication\n- `Close I2C Bus` - Closes the currently open I2C bus\n- `Scan I2C Bus` - Scans the I2C bus for connected devices\n\n### Device Communication\n- `Read I2C Register` - Reads data from a device register\n- `Write I2C Register` - Writes data to a device register\n- `Read I2C Block` - Reads a block of data from a device\n- `Write I2C Block` - Writes a block of data to a device\n- `I2C Device Present` - Checks if a device is present at an address\n\n### Utility\n- `Set I2C Delay` - Sets a delay between I2C operations\n\n## Examples\n\n### Basic Device Communication\n\n```robot\n*** Settings ***\nLibrary robotframework_i2c.I2CLibrary.I2CLibrary\n\n*** Test Cases ***\nRead Temperature Sensor\n Open I2C Bus 1\n ${present}= I2C Device Present 0x48\n Should Be True ${present}\n ${temp_raw}= Read I2C Register 0x48 0x00\n Log Raw temperature: ${temp_raw}\n Close I2C Bus\n```\n\n### Block Data Operations\n\n```robot\n*** Settings ***\nLibrary robotframework_i2c.I2CLibrary.I2CLibrary\n\n*** Test Cases ***\nRead Configuration Block\n Open I2C Bus 1\n ${config_data}= Read I2C Block 0x48 0x10 4\n Log Configuration: ${config_data}\n \n ${new_config}= Create List 0x01 0x02 0x03 0x04\n Write I2C Block 0x48 0x10 ${new_config}\n Close I2C Bus\n```\n\n### Device Discovery\n\n```robot\n*** Settings ***\nLibrary robotframework_i2c.I2CLibrary.I2CLibrary\n\n*** Test Cases ***\nDiscover I2C Devices\n Open I2C Bus 1\n ${devices}= Scan I2C Bus\n Log Found ${devices.__len__()} devices\n FOR ${device} IN @{devices}\n Log Device found at: ${device}\n END\n Close I2C Bus\n```\n\n## Supported Platforms\n\n- Raspberry Pi (all models)\n- Other Linux-based embedded systems with I2C support\n- Any system with `/dev/i2c-*` device files\n\n## Hardware Setup\n\nBefore using this library, ensure I2C is enabled on your system:\n\n### Raspberry Pi\n1. Enable I2C via `raspi-config` or add `dtparam=i2c_arm=on` to `/boot/config.txt`\n2. Reboot the system\n3. Verify I2C is working: `ls /dev/i2c-*`\n\n### General Linux\n1. Load I2C kernel modules: `modprobe i2c-dev`\n2. Ensure your user has access to I2C devices (usually in `i2c` group)\n\n## Error Handling\n\nThe library provides detailed error messages for common issues:\n\n- **Bus not open**: Ensure you call `Open I2C Bus` before other operations\n- **Device not found**: Check wiring and device address\n- **Permission denied**: Ensure proper user permissions for I2C devices\n- **smbus2 not available**: Install with `pip install smbus2`\n\n## License\n\nMIT License. See LICENSE file for details.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## Support\n\nFor issues and questions, please use the GitHub issue tracker.\n",
"bugtrack_url": null,
"license": null,
"summary": "Robot Framework Library for interfacing I2C devices on Raspberry Pi and other embedded systems",
"version": "1.0.0",
"project_urls": {
"Documentation": "https://renesas.github.io/robotframework-i2c/",
"Homepage": "https://github.com/renesas/robotframework-i2c",
"Issues": "https://github.com/renesas/robotframework-i2c/issues",
"Repository": "https://github.com/renesas/robotframework-i2c"
},
"split_keywords": [
"robot",
" framework",
" i2c",
" raspberry",
" pi",
" embedded",
" hardware",
" automation"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "37596a80670303c24d764b8e1e0260078ce050d4a10214123bbe9b492b119cbc",
"md5": "0f62a07f27b5d5e3794d120427497e32",
"sha256": "112e92e942543320f0df23e695dc81c6270629e29eae45948cf8d0490026f78a"
},
"downloads": -1,
"filename": "robotframework_i2c-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0f62a07f27b5d5e3794d120427497e32",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 9231,
"upload_time": "2025-07-08T11:21:38",
"upload_time_iso_8601": "2025-07-08T11:21:38.731733Z",
"url": "https://files.pythonhosted.org/packages/37/59/6a80670303c24d764b8e1e0260078ce050d4a10214123bbe9b492b119cbc/robotframework_i2c-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "e0f65077356e04e48ba5e064b9d2ff58468e17deccd3798a741320cb888138f6",
"md5": "6bfe16e01018c59c6ec28abf1cb91563",
"sha256": "49e08c0db266ed56e47a54e3d820424e03ef22ecfb56165c4a25eb86e154eab1"
},
"downloads": -1,
"filename": "robotframework_i2c-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "6bfe16e01018c59c6ec28abf1cb91563",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 9152,
"upload_time": "2025-07-08T11:21:40",
"upload_time_iso_8601": "2025-07-08T11:21:40.512268Z",
"url": "https://files.pythonhosted.org/packages/e0/f6/5077356e04e48ba5e064b9d2ff58468e17deccd3798a741320cb888138f6/robotframework_i2c-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-08 11:21:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "renesas",
"github_project": "robotframework-i2c",
"github_not_found": true,
"lcname": "robotframework-i2c"
}