Portable AVR Control Studio is a portable, Windows-centered control and configuration studio for Arduino Uno / ATmega328P AVR deployments. The Arduino Uno already uses an AVR-compatible target; this project compiles firmware for that Uno AVR target and controls/configures it from a portable Tkinter desktop application.
Windows GUI (Tkinter + optional pyserial)
|
| newline-delimited 115200 baud ASCII protocol
v
Arduino Uno / ATmega328P AVR firmware
|
| validated Config struct + EEPROM persistence
v
Sensor input + relay / buzzer outputs documented by hardware profile
The sketch in firmware/PortableAVRControlStudio/PortableAVRControlStudio.ino provides:
- EEPROM-backed
Configstorage with magic/version validation. - Factory defaults for the Arduino Uno / ATmega328P AVR primary target.
- Safe fixed-buffer serial command parsing without Arduino
String. - Customer-facing runtime settings for device name, sensor VREF, thresholds, relay mode, buzzer enable, eco mode, telemetry interval, and UI language placeholder.
- Separate hardware/profile settings for sensor pin, relay pin, buzzer pin, and output polarity.
RELAY_MODE=AUTOthreshold hysteresis based on sensor millivolt readings.- Clear
OK,ERR,CONFIG,STATUS, andDATAresponses.
Supported commands are documented in docs/PROTOCOL.md, including PING, INFO, GET_CONFIG, GET_STATUS, SET,<KEY>,<VALUE>, SAVE_CONFIG, LOAD_CONFIG, FACTORY_RESET, RELAY,ON|OFF|TOGGLE, and BUZZER,ON|OFF|TOGGLE. INFO intentionally returns DATA,INFO,... metadata; command acknowledgements use OK,<COMMAND>.
The desktop app in gui/portable_avr_control_studio.py is branded as Portable AVR Control Studio and includes these areas:
- Connection
- Firmware
- Settings
- Live Monitor
- Hardware Profiles
- Diagnostics
- Logs
- About / Handoff
Runtime settings are configurable from the GUI. The Settings tab validates values before sending them to firmware, including device-name length/characters, numeric ranges, threshold ordering, telemetry and VREF ranges, editable pin ranges, and enum values such as MANUAL/AUTO and ON/OFF.
The GUI can read settings from the board, edit settings, send runtime settings, save settings to EEPROM, factory reset the board, test the relay, and test the buzzer. It parses OK, ERR, CONFIG, STATUS, and DATA lines defensively so malformed serial data is logged instead of crashing the application.
Demo mode remains available for presentations, but it is explicitly labelled as simulation only and does not communicate with physical hardware.
Customer-facing runtime settings are listed in docs/product_spec.md and docs/PROTOCOL.md. Use Save to EEPROM after a successful configuration update if the settings should persist after reset or power loss.
Hardware profiles in docs/profiles/ document expected wiring, output polarity, sensor assumptions, and limitations. Hardware profiles do not auto-detect unknown hardware. Driver boards, inverted outputs, sensor circuits, or additional peripherals may require both a matching profile and matching firmware changes.
The Firmware tab keeps the prepared .hex upload workflow for Arduino Uno / ATmega328P boards using bundled tools/avrdude/ files beside the app, or avrdude on PATH as a fallback.
The same tab also includes Compile Arduino Sketch for Uno for prepared .ino files or Arduino Sketch folders. Sketch compilation is limited to the Arduino Uno / ATmega328P target (arduino:avr:uno) and requires Arduino CLI either bundled beside the app under tools/arduino-cli/ or installed as arduino-cli on PATH. If Arduino CLI is missing, the app reports: “Arduino CLI was not found. Use a package that includes tools/arduino-cli/ or install Arduino CLI before compiling sketches.”
Sketches that use only Arduino core features are supported directly after Arduino CLI has the arduino:avr core available. Sketches that use external libraries require those libraries to already be available to Arduino CLI, or to be installed intentionally by a maintainer/user with Arduino CLI. The app does not automatically repair bad code, guess missing libraries, or install random third-party libraries based on compiler errors. Compiler stdout/stderr is streamed to the Logs tab so missing-library and syntax errors are visible without crashing the GUI.
Uploading a custom sketch replaces the built-in Portable AVR firmware. After uploading a custom sketch, Settings / Status / EEPROM controls only work if that sketch implements the Portable AVR serial protocol. If the custom sketch only prints Serial text, the app may show logs, but Settings and Live Monitor may not work as designed.
Compile success only means Arduino CLI reported a generated HEX. Upload success only means the avrdude firmware transfer command completed; neither result validates physical wiring, relay loads, sensors, power, enclosure safety, or customer hardware installation.
Install Arduino CLI and run the compile checks documented in docs/ARDUINO_CLI.md:
arduino-cli core update-index
arduino-cli core install arduino:avr
arduino-cli compile --fqbn arduino:avr:uno firmware/PortableAVRControlStudioOptional compatible Nano check (secondary only, not required for merge):
arduino-cli compile --fqbn arduino:avr:nano firmware/PortableAVRControlStudioThese are compile checks only for the Arduino Uno AVR target. This repository does not claim physical hardware testing.
From the repository root:
python -m py_compile gui/portable_avr_control_studio.py
python - <<'PY'
from gui.portable_avr_control_studio import parse_serial_line
assert parse_serial_line('OK,PING\n').kind == 'OK'
assert parse_serial_line('CONFIG,RELAY_MODE=AUTO,SENSOR_VREF_MV=5000\n').fields['RELAY_MODE'] == 'AUTO'
assert parse_serial_line('STATUS,SENSOR_RAW=123,SENSOR_MV=601\n').fields['SENSOR_RAW'] == '123'
assert parse_serial_line('garbage\n').malformed
PYInstall pyserial when using real COM ports:
python -m pip install pyserialSee release/README.md for the proposed handoff folder structure, release/FINAL_DELIVERY_SEQUENCE.md for the exact maintainer sequence, release/checklists/release_readiness_checklist.md for final release gates, docs/PACKAGING.md for build details, docs/customer_handoff.md for customer instructions, and release/checklists/customer_zip_checklist.md before assembling a customer ZIP.
A scripted PyInstaller build is:
powershell -ExecutionPolicy Bypass -File .\release\scripts\build_windows_exe.ps1Equivalent manual PyInstaller commands are:
py -m pip install --upgrade pyinstaller pyserial
py -m PyInstaller --noconfirm --onefile --windowed --name PortableAVRControlStudio --distpath release\artifacts\windows --workpath build\pyinstaller --specpath build\pyinstaller-spec gui\portable_avr_control_studio.pyA scripted Arduino CLI artifact build is:
bash release/scripts/build_uno_firmware_hex.shEquivalent manual Arduino CLI commands are:
arduino-cli core update-index
arduino-cli core install arduino:avr
arduino-cli compile --fqbn arduino:avr:uno --output-dir release/artifacts/firmware firmware/PortableAVRControlStudioThe expected prepared firmware artifact is release/artifacts/firmware/PortableAVRControlStudio.ino.hex. Release packages should include PortableAVRControlStudio.ino.hex beside the EXE and tools/avrdude/ with the Windows uploader files staged by the release workflow.
The official Release Build workflow stages Arduino CLI for Windows under release/artifacts/windows/tools/arduino-cli/ and the final customer package includes it under tools/arduino-cli/. If a custom/manual package does not include tools/arduino-cli/, package assembly still succeeds, but compile support falls back to arduino-cli installed on the customer PC PATH. Do not commit generated EXE, HEX, Arduino CLI tools, avrdude tools, libraries, build folders, or ZIP files.
Keep the PR as a real GitHub Draft until documented checks are passing and any required AVR compile evidence is captured. No physical hardware test has been claimed in this repository; real boards, sensors, relays, buzzers, power, and enclosure hardware must be validated before customer deployment.