{"id":43267390,"url":"https://github.com/thmahe/usbrelay-firmware","last_synced_at":"2026-02-01T15:19:25.169Z","repository":{"id":123950461,"uuid":"563558507","full_name":"thmahe/usbrelay-firmware","owner":"thmahe","description":"Atmel AVR Firmware for controlling relay board over USB","archived":false,"fork":false,"pushed_at":"2024-09-11T21:04:14.000Z","size":92,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-09-12T07:15:10.925Z","etag":null,"topics":["atmel","avr-programming","bootloader","firmware","relay-board","usbrelay"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thmahe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-08T21:31:19.000Z","updated_at":"2024-09-11T21:24:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"64414ece-8252-4d60-974d-f466719fc205","html_url":"https://github.com/thmahe/usbrelay-firmware","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/thmahe/usbrelay-firmware","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thmahe%2Fusbrelay-firmware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thmahe%2Fusbrelay-firmware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thmahe%2Fusbrelay-firmware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thmahe%2Fusbrelay-firmware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thmahe","download_url":"https://codeload.github.com/thmahe/usbrelay-firmware/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thmahe%2Fusbrelay-firmware/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28980884,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T13:38:33.235Z","status":"ssl_error","status_checked_at":"2026-02-01T13:38:32.912Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["atmel","avr-programming","bootloader","firmware","relay-board","usbrelay"],"created_at":"2026-02-01T15:19:24.524Z","updated_at":"2026-02-01T15:19:25.160Z","avatar_url":"https://github.com/thmahe.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n \u003cimg width=640px height=320px src=\"https://repository-images.githubusercontent.com/563558507/6cf01a5c-8db2-48f6-9632-5ee800e1851b\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n  [![Status](https://img.shields.io/badge/status-active-success.svg)]() \n  [![GitHub Issues](https://img.shields.io/github/issues/thmahe/usbrelay-firmware.svg)](https://github.com/thmahe/usb-relay-firmware/issues)\n  [![GitHub Pull Requests](https://img.shields.io/github/issues-pr/thmahe/usbrelay-firmware.svg)](https://github.com/thmahe/usb-relay-firmware/pulls)\n  [![License](https://img.shields.io/badge/license-GPL--2.0--only-blue.svg)](/LICENSE)\n\n\u003c/div\u003e\n\n---\n\n\u003cp align=\"center\"\u003e Atmel AVR Firmware for controlling relay board with V-USB (\u003ca href=\"https://www.obdev.at/vusb/\"\u003ehttps://www.obdev.at/vusb/\u003c/a\u003e)\n    \u003cbr\u003e\n    Compatible with www.dcttech.com relay boards\n    \u003cbr\u003e \n\u003c/p\u003e\n\n## Table of Contents\n- [Features](#features)\n- [Getting Started](#getting_started)\n- [Deployment](#deployment)\n- [How to customize it ?](#how_to_customize)\n\n## Features \u003ca name = \"features\"\u003e\u003c/a\u003e\n* [X] Compatible with [darrylb123/usbrelay](https://github.com/darrylb123/usbrelay) host software\n   * [X] Read/Write relay state\n   * [X] Change serial number\n* [X] Hardware schematics\n\n## Getting Started \u003ca name = \"getting_started\"\u003e\u003c/a\u003e\nThese instructions will get you a copy of the project ready to be deployed on your hardware. \n\nSee [deployment](#deployment) for notes on how to flash the firmware.\n\n### Prerequisites\n\nInstall dependencies required to build, deploy \u0026 test usbrelay-firmware.\n\n```shell\n$ sudo apt-get install avr-libc avr-gcc avrdude usbrelay\n```\n\n### Build firmware\n\nTo build usbrelay-firmware simply follow steps below\n\n```shell\n$ git clone git@github.com:thmahe/usbrelay-firmware.git\n$ cd usbrelay\n\n# Fetch v-usb submodule\n$ git submodule init\n$ git submodule update\n\n# Build firmware\n$ make firmware\n```\n\nWith as expected output:\n\n```\navr-gcc ...\n...\navr-objcopy -j .text -j .data -O ihex build/firmware.elf build/firmware.hex\navr-size build/firmware.hex\n   text    data     bss     dec     hex filename\n      0    2444       0    2444     98c build/firmware.hex\n```\n\nBuilt firmware can be found at location `build/firmware.hex`\n\n## Deployment \u003ca name = \"deployment\"\u003e\u003c/a\u003e\n\nBefore deploying your firmware ensure to configure your flashing tool properly.\n\n```shell\n# Default configuration in Makefile\nPROGRAMMER \t= avrisp\nPROGRAMMER_PORT = /dev/ttyUSB0\nPROGRAMMER_BAUD = 19200\n```\n\n### Flash fuses\n```shell\n# Default configuration for fuses in Makefile: \n#   FUSE_L = 0xdf\n#   FUSE_H = 0xca\n\n$ make fuse\n...\navrdude: safemode: Fuses OK (E:FF, H:CA, L:DF)\navrdude done.  Thank you.\n```\n### Flash firmware\n\nFinally flash your firmware by running:\n```shell\n$ make flash\n...\navrdude: safemode: Fuses OK (E:FF, H:CA, L:DF)\navrdude done.  Thank you.\n```\n\n### Interact with your board\nYour device should be available with `usbrelay` under default serial number `UNSET`.\n\n```shell\n$ usbrelay\nDevice Found\n  type: 16c0 05df\n  path: /dev/hidraw1\n  serial_number: UNSET\n  Manufacturer: thmahe.dev\n  Product:      USBRelay4\n  Release:      100\n  Interface:    0\n  Number of Relays = 4\nUNSET_1=0\nUNSET_2=0\nUNSET_3=0\nUNSET_4=0\n```\n\n## How to customize it ? \u003ca name = \"how_to_customize\"\u003e\u003c/a\u003e\n\n### AVR related customization\n\nFrom `Makefile` under **Editable options** section you can customize below variables:\n```\nDEVICE ... Targetted MCU (default: atmega8)\nF_CPU .... MCU frequency in Hz (defautl: 16000000)\n```\n\n### USB Configuration\n\nChange USB ports mapping from `src/usbconfig.h`\n\nDefault mapping:\n```\n#define USB_CFG_IOPORTNAME      B\n#define USB_CFG_DMINUS_BIT      0\n#define USB_CFG_DPLUS_BIT       1\n```\n\n### Relay related customization\n\n#### Number of relay:\n\nSimply modify below line in `src/usbconfig.h`\n```\n#define RELAY_COUNT     4\n```\n\n#### Relay mapping\n\nDepending on your board design you might need to change relay mapping configuration set in `src/main.c`\n\nDefault mapping:\n```c\nuint8_t *OUPTUT_REG[RELAY_COUNT] = {\u0026DDRC, \u0026DDRC, \u0026DDRC, \u0026DDRC};\nuint8_t *RELAY_PORT[RELAY_COUNT] = {\u0026PORTC, \u0026PORTC, \u0026PORTC, \u0026PORTC};\nint RELAY_BIT[RELAY_COUNT] = {0, 1, 2, 3};\n```\n\nGiven mapping above, relay 1 is controlled using PC0 pin.\n\n[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fthmahe%2Fusbrelay-firmware\u0026count_bg=%23868686\u0026title_bg=%23555555\u0026icon=\u0026icon_color=%23E7E7E7\u0026title=hits\u0026edge_flat=false)](https://hits.seeyoufarm.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthmahe%2Fusbrelay-firmware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthmahe%2Fusbrelay-firmware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthmahe%2Fusbrelay-firmware/lists"}