MyArduinoLibs organizes the development of multiple Arduino libraries in a single repository. Each directory represents an independent library with its own source code, manifest, version, and package.
The goal is to maintain a standardized workspace without requiring users to install the entire monorepo. After a library is published to the PlatformIO Registry, it can be added independently to another project.
Each library follows the same organization:
<LIBRARY>/
├── README.md
├── assets/
├── development/
│ ├── DEVELOPMENT.md
│ ├── platformio.ini
│ ├── src/
│ │ └── main.cpp
│ └── test/
└── package/
├── library.json
├── library.properties
├── keywords.txt
├── examples/
└── src/
package/: content delivered to the user, including the implementation, API, manifest, and public examples;development/: complete PlatformIO project used to build, upload, and debug directly on the hardware;assets/: datasheets, diagrams, and other internal materials that do not need to accompany the installation.
library.json is the PlatformIO manifest. library.properties and
keywords.txt are used when compatibility with tools from the Arduino
ecosystem is also desired. README.md and the files under assets/ document
the library inside the repository, but they are not included with the installed
package because they are outside package/.
The library code exists only in package/src/. To use it without creating a
copy, development/platformio.ini declares a local dependency:
[env:development]
platform = <platform-id>
board = <board-id>
framework = arduino
lib_deps =
symlink://../packageThe symlink:// protocol makes the development project use the local package
directly and works without manually creating symbolic links in the operating
system.
Each package/ has an independent manifest. A minimal template is:
{
"$schema": "https://raw.githubusercontent.com/platformio/platformio-core/develop/platformio/assets/schema/library.json",
"name": "LibraryName",
"version": "0.1.0",
"description": "Objective description of the library",
"keywords": ["arduino", "embedded"],
"repository": {
"type": "git",
"url": "https://github.com/OwnerName/RepositoryName.git"
},
"authors": [
{
"name": "Author Name",
"maintainer": true
}
],
"frameworks": ["arduino"],
"platforms": "*"
}The name, version, and compatibility must represent the published package. When
support is limited, prefer to list only the platforms that have actually been
validated. The optional export field controls inclusions and exclusions. See
the library.json format
and the export rules.
Each library evolves independently using Semantic Versioning:
MAJOR.MINOR.PATCH
MAJOR: an incompatible API change;MINOR: new backward-compatible functionality;PATCH: a backward-compatible fix.
A suitable tag convention for the monorepo is <LIBRARY>-v<VERSION>. The tag
version must match package/library.json.
development/ must be opened as the PlatformIO project. It contains the
complete environment for building, uploading, and debugging directly on the
hardware, but it does not contain the library implementation.
The driver is edited in package/src/. Only the lab firmware that uses this
driver is kept in development/src/main.cpp.
Enter the library project:
cd <LIBRARY>\developmentIn platformio.ini, configure the platform, board, framework, and local package
dependency:
lib_deps =
symlink://../packagepio runpio run --target upload
pio debugEnter the directory containing library.json and run:
cd ..\package
pio pkg packpio pkg pack applies the manifest rules and locally creates a file such as
LibraryName-0.1.0.tar.gz. It does not build, require a login, or publish
anything. See the
pio pkg pack documentation.
List the package without extracting it:
tar -tf .\LibraryName-0.1.0.tar.gzWith the current structure, the archive must contain only:
library.json
library.properties
keywords.txt
examples/
src/
It does not contain README.md, files from assets/, or any other content kept
outside package/. The .tar.gz is a local verification artifact and normally
should not be versioned.
Publishing requires an authenticated account. For manual use:
pio account login
pio account showAfter logging in, publish from package/:
pio pkg publish --no-interactive--no-interactive removes the terminal confirmation, but it does not replace
the login.
Creating a tag or generating the .tar.gz does not publish the library.
In addition, a previously published name and version combination cannot be reused; a correction requires a new version.
See pio account login
and pio pkg publish.
After publication, the consumer declares only the required package:
[env:application]
platform = <platform-id>
board = <board-id>
framework = arduino
lib_deps =
controlandoeletrons/P4RTC @ 0.1.0Specifying the owner, name, and version requirement avoids ambiguity and keeps the project reproducible. The other directories from the monorepo are not installed.