python lib for Arduino Chaino device
Project description
chaino — Python and MicroPython Host Library for controlling Chaino (Arduino) Devices
chaino module lets a PC communicate with an Arduino/compatible board that runs the Chaino firmware over Serial (USB). You can remotely execute functions registered on the Chaino board, pass arguments, and receive return values.
This module can also be used in MicroPython, where a MicroPython device acts as a host and controls a Chaino device connected via I²C. In this case, all communication and function execution happen over the I²C bus.
It uses CRC-16/XMODEM for integrity and includes robust resend/retry logic to ensure reliable data transmission.
📦 Requirements & Installation
🖥️ CPython (PC / Server)
- Requirements
- Python 3.8+
- pyserial — must be installed
- Installation Order
pip install pyserial
pip install chaino
Note: For compatibility with MicroPython,
chainodoes not automatically installpyserialwhen installed in Host PC.
📟 MicroPython (on device)
-
Requirements
- A MicroPython-compatible board (e.g., Raspberry Pi Pico / ESP32)
chainoinstalled on the MicroPython filesystem
-
Installation
- Open Thonny IDE
- Connect your MicroPython device
- Go to Tools → Manage packages...
- Search for
chainoand click Install (from PyPI)
Alternatively, you can enter this in Thonny's package manager command box:
chaino -
Usage
- In MicroPython,
chainocommunicates with the target Chaino device via I²C. - You can send commands and read responses from the connected Chaino board using the same API methods as in CPython, with
portreplaced by I²C parameters.
- In MicroPython,
🔗 Usage Overview
- CPython:
Serial (USB)connection from a PC to the Chaino device. The Chaino deivce may have multiple slave Chaino devices via I²C.
graph TD
PC["PC<br/>(Python)"] -- Serial --> Dev0[Chaino Board]
Dev0 -- I²C --> Dev1[Chaino Board #1]
Dev0 -- I²C --> Dev2[Chaino Board #2]
- MicroPython:
I²Cconnection from a MicroPython device to the Chaino device
graph TD
Dev0["Micropython Board"]
Dev0 -- I²C --> Dev1[Chaino Board #1]
Dev0 -- I²C --> Dev2[Chaino Board #2]
CPython or MicroPython can create an instance of the Chaino class or a subclass of it (e.g., the chaino.Hana class). When creating an instance, specify the serial port name or the I²C address. You can control the Chaino device using the created object, and the usage is designed to be the same in both CPython and MicroPython.
📋 Example
CPython Example
from chaino import Chaino, Hana
# Generate Chaino object via Serial
dev = Chaino("COM3")
print( dev.who() )
# generate Hana object
# and call analogRead(26) function of chaino.Hana device
dev2 = Hana("COM3", 0x40)
adc = dev2.read_analog(26)
print(adc)
MicroPython Example
from chaino import Chaino, Hana
# Generate Chaino object via I2C
dev = Chaino(0x40)
print( dev.who() )
# generate Hana object
# and call analogRead(26) function of chaino.Hana device
dev2 = Hana(0x41)
adc = dev2.read_analog(26)
print(adc)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chaino-0.9.5.tar.gz.
File metadata
- Download URL: chaino-0.9.5.tar.gz
- Upload date:
- Size: 19.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc84f0432bce304cac23c809e6475f95e702d7c9851f420c280fa09e81f8f838
|
|
| MD5 |
b97865cb597985a18cbd4ad0bb90d917
|
|
| BLAKE2b-256 |
8bde2a06a475c80c7dca904ea3a66ae40290f7ecabf51ae22bcb9f5c0151a7fa
|
File details
Details for the file chaino-0.9.5-py3-none-any.whl.
File metadata
- Download URL: chaino-0.9.5-py3-none-any.whl
- Upload date:
- Size: 19.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5522e449cf02b0e47fe1faf8935a51e7d155e543245400e1cd18505e0f501905
|
|
| MD5 |
5ed05b5f41406472948b09a629085ef1
|
|
| BLAKE2b-256 |
b34adecb24f8a0c1f1a2453b09addd6184e8510f9db882290d78f3632526e059
|